Hi Ivaylo, For read intensive applications a common solution is to perform the caching outside Riak, e.g. using Varnish, memcached or Redis. Often the application will be responsible for populating the cache, but either the application or Riak (through a commit hook) can be responsible for purging old records from the cache when they are updated in Riak.
If you still choose to perform the caching in Riak, you always have the option of using different bucket properties for the cache bucket, e.g. a smaller n_val, in order to optimise performance. Best regards, Christian On Wed, Mar 5, 2014 at 2:24 PM, Brian Sparrow <bspar...@basho.com> wrote: > Hello Ivaylo, > > Yes, you could use a pre-commit hook for this but it's important to > understand the limitations of this design. A pre-commit hook blocks the > write until the hook comes back successful and then it proceeds. This is > going to add latency to write operations on the bitcask backend. An > alternative design would be to do 2 PUTs for each object, one in bitcask > and one in memory, to remove the hook all together. Either will work but > obviously have different trade offs. > > I recommend having a look at the riak_search pre-commit hook(specifically > the pre-commit function)[0] for an example of how to write/install a > pre-commit hook. > > Let me know if you have any questions. > > Thanks! > Brian > > [0] > https://github.com/basho/riak_search/blob/develop/src/riak_search_kv_hook.erl > > > On Tue, Mar 4, 2014 at 11:39 AM, Ivaylo Panitchkov < > ipanitch...@hibernum.com> wrote: > >> >> Hello, >> >> I'm playing with the Bitcask storage backend and realized it will be nice >> if there is a cache functionality realized with the Memory backend. If I >> install both Bitcask and Memory storage backends as Mult Is there any easy >> way, a simple script that could do the caching by simply installing it with >> pre-commit hook? >> >> Thanks in advance, >> Ivaylo Panitchkov >> >> >> _______________________________________________ >> riak-users mailing list >> riak-users@lists.basho.com >> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com >> >> > > _______________________________________________ > riak-users mailing list > riak-users@lists.basho.com > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com > >
_______________________________________________ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com