Forum: Ruby on Rails acts_as_stateless ?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
M Daggett (Guest)
on 2005-12-22 19:29
(Received via mailing list)
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
--
Marcel Molina Jr. (Guest)
on 2005-12-22 19:38
(Received via mailing list)
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
Matthew B. (Guest)
on 2005-12-22 19:41
(Received via mailing list)
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/HowtoChang...

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 B.
removed_email_address@domain.invalid :: 607 227 0871
Resume and Portfolio @ http://madhatted.com
M Daggett (Guest)
on 2005-12-22 21:17
(Received via mailing list)
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 B. <removed_email_address@domain.invalid> wrote:
>
>
> _______________________________________________
> Rails mailing list
> removed_email_address@domain.invalid
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
This topic is locked and can not be replied to.