Memory-backend TTL

Luke Bakken lbakken at
Mon Oct 13 16:30:50 EDT 2014

Hi Lucas,

I've tried reproducing this using a local Riak 2.0.1 node, however TTL
is working as expected.

Here is the configuration I have in /etc/riak/riak.conf:

storage_backend = multi
multi_backend.default = bc_default

multi_backend.ttl_stg.storage_backend = memory
multi_backend.ttl_stg.memory_backend.ttl = 90s
multi_backend.ttl_stg.memory_backend.max_memory_per_vnode = 4MB

multi_backend.bc_default.storage_backend = bitcask
multi_backend.bc_default.bitcask.data_root = /var/lib/riak/bc_default
multi_backend.bc_default.bitcask.io_mode = erlang

This translates to the following in


I set the bucket properties to use the ttl_stg backend:

root at UBUNTU-12-1:~# cat ttl_stg-props.json

root at UBUNTU-12-1:~# curl -XPUT -H'Content-type: application/json'
localhost:8098/buckets/ttl_stg/props --data-ascii @ttl_stg-props.json

root at UBUNTU-12-1:~# curl -XGET localhost:8098/buckets/ttl_stg/props

And used the following statement to PUT test data:

curl -XPUT localhost:8098/buckets/ttl_stg/keys/1 -d "TEST $(date)"

After 90 seconds, this is the response I get from Riak:

root at UBUNTU-12-1:~# curl -XGET localhost:8098/buckets/ttl_stg/keys/1
not found

I would carefully check all of the app.config / riak.conf files in
your cluster, the output of "riak config effective" and the bucket
properties for those buckets you expect to be using the memory backend
with TTL. I also recommend using the localhost:8098/buckets/ endpoint
instead of the deprecated riak/ endpoint.

Please let me know if you have additional questions.
Luke Bakken
Engineer / CSE
lbakken at

On Fri, Oct 3, 2014 at 11:32 AM, Lucas Grijander
<lucasgrinjander69 at> wrote:
> Hello,
> I have a memory backend in production with Riak 2.0.1, 4 servers and 256
> vnodes. The servers have the same date and time.
> I have seen an odd performance with the ttl.
> This is the config:
>            {<<"ttl_stg">>,riak_kv_memory_backend,
>             [{ttl,90},{max_memory,25}]},
> For example, see this GET response in one of the riak servers:
> < HTTP/1.1 200 OK
> < X-Riak-Vclock: a85hYGBgzGDKBVIc4otdfgR/7bfIYEpkzGNlKI1efJYvCwA=
> < Vary: Accept-Encoding
> * Server MochiWeb/1.1 WebMachine/1.10.5 (jokes are better explained) is not
> blacklisted
> < Server: MochiWeb/1.1 WebMachine/1.10.5 (jokes are better explained)
> < Link: </riak/ttl_stg>; rel="up"
> < Last-Modified: Fri, 03 Oct 2014 17:40:05 GMT
> < ETag: "3c8bGoifWcOCSVn0otD5nI"
> < Date: Fri, 03 Oct 2014 17:47:50 GMT
> < Content-Type: application/json
> < Content-Length: 17
> If the TTL is 90 seconds, Why the GET doesn't return "not found" if the
> difference between "Last-Modified" and "Date" (of the curl request) is
> greater than the TTL?
> Thanks in advance!
> _______________________________________________
> riak-users mailing list
> riak-users at

More information about the riak-users mailing list