Welcome! Log In Create A New Profile

Advanced

using memcached for php session management - high load site

Posted by iberkner 
Hi All,

Newbie question, looked around, not clear on the answers.

4 php application servers, currently using file system for session
management

switched over to single 2GB memcached server for dealing with php
sessions

high load site, 3mm page views a day

our cpu and server load was getting "out of control" when I switched
over to the memcached for php session management

how many concurrent connections can memcached handle? how do i check
to see if in fact this is the bottleneck?

any other information regarding what settings / stat values to look
for would be helpful.

I'm considering using a memcaced server for each php app server but
then it wouldn't be a centralized situation.
Read this and make sure it fits your use case.
http://code.google.com/p/memcached/wiki/NewProgrammingFAQ#Why_is_memcached_not_recommended_for_sessions?_Everyone_does_it!

> how many concurrent connections can memcached handle? how do i check
> to see if in fact this is the bottleneck?

my memcached servers handle 8k connections each. I know of others that
have blown this number away. listen_disabled_num tells you how many
times you have hit your connection limit.

> any other information regarding what settings / stat values to look
> for would be helpful.

evictions and measuring hits vs. misses will tell you if your cache is
being used efficiently. There are a ton of other stats. Use something
like Cacti to graph the data. There are a couple of sets of templates
already built for Cacti. See
http://code.google.com/p/memcached/wiki/MonitorLinks

> I'm considering using a memcaced server for each php app server but
> then it wouldn't be a centralized situation.

I personally run memcached on every web server I have. Read
http://code.google.com/p/memcached/wiki/NewConfiguringClient

--

Brian.
--------
http://brian.moonspot.net/
memcache memcached connection connections

On 8 October 2010 05:32, Brian Moon <[email protected]> wrote:

> Read this and make sure it fits your use case.
> http://code.google.com/p/memcached/wiki/NewProgrammingFAQ#Why_is_memcached_not_recommended_for_sessions?_Everyone_does_it
> !
>
>
> how many concurrent connections can memcached handle? how do i check
>> to see if in fact this is the bottleneck?
>>
>
> my memcached servers handle 8k connections each. I know of others that have
> blown this number away. listen_disabled_num tells you how many times you
> have hit your connection limit.
>
>
> any other information regarding what settings / stat values to look
>> for would be helpful.
>>
>
> evictions and measuring hits vs. misses will tell you if your cache is
> being used efficiently. There are a ton of other stats. Use something like
> Cacti to graph the data. There are a couple of sets of templates already
> built for Cacti. See http://code.google.com/p/memcached/wiki/MonitorLinks
>
>
> I'm considering using a memcaced server for each php app server but
>> then it wouldn't be a centralized situation.
>>
>
> I personally run memcached on every web server I have. Read
> http://code.google.com/p/memcached/wiki/NewConfiguringClient
>
> --
>
> Brian.
> --------
> http://brian.moonspot.net/
>
we have a cluster of 2 remote memcache servers for session handling
but im am not supper happy with the built in handler. Id prefer to
have my own PHP level written handler ... unfortunately task gets
pushed from release to release and its always bottom priority ; )

Memcached session works stable untill you hit DB peak or something
else breaks! then apache threads from cluster build up and you finally
exceed connections limit .... things get ugly in that scenario as in
PHP script you wont even know that you did not get connection (session
is just empty so seems like new visit) nor can you tell how long you
want to wait.

some further thoughts (its just my thoughts)
http://artur.ejsmont.org/blog/content/php-session-in-mysql-vs-memcached

but its still pretty damn fast!!!! so we use it : )

>>> any other information regarding what settings / stat values to look
>>> for would be helpful.
>>

my cacti templates if you are new to cacti can be helpful ... full
set for a PHP web server
http://artur.ejsmont.org/blog/content/palm-v3-bundle-of-php-apache-linux-and-memcached-monitoring-scripts-and-cacti-graphs-apc

cheers
Thanks for the information, definitely when our site got very busy things
got "nasty", however we were only using one daemon and I think that what I'm
going to move to is one daemon for each php box. Centralizing the sessions
does not give us a huge advantage at this time as sessions are sticky to the
box. If I can see that I can stabilize the situation on a per box basis,
having a cluster of daemons would probably work well combined with a
centralized solution.

Your Cacti templates look great, thanks, however we use eaccelerator. We
are currently using the mysql and memcached templates from here:

http://code.google.com/p/mysql-cacti-templates/wiki/MemcachedTemplates

http://code.google.com/p/mysql-cacti-templates/wiki/MemcachedTemplatesLearning
is I go along...

Thanks

On Tue, Oct 12, 2010 at 5:02 AM, Artur Ejsmont <[email protected]>wrote:

> we have a cluster of 2 remote memcache servers for session handling
> but im am not supper happy with the built in handler. Id prefer to
> have my own PHP level written handler ... unfortunately task gets
> pushed from release to release and its always bottom priority ; )
>
> Memcached session works stable untill you hit DB peak or something
> else breaks! then apache threads from cluster build up and you finally
> exceed connections limit .... things get ugly in that scenario as in
> PHP script you wont even know that you did not get connection (session
> is just empty so seems like new visit) nor can you tell how long you
> want to wait.
>
> some further thoughts (its just my thoughts)
> http://artur.ejsmont.org/blog/content/php-session-in-mysql-vs-memcached
>
> but its still pretty damn fast!!!! so we use it : )
>
> >>> any other information regarding what settings / stat values to look
> >>> for would be helpful.
> >>
>
> my cacti templates if you are new to cacti can be helpful ... full
> set for a PHP web server
>
> http://artur.ejsmont.org/blog/content/palm-v3-bundle-of-php-apache-linux-and-memcached-monitoring-scripts-and-cacti-graphs-apc
>
> cheers
>
Sorry, only registered users may post in this forum.

Click here to login