Java Library - best practice

Brian Roach roach at
Tue May 27 23:23:09 EDT 2014


Yes, the Java client is designed to be used across multiple threads.
Instantiate it once and share it.

As you noted, there's options in the configuration for tuning the
internal connection pool. The client maintains a pool of connections
to the Riak node so that multi-threaded applications aren't creating a
new connection every time an operation is performed.

- Roach

On Mon, May 26, 2014 at 4:44 AM, Henning Verbeek <hankipanky at> wrote:
> I'd like to get some advice how best to handle clients in a
> multi-threaded Java application. Riak is 1.4.8, java client library is
> 1.4.4, using the protocol buffers clients.
> I'm referring specifically to
> Should I use one single instance of IRiakClient per JVM and share it
> between all threads that access Riak? Or should each thread obtain its
> own, new client instance when needed and terminate it again
> afterwards?
> If the PBConfiguration specifies a poolSize, is that being handled in
> the Factory?
> Thanks, Henning
> _______________________________________________
> riak-users mailing list
> riak-users at

More information about the riak-users mailing list