Too many connections error memcached

Matt Bartolome mattxbart at gmail.com
Mon Sep 17 22:57:05 UTC 2007


On 9/17/07, Jeremy Dunck <jdunck at gmail.com> wrote:
> On 9/17/07, Matt Bartolome <mattxbart at gmail.com> wrote:
> > Looks like things have stabilized by running memcached like this:
> > /usr/local/bin/memcached -d -m 1028 -p 11211 -u memcached -c 8000
> >
> > In my setup the connections are eventually closing so setting the
> > higher connection limit works just fine.
> >
>
> Err, I suspect those batches of connections being closed are just from
> apache processes being recycled.  Are you pre-fork?

Yes, I'm looking at my apache2.conf and I'm definitely pre-fork.

>
> If so, try setting MaxRequestsPerChild low and noting whether the
> batches are more frequent and smaller.
>

Setting this to 150, was at 500. Definitely see a better ratio of new
connections vs. closed connections in smaller batches. Seems like it
connects a bunch of clients then systematically closes them in small
batches. From what you're saying it seems like each child process is
making 150 connections, then closing when apache decides to do it on
its end. Is this correct? I could then calculate the max connections
based on my apache2.conf

ServerLimit           50
StartServers          20
MinSpareServers       10
MaxSpareServers       25
MaxClients            50
MaxRequestsPerChild 150

This would be 50 (max clients) X 150 (requests per child) = 7500 max connections

At this point I'm guessing we should probably add another front end
apache server.

> You're likely putting a bandaid on a different problem.  You'll run
> into this problem again if you add more MaxChildren or more apache
> front ends.
>
> Verify what python memcached client you're using and which version it
> is.  Verify what version of memcached you're running.   Come back.  :)
>


More information about the memcached mailing list