memcache, redis connection pooling

319 views
Skip to first unread message

Saul Hazledine

unread,
Nov 21, 2010, 6:55:24 AM11/21/10
to Clojure
Hello,
I am looking at adding memcache and redis support to a caching
library that I have written.

Ideally, I'd like TCP/IP connections to be pooled and reused. Pooling
should reduce the number of open connections and remove the latency of
creating new connections. In my experience with other systems, TCP/IP
pooling is more efficient and robust than opening new connections on
every operation - however, if somebody with memcache or redis
knowledge has differing opinion it would be good to hear it.

I am considering the Whalin Java library for memcache which supports
pooling:

https://github.com/gwhalin/Memcached-Java-Client/wiki/HOWTO

Has anyone got experience of using this library with Clojure? Also, is
there a similar library for Redis?

Another possibility is forking and adding pooling to existing memcache
and redis libraries written in Clojure. If I attempted this, does
anybody know of a good TCP/IP connection pool library that works with
Clojure?

Thanks in advance for any help.
Saul

Wilson MacGyver

unread,
Nov 24, 2010, 3:12:05 PM11/24/10
to clo...@googlegroups.com
I highly recommend jedis for redis java lib. It supports connection
pooling, pub/sub.
and works with the 2.0 protocol.

https://github.com/xetorthio/jedis

Any reason why you want to use both memcached and redis at the same time?
redis is basically memcached++, with collection/queue support as values,
and persist the data to disk periodically. I'm not sure what memcached
fits in here if you already have redis.

On Sun, Nov 21, 2010 at 6:55 AM, Saul Hazledine <sha...@gmail.com> wrote:
> Has anyone got experience of using this library with Clojure? Also, is
> there a similar library for Redis?
>
> Another possibility is forking and adding pooling to existing memcache
> and redis libraries written in Clojure. If I attempted this, does
> anybody know of a good TCP/IP connection pool library that works with
> Clojure?
>
> Thanks in advance for any help.
> Saul
>

> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient with your first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

--
Omnem crede diem tibi diluxisse supremum.

Saul Hazledine

unread,
Nov 25, 2010, 3:53:30 AM11/25/10
to Clojure
On Nov 24, 9:12 pm, Wilson MacGyver <wmacgy...@gmail.com> wrote:
> I highly recommend jedis for redis java lib. It supports connection
> pooling, pub/sub.
> and works with the 2.0 protocol.
>
> https://github.com/xetorthio/jedis
>

Many thanks for that. Now it looks like the best way forward is to
wrap existing Java libraries.

> Any reason why you want to use both memcached and redis at the same time?
> redis is basically memcached++, with collection/queue support as values,
> and persist the data to disk periodically. I'm not sure what memcached
> fits in here if you already have redis.
>

I started with a general library for my own use copied from existing
code: (https://github.com/alienscience/cache-dot-clj). That has
evolved into a hobby project for general use. The idea is that
somebody can start with an in-process cache and move to other systems
as the application scales without changing the Clojure API. I take
your point and will go with redis support first though.

Saul
Reply all
Reply to author
Forward
0 new messages