Another approach for pooling riak pb client connections

Seth Falcon seth at userprimary.net
Thu Apr 14 16:23:19 EDT 2011


Hi all,

Given the recent discussion around David's riakpool project, I thought
I would share the connection pooling solution that I cooked up.  It's
called pooler and you can find it here:

     https://github.com/seth/pooler

It is not tightly coupled to Riak's protocol buffer client, but was
designed with Riak in mind.  Key features:

- Exclusive access to pool members.  The interface does not use a
  higher order function (HOF), but this could be added.  Consumers
  call take_member and return_member.  Short-lived processes, such as
  Webmachine resources, don't need to call return_member; the pool
  manager will see the exit and return the client to the pool.

- Specify an initial and maximum pool size.  Mantains pool size if
  pool members crash.  Does not yet reduce pool size.

- Manages multiple pools.  For Riak, each pool would contain clients
  for a single node.  The take_member function randomly selects a pool
  to draw from giving simple load-balancing among Riak nodes.

- Written as an OTP application.  To use it, you add config for the
  pooler application and call application:start(pooler).

Feedback most welcome.

+ seth

-- 
Seth Falcon | @sfalcon | http://userprimary.net/




More information about the riak-users mailing list