memcached timeout

Dani

Well-Known Member
#1
hey, I'm getting flooded with "Can't connect to localhost:11211, Connection timed out."

I've talked to some memcached 'people' and they ask about maxclients limit and so on, and since apache!=litespeed I'm wondering if it's the

PHP_LSAPI_MAX_REQUESTS=600
PHP_LSAPI_CHILDREN=150

they are talking about? And if so which should I raise to get PHP not to loose connections with memcached, and also not get 503 errors :)

I'm using memcached for php sessions + some stuff on the page, with around 3k online users.

thanks
 

mistwang

LiteSpeed Staff
#2
The total PHP processes are PHP_LSAPI_CHILDREN * N-CPU license.
You can check the number of lsphp processes in use during your peak hour. You can reduce PHP_LSAPI_CHILDREN a little bit.
 

Dani

Well-Known Member
#3
ok will do, here is a current log


I had to turn of session memcache and go with the usual files sessions cause of the timeouts. Any idea on that issue? I'm using pconnect and the memcached is on the localhost.
 
Last edited:

xing

LiteSpeed Staff
#4
The memcached errors has very little if anything to do with litespeed. Really. Here is the way to make sure you have everything set up correctly.

1) Make sure memcached exists on a server that has the firewall disabled. Memcached is meant for a lan setup anyways.

2) Make sure you are using a current distro or with proper Linux tcp tunning, ie, short tcp_wait timeouts, etc. The latest versions of redhat/centos are pre-turned out of the box.

3) Make sure you are using the PECL memcache client. Using the latest stable one.

4) Make sure you are using persistent memcache connections. Using PECL memcache, it's persistent by default.

5) Use subversion to checkout memcached trunk from danga.com and compile memcached from there.

The version for public download is quite old. The trunk version has many optimizations.

There should be no reason memcached cannot handle more than 500+ concurrent connections.
 

Dani

Well-Known Member
#5
jupp done all that. compiled the latest 2007-12-06: Version 1.2.4 both --enable-threads and without...

But the LS server runs fine now with the extra server for sql :) nice work on the updates, keep them coming. The reinstall of the server went great with the licence of LS btw.
 

ts77

Well-Known Member
#6
maxconn probably referred to the memcached settings.
memcached has a command-line option to define the number of connections allowed/accepted:
Code:
-c <num>      max simultaneous connections, default is 1024
you might want to raise that a bit.
 

Dani

Well-Known Member
#8
it was the OS settings that were to blame :) didn't think that localhost connections were tracked by ip_conntrack, my bad :)
 
Top