Using Session In Multiserver Enviornment

Hi, Recently i was told that we cannnot use sessions in multiserver environment.

what is the best way to overcome this issue? Can Cmemcache act as an alternative to sessions?

or should i use redis? which is reliable ?

standard sessions are file-based, so session created on one machine is not accessible on another.

there is number of solutions to this problem:

  1. sticky session - you can configure your loadbalancer to redirect same user always to the same machine. then you can still use file-based session

  2. use session based on some common server: database sessions, memcached, etc (I do not like memcached as it has memory limit and deletes oldest session when needed to store new one even if the old session did not expired yet)

So you are telling cache cannot be an alternate solution to session as it is not reliable ?

so better to use session itself using db…?

any other solution other than this ?

I already gave you alternative - sticky session

Ok. thanks. I will try that.