-
Notifications
You must be signed in to change notification settings - Fork 789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ENHANCEMENT] sessionless version for usage in clouds #2
Comments
this will be available in the "2-full" version/folder |
Just some info on that: This script uses the php $_SESSION, which "is a file" on the server that temporarely saves information about the user's login status. That's the way a login script works (there are alternatives, but don't let's discuss this here). Problem is, that in cloud applications, the entire app is copied 1:1 to serveral servers automatically to handle big loads/traffic/blabla... So when you enter the app as a user, you are automatically directed to server A, B or C, depending on the load of the servers. The database is usally on another server, let's say D. Now, when you login into the app, maybe on server A, do something and maybe come back to the app 30 minutes later, it's possible that the servers/apps load balancer sends you to server B next time. Problem here: your $_SESSION exists on server A (where you logged in and the session was created) but not on server B. This is a known problem, and it would be interesting to bring up a proper solution. Note: Some cloud services share the file system for your app, so server a/b/c will have the same php session folder. Some others don't ! |
Some links on that: http://www.dotdeb.org/2008/08/25/storing-your-php-sessions-using-memcached/ http://stackoverflow.com/q/6490875/1114320 http://stackoverflow.com/q/3480874/1114320 http://www.reddit.com/r/PHP/comments/11p4qs/session_data_when_hosted_on_multiple_servers/ http://phpchunk.net/2012/02/speed-up-your-sessions-part-2-performance/ From a quick research, it looks like saved sessions in the RAM is the way to go. Do cloud servers really share/connect RAM ??? |
not really guaranteed. maybe it would be better if it would depend on availability of either memcache or redis, and only enable shared sessions if those session servers are define()ed or configured. |
Notice: Works in Google App Engine, as they save in memory: https://developers.google.com/appengine/docs/php/#Sessions It's also possible to completely change the way sessions are saved (disk, memory, database) by using alternative/own session functions. This might be interesting for people hosting massive apps in clouds: http://php.net/manual/en/function.session-set-save-handler.php |
I think it's better to close this ticket as this is a high-end edge case problem and not really a topic for a SIMPLE login system. People who really spread their app over multiple servers know what they are doing and have probably a better solution than we would find here... |
Excellent library for this issue: https://github.com/sprain/PHP-MySQL-Session-Handler |
No description provided.
The text was updated successfully, but these errors were encountered: