memcached timeout

Discussion in 'General' started by Dani, Dec 11, 2007.

  1. Dani

    Dani New Member

    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
  2. mistwang

    mistwang LiteSpeed Staff

    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.
  3. Dani

    Dani New Member

    ok will do, here is a current log
    [​IMG]

    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: Dec 11, 2007
  4. xing

    xing LiteSpeed Staff

    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.
  5. Dani

    Dani New Member

    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.
  6. ts77

    ts77 New Member

    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.
  7. Dani

    Dani New Member

    hey ts77, yea I'm aware of -c, I even had it around 3k still no go :) don't see a reason to max it out even more.
  8. Dani

    Dani New Member

    it was the OS settings that were to blame :) didn't think that localhost connections were tracked by ip_conntrack, my bad :)

Share This Page