php - Using memcache as a session store? -
i have huge problem. 2 days ago site running on 1 server much, purchased 2 more , had them clustered (rsync , load balanced).
i start noticing user hit server-1 , on next request hit server3 session still on server1 instead of server3 , no longer logged in.
i recommended use memcache session stores.
my script uses $_session
.
can memcache installed , enable session handler support , set
session.save_handler = "memcache"
force php use memcache?is there application programming needs done use memcache?
will solve session between server issue?
are session stores stored on servers when created or 1 master memcache server?
i'm using codeiginiter framework
you need set memcache run on 1 of servers , have of servers use same memcache instance sessions. otherwise, if each run own memcache instance, you'll have same problem before.
other configuring memcache accordingly , telling php use session handler, shouldn't have make changes code.
~
to clarify advice gave here, if group 3 servers single pool, won't have problems long every php instance references servers in same order. memcache uses client side hashing, guaranteed same key read / written on same server. of course, if alter list in way, sessions become invalidated.
the memcache developers don't recommend use memcache storing session data because isn't persistent, , if have restart memcache (or happens), of users logged out.
Comments
Post a Comment