Riak and no of clients limit?

Justin Sheehy justin at basho.com
Sat Sep 4 18:47:18 EDT 2010

Hi, Seth.

On Sat, Sep 4, 2010 at 5:59 PM, Seth Falcon <seth at userprimary.net> wrote:

> I'm working on a project where we have a webmachine-backed service
> that talks to Riak.  I currently initialize one pb client for each
> node in the cluster as part of the webmachine startup.  Then the
> resources in the webmachine app ask for one of these clients for each
> request.
> Your comment above about reusing clients for non-concurrent requests
> makes me wonder if this is the wrong approach.  Comments or
> suggestions?

Each instantiated riak_client has a unique client-id that will
represent that client in all updates (put-requests) that it makes.
That is, the entries in the vector clock will match that client-id.
Much of the value of vector clocks can vanish if concurrent writes to
the same values can be issued with the same client-id.

Sharing connections as you describe might be fine, depending on the
details.  However, if your resources might overlap in a way like the
following example then you probably have a problem.

A and B are resource instances handling separate concurrent HTTP
requests but sharing a client-id C.
A issues get(K), receiving object X with vector clock V
B issues get(K), receiving object X with vector clock V
A issues put(K,Xa) where Xa is an update to X
B issues put(K,Xb) where Xb is an update to X

You can lose one of the two updates, as they are both a single update
to V from client C.  It is assumed that a given client will not
compete with itself for updates.

I hope that this explanation is helpful.


More information about the riak-users mailing list