Riak Ruby Client Thread Safe?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Riak Ruby Client Thread Safe?

Keith Bennett
Hi, all.  Is the Ruby Riak::Client thread safe?  I'm wondering if it's safe to share a single Riak::Client instance across all threads in an application.  I might run the app in JRuby, by the way.

Are there any pros and cons to sharing a single client you can offer?

An obvious pro is that it saves some memory, but probably an insignificant amount.

Thanks,
Keith


_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Reply | Threaded
Open this post in threaded view
|

Re: Riak Ruby Client Thread Safe?

Justin Sheehy
Hi, Keith.

It is not safe to share a single Riak client instance across multiple
client-facing threads.

Riak's conflict detection mechanisms will be misled by that sort of
sharing.  Luckily, the client is quite lightweight so you shouldn't
have to worry about the cost of doing it right.

-Justin



On Wed, Jun 15, 2011 at 2:05 PM, Keith Bennett
<[hidden email]> wrote:

> Hi, all.  Is the Ruby Riak::Client thread safe?  I'm wondering if it's safe to share a single Riak::Client instance across all threads in an application.  I might run the app in JRuby, by the way.
>
> Are there any pros and cons to sharing a single client you can offer?
>
> An obvious pro is that it saves some memory, but probably an insignificant amount.
>
> Thanks,
> Keith
>
>
> _______________________________________________
> riak-users mailing list
> [hidden email]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>

_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com