Is there such a thing that I could use to store sessions in the DB instead of in a cookie so that I can ensure users will be able to access their session data even across several load balancers? We use totally stateless machines here at work and I am worried about deploying a rails app in production that uses a volitile session stored on the machine. Any help is great! Happy Holidays, Mark -- -------------------------------------------------------------------- I am Mark Daggett and I approve this message.
On Thu, 2005-12-22 at 09:26 -0800, M Daggett wrote:> Is there such a thing that I could use to store sessions in the DB > instead of in a cookie so that I can ensure users will be able to > access their session data even across several load balancers? We use > totally stateless machines here at work and I am worried about > deploying a rails app in production that uses a volitile session > stored on the machine. >http://wiki.rubyonrails.com/rails/pages/HowtoChangeSessionStore and though it is a bit old now: http://scott.elitists.net/sessions.html Thats just for sessions though, I''m not sure stateless is the right phrase or if you''re asking for something else. Also, usually the director in a load balancing cluster can tie a client to a specific node until it is inactive for a length of time. If the cluster is only used for one application, you can probably tweak that timeout number and use a ram filesystem for session files. Or go to one of the other alternative session stores. Good luck! -Matthew Beale mixonic-8rZIAEcCR/xWk0Htik3J/w@public.gmane.org :: 607 227 0871 Resume and Portfolio @ http://madhatted.com
On Thu, Dec 22, 2005 at 09:26:26AM -0800, M Daggett wrote:> Is there such a thing that I could use to store sessions in the DB > instead of in a cookie so that I can ensure users will be able to > access their session data even across several load balancers? We use > totally stateless machines here at work and I am worried about > deploying a rails app in production that uses a volitile session > stored on the machine.There is the cookie that holds the session key and then there is the session data itself. Rails already ships with a db session store. rake create_session_table Then edit your config/environement.rb (uncomment this line): config.action_controller.session_store = :active_record_store And that''s it. But if you actually don''t even want a cookie (session id passed along on every url?) then you''ll likely have to do some more work. marcel -- Marcel Molina Jr. <marcel-WRrfy3IlpWYdnm+yROfE0A@public.gmane.org>
Thanks Matthew and Marcel, This is very interesting. I will look into this further, this info is a great help. My ideal solution will be one where I can have n rails apps running concurrently working as a cluster so that they all pull the session data from a central DB. This will allow machines to go up and down without worrying about users losing their session (though it does make the db the single point of failure --which it often is). On 12/22/05, Matthew Beale <mixonic-8rZIAEcCR/xWk0Htik3J/w@public.gmane.org> wrote:> On Thu, 2005-12-22 at 09:26 -0800, M Daggett wrote: > > Is there such a thing that I could use to store sessions in the DB > > instead of in a cookie so that I can ensure users will be able to > > access their session data even across several load balancers? We use > > totally stateless machines here at work and I am worried about > > deploying a rails app in production that uses a volitile session > > stored on the machine. > > > > http://wiki.rubyonrails.com/rails/pages/HowtoChangeSessionStore > > and though it is a bit old now: > > http://scott.elitists.net/sessions.html > > Thats just for sessions though, I''m not sure stateless is the right > phrase or if you''re asking for something else. Also, usually the > director in a load balancing cluster can tie a client to a specific node > until it is inactive for a length of time. If the cluster is only used > for one application, you can probably tweak that timeout number and use > a ram filesystem for session files. > > Or go to one of the other alternative session stores. > > Good luck! > > -Matthew Beale > mixonic-8rZIAEcCR/xWk0Htik3J/w@public.gmane.org :: 607 227 0871 > Resume and Portfolio @ http://madhatted.com > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- -------------------------------------------------------------------- I am Mark Daggett and I approve this message.