Hi Richard,

Yes, sharing a riak-erlang-client connection process among multiple Erlang
processes should not cause any problems. The riak_pb_socket processes are
implemented using a gen_server, and they use a queuing mechanism to handle
concurrent requests. If process A has sent a request and is waiting for a
response, and process B tries to send a request using the same connection
process, its request will get queued up and will be sent once process A's
request gets a reply.

Keep in mind though that this queuing mechanism could cause suboptimal
performance if you have many processes competing for use of a single
connection: users of the connection may end up spending a lot of time
blocked, waiting for requests from other processes to finish. Depending on
the circumstances, you may find that it's better to open multiple
connections than to share a single connection among multiple processes.

Nick

On Wed, May 25, 2016 at 6:28 AM, Richard Jonas <
richard.jo...@erlang-solutions.com> wrote:

> Guys,
>
> most of the examples I can see that riak erlang client processes cannot be
> shared with multiple processes. Is it safe if more processes use the same
> riak connection? So in other words: is riak erlang client thread-safe?
>
> Thanks
>
> --
> Richard Jonas
> Erlang Solutions Hungary Kft
>
> Address:
>   Riverpark Office K.32
>   Közraktár street 32. 3/1.
>   1093 Budapest
>   Hungary
> Phone/fax:
>   +36-1-7000-654
>
> _______________________________________________
> 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

Reply via email to