Saiho Yuen
2006-Jun-05 19:10 UTC
[Rails] ":database_manager =>CGI::Session::MemoryStore" doesn''t work properly...???
Hi, We are try to use the "database_manager =>CGI::Session::MemoryStore" for the session management. our website has a lot of "redirect_to". while the website is running under webrick, everything is fine. But when we run the system under aprache/fcgi. the redirect_to seems doesn''t work anymore with the option "MemoryStore" does anyone have the same problem, or have any idea about this???? Thanks you very much!!!! Saiho The mind is its own place, and in itself. Can make a Heaven of Hell, a Hell of Heaven. http://www.geocities.com/sayoyo/ __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Saiho Yuen
2006-Jun-07 15:07 UTC
[Rails] ":database_manager =>CGI::Session::MemoryStore" doesn''t work properly...???
Hi, We are try to use the "database_manager =>CGI::Session::MemoryStore" for the session management. our website has a lot of "redirect_to". while the website is running under webrick, everything is fine. But when we run the system under aprache/fcgi. the redirect_to seems doesn''t work anymore with the option "MemoryStore" does anyone have the same problem, or have any idea about this???? Thanks you very much!!!! Saiho The mind is its own place, and in itself. Can make a Heaven of Hell, a Hell of Heaven. http://www.geocities.com/sayoyo/ __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Jeremy Evans
2006-Jun-07 15:44 UTC
[Rails] ":database_manager =>CGI::Session::MemoryStore" doesn''t work properly...???
On 6/7/06, Saiho Yuen <sayoyo@yahoo.com> wrote:> We are try to use the "database_manager > =>CGI::Session::MemoryStore" for the session > management. our website has a lot of "redirect_to". > while the website is running under webrick, everything > is fine. But when we run the system under > aprache/fcgi. the redirect_to seems doesn''t work > anymore with the option "MemoryStore" > > does anyone have the same problem, or have any idea > about this???? >MemoryStore is local to the ruby process. So if you have more than one fcgi listener, you will have separate MemoryStores for each process, which will generally break applications that use sessions. The only time MemoryStore is workable is if you are using Webrick or fcgi/scgi/mongrel with a single listener, which is generally not the case in production. Try one of the other session storage options. Jeremy
Saiho Yuen
2006-Jun-08 15:16 UTC
[Rails] ":database_manager =>CGI::Session::MemoryStore" doesn''t work properly...???
Hi Jeremy, First, thanks you very much for the information!!! However, in our case, we have a hugh object stored in the session variable, since each time we receive a html request, rails will serialize and deserialize the session obj. It is a very time consumming task. We have take a look on the session storage option, the only one (we find) which does not serialize object is the memoryStore.... Does it exist another way that will not serializes the session object???? Thanks you very much Saiho --- Jeremy Evans <jeremyevans0@gmail.com> wrote:> On 6/7/06, Saiho Yuen <sayoyo@yahoo.com> wrote: > > We are try to use the "database_manager > > =>CGI::Session::MemoryStore" for the session > > management. our website has a lot of > "redirect_to". > > while the website is running under webrick, > everything > > is fine. But when we run the system under > > aprache/fcgi. the redirect_to seems doesn''t work > > anymore with the option "MemoryStore" > > > > does anyone have the same problem, or have any > idea > > about this???? > > > > MemoryStore is local to the ruby process. So if you > have more than one > fcgi listener, you will have separate MemoryStores > for each process, > which will generally break applications that use > sessions. The only > time MemoryStore is workable is if you are using > Webrick or > fcgi/scgi/mongrel with a single listener, which is > generally not the > case in production. Try one of the other session > storage options. > > Jeremy > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >The mind is its own place, and in itself. Can make a Heaven of Hell, a Hell of Heaven. http://www.geocities.com/sayoyo/ __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Jeremy Evans
2006-Jun-08 16:54 UTC
[Rails] ":database_manager =>CGI::Session::MemoryStore" doesn''t work properly...???
On 6/8/06, Saiho Yuen <sayoyo@yahoo.com> wrote:> However, in our case, we have a hugh object stored in > the session variable, since each time we receive a > html request, rails will serialize and deserialize the > session obj. It is a very time consumming task. > > We have take a look on the session storage option, the > only one (we find) which does not serialize object is > the memoryStore.... > > Does it exist another way that will not serializes the > session object????The only thing I can think of that would allow you to share memory between processes and not serialize session objects is to create a new session store type using SystemVIPC''s SharedMemory class [1] or mmap [2]. That may work if all processes are on the same Unix/Linux/BSD machine. I''m guessing it will require a C extension, if not changes to the ruby interpreter itself, because of memory layout and garbage collection issues. See POSH [3] for an example of a Python extension that does something similar to what I am talking about. IMO, it is probably a better idea to rearchitect your application so that serialization isn''t an issue. Or you could try fixing Rails so that it is thread safe, so you could use one process to serve multiple requests. Both would probably be easier than trying to get multiple ruby processes to share objects in memory without serialization. Jeremy [1] http://deisui.org/~ueno/ruby/sysvipc.html [2] http://moulon.inra.fr/ruby/mmap.html [3] http://poshmodule.sourceforge.net/
Zed Shaw
2006-Jun-08 19:43 UTC
[Rails] ":database_manager =>CGI::Session::MemoryStore" doesn''t work properly...???
On Thu, 2006-06-08 at 08:16 -0700, Saiho Yuen wrote:> Hi Jeremy, > > First, thanks you very much for the information!!! > > However, in our case, we have a hugh object stored in > the session variable, since each time we receive a > html request, rails will serialize and deserialize the > session obj. It is a very time consumming task. >You probably are coming from Java where you would just store an object in the session temporarily as you worked on it. Correct?> We have take a look on the session storage option, the > only one (we find) which does not serialize object is > the memoryStore.... > > Does it exist another way that will not serializes the > session object????Yes, don''t store anything in the session store. Store the object in the database just like normal, even though it''s "partially built". Keep a field of this object to indicate it''s "stage" or "state" so that if someone stops half through you can continue where they left off. Then, the only thing you really could store in the session is an integer indicating what object they are working on at that moment. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/
Saiho Yuen
2006-Jun-09 14:11 UTC
[Rails] ":database_manager =>CGI::Session::MemoryStore" doesn''t work properly...???
Hi Zed, Thanks for the information:)!!!> You probably are coming from Java where you would > just store an object > in the session temporarily as you worked on it. > Correct?yes:)> Yes, don''t store anything in the session store. > Store the object in the > database just like normal, even though it''s > "partially built". Keep a > field of this object to indicate it''s "stage" or > "state" so that if > someone stops half through you can continue where > they left off. > > Then, the only thing you really could store in the > session is an integer > indicating what object they are working on at that > moment.I wonder if I store the session obj in the a database, presently, I change the storage mode to ACtiveRecordStore, I wonder if the data is serialize then put into the field, or it is in binaire mode??? do you have a guess? Thanks you very much again:) Saiho The mind is its own place, and in itself. Can make a Heaven of Hell, a Hell of Heaven. http://www.geocities.com/sayoyo/ __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Saiho Yuen
2006-Jun-09 14:45 UTC
[Rails] ":database_manager =>CGI::Session::MemoryStore" doesn''t work properly...???
Thanks you very much for the information:)!!!!! --- Jeremy Evans <jeremyevans0@gmail.com> wrote:> On 6/8/06, Saiho Yuen <sayoyo@yahoo.com> wrote: > > However, in our case, we have a hugh object stored > in > > the session variable, since each time we receive a > > html request, rails will serialize and deserialize > the > > session obj. It is a very time consumming task. > > > > We have take a look on the session storage option, > the > > only one (we find) which does not serialize object > is > > the memoryStore.... > > > > Does it exist another way that will not serializes > the > > session object???? > > The only thing I can think of that would allow you > to share memory > between processes and not serialize session objects > is to create a new > session store type using SystemVIPC''s SharedMemory > class [1] or mmap > [2]. That may work if all processes are on the same > Unix/Linux/BSD > machine. I''m guessing it will require a C > extension, if not changes > to the ruby interpreter itself, because of memory > layout and garbage > collection issues. See POSH [3] for an example of a > Python extension > that does something similar to what I am talking > about. > > IMO, it is probably a better idea to rearchitect > your application so > that serialization isn''t an issue. Or you could try > fixing Rails so > that it is thread safe, so you could use one process > to serve multiple > requests. Both would probably be easier than trying > to get multiple > ruby processes to share objects in memory without > serialization. > > Jeremy > > [1] http://deisui.org/~ueno/ruby/sysvipc.html > [2] http://moulon.inra.fr/ruby/mmap.html > [3] http://poshmodule.sourceforge.net/ > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >The mind is its own place, and in itself. Can make a Heaven of Hell, a Hell of Heaven. http://www.geocities.com/sayoyo/ __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com