Hi Bryan,

AFAIK, there is no built-in connection pooling for the Riak Erlang client.
Each connection will only connect with one node and only that node, but
since it's masterless you can connect to any node. You could roll your own
connection pooling mechanism, or use something like Poolboy to handle it
for you. Using Poolboy is convenient because it comes as a dependency of
riak_core.

If you use Poolboy, you'll have to modify riakc_pb_socket slightly to
account for the way poolboy initializes connections (add a start_link/1),
or create a simple module to pass the initialization from poolboy to
riakc_pb_socket.

- Joe Lambert


On Mon, Sep 3, 2012 at 11:41 AM, Bryan Hughes <[email protected]> wrote:

>  Hi Guys,
>
> I have a question regarding Riak's protobuffer client gen_server process.
> I have a cluster of 5 nodes (machines), each with consecutive IP
> addresses.  Our application is 100% erlang and runs on its own machine.
> The arguments to riakc_pb_socket:start_link/2 is an Address, Port and the
> optional Options.  The Address and Port is the address of the riak server,
> but in the case of a masterless cluster of 5 machines, which address do I
> use?
>
> In reviewing the code for riakc_pb_socket.erl, the client opens a socket
> via gen_tcp to that particular node in the cluster and only that node.
> This means that there is a 1 to 1 connection between the riak node and the
> client.  Is this correct?  Maybe I am missing something?
>
> If so, then it looks like I need to implement my own round-robin algorithm
> across a pool of protobuffer clients that I am managing, each bound to a
> different node in the cluster while testing "aliveness" with ping/2 and an
> immediate timeout?
>
> Cheers,
> Bryan
>
> --
>
> Bryan Hughes
> *Wobblesoft*
>
> http://www.wobblesoft.com
>
> *"Art is never finished, only abandoned. - Leonardo da Vinci"*
>
>
>
> _______________________________________________
> riak-users mailing list
> [email protected]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to