Yii Framework Forum: Using Session In Multiserver Enviornment - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Using Session In Multiserver Enviornment Rate Topic: -----

#1 User is offline   MAHESH.E.U 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 34
  • Joined: 03-September 11
  • Location:Kerala India

Posted 16 March 2013 - 07:28 AM

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 ?
0

#2 User is offline   redguy 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 788
  • Joined: 02-July 10
  • Location:Central Poland

Posted 16 March 2013 - 12:17 PM

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)
red
0

#3 User is offline   MAHESH.E.U 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 34
  • Joined: 03-September 11
  • Location:Kerala India

Posted 16 March 2013 - 01:11 PM

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 ?
0

#4 User is offline   redguy 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 788
  • Joined: 02-July 10
  • Location:Central Poland

Posted 16 March 2013 - 02:45 PM

View PostMAHESH.E.U, on 16 March 2013 - 01:11 PM, said:

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
red
0

#5 User is offline   MAHESH.E.U 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 34
  • Joined: 03-September 11
  • Location:Kerala India

Posted 16 March 2013 - 10:28 PM

Ok. thanks. I will try that.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users