Configuring Multiple Connection Pools with JRuby MemCache Client

The JRuby MemCache Client uses Greg Whalin's Java based MemCache client to connect to the servers that implement the MemCache protocol. This client uses a connection pool to connect to and communicate with the memcached servers.

There is one pool by default. It is called "default". You do not need to specify a pool name if you only need one connection pool. This would happen if you only need to talk to a group of servers.

This becomes a little more complicated if you need to communicate with multiple memcached server groups for different purposes. A great example would be using both memcached and Kestrel on the same cluster. This is the situation that we find ourselves under on Project Kenai.

The solution is simple. You can pass a :pool_name parameter when you are building the configuration for the MemCache client:

This results in a separate connection pool being created and allows you to use the JRuby MemCache client to talk to both Kestrel and memcached servers.