How to calculate production configuration for memcache nodes

183 views
Skip to first unread message

rdp

unread,
Jul 19, 2017, 7:56:02 AM7/19/17
to memcached
Hi

I have been working on memcached for a month now

I am using memcache for tomcat websession clusering with help of memcached session manager library .I got it working for sticky and non sticky for 2 tomcats with 2 memcache nodes

I need to implement session replication for 6 tomcat servers in production

I would like to know how the configuration values for production memcache nodes should be evaluated



1) -m config value

   - As I understand "-m" will be amount of memory allocate to memcache node to hold session. When this is full LRU session will be removed and will be unavailable.
   - Lets say if one tomcat server has 200 session during peak traffic and average session size in 2kb
   - Are below calculations correct to decide value to "-m" parameter for a memcache node

     (number of tomcats) X (number of session during peak) X (average session size) 

      6 X 200 X 2kb = 24 MB 

      to be safe i will make this double which is 48 MB
  
     Are there any rules you follow when assigning value "-m"


2) How many memcache nodes will be ideal for 6 tomcats. Is there any rule I can follow to decide number of memcache node ?

3) Number of connection allowed per memcached nodes - How can i determine this ? Is it safe to just make it 
 
        (number of tomcat) X (number of session during peak traffic )

        6 X 200 = 1200  and to be safe I will double this so 2400

    So 2400 connections per memcache node

     Are there any rules you follow when assigning value number of connection on memcache node

4) Is there a performance impact if  memcache nodes sit on different server than tomcat server . Will performance be better if primany memcache node and tomcat are on same server

Regards,

dormando

unread,
Jul 23, 2017, 7:43:10 PM7/23/17
to memcached
Hi,

> I am using memcache for tomcat websession clusering with help of memcached session manager library .I got it working for sticky and non sticky for 2
> tomcats with 2 memcache nodes
>
> I need to implement session replication for 6 tomcat servers in production
>
> I would like to know how the configuration values for production memcache nodes should be evaluated
>
>
>
> 1) -m config value
>
>    - As I understand "-m" will be amount of memory allocate to memcache node to hold session. When this is full LRU session will be removed and will be
> unavailable.
>    - Lets say if one tomcat server has 200 session during peak traffic and average session size in 2kb
>    - Are below calculations correct to decide value to "-m" parameter for a memcache node
>
>      (number of tomcats) X (number of session during peak) X (average session size) 
>
>       6 X 200 X 2kb = 24 MB 
>
>       to be safe i will make this double which is 48 MB
>   
>      Are there any rules you follow when assigning value "-m"

48MB is less than the default, even. You could just leave it there.
There's some overhead per item: 48-56 bytes for headers, plus the key,
plus a few other things. So it's not just 2k each, more like 2.1k
depending on how long your keys are.

Either way, that's a tiny amount of memory.

>
> 2) How many memcache nodes will be ideal for 6 tomcats. Is there any rule I can follow to decide number of memcache node ?

Keep enougn nodes so you can tolerate one failing. You'll have a better
idea of this once you see your load, but I have a feeling your memcached's
will be very idle.

> 3) Number of connection allowed per memcached nodes - How can i determine this ? Is it safe to just make it 
>  
>         (number of tomcat) X (number of session during peak traffic )
>
>         6 X 200 = 1200  and to be safe I will double this so 2400
>
>     So 2400 connections per memcache node
>
>      Are there any rules you follow when assigning value number of connection on memcache node

Not really. Each connection structure uses some memory, so just don't set
it super high.

> 4) Is there a performance impact if  memcache nodes sit on different server than tomcat server . Will performance be better if primany memcache node and
> tomcat are on same server

Having nodes on a different server is how memcached was designed to be
used.

have fun,
-Dormando

rdp

unread,
Jul 24, 2017, 6:25:16 AM7/24/17
to memcached
Thanks a lot Dormando for your response.
Reply all
Reply to author
Forward
0 new messages