I altered a controller to use a session variable in place of an instance variable, and this happened Status: 500 Internal Server Error ActionController::Session::CookieStore::CookieOverflow In the docs, it does say: "If you have more than 4K of session data [...] pick another session store." What does the phrase "pick another session store" mean? My purpose in doing this is to keep track of a list assembled by the user. If the user then chooses a sort option, I need to sort the list as it exists. AFAIK there are no other ways to doing this. I know nothing about cookies; does matter how big they are? And, of course, how can I solve my problem? -- Posted via http://www.ruby-forum.com/.
Hi, Your sessions (by default in cookie) needs to be moved to Active record store or memcache store to fix this issue. For Databased sessions: config.action_controller.session_store = :active_record_store You need to create the session table as below rake db:sessions:create rake db:migrate OR For Memcache sessions: config.action_controller.session_store = :mem_cache_store Also you need to setup a mem cache server and configure it as below config.cache_store = :mem_cache_store, ''localhost'', ''127.0.0.1:11211'', {:namespace => ''myapp123''} -NAYAK On Wed, May 27, 2009 at 10:52 AM, Mk 27 <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>wrote:> > I altered a controller to use a session variable in place of an instance > variable, and this happened > > Status: 500 Internal Server Error > ActionController::Session::CookieStore::CookieOverflow > > In the docs, it does say: > > "If you have more than 4K of session data [...] pick another session > store." > > What does the phrase "pick another session store" mean? My purpose in > doing this is to keep track of a list assembled by the user. If the > user then chooses a sort option, I need to sort the list as it exists. > AFAIK there are no other ways to doing this. I know nothing about > cookies; does matter how big they are? > > And, of course, how can I solve my problem? > -- > Posted via http://www.ruby-forum.com/. > > > >-- - NAYAK --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On May 27, 6:45 am, NAYAK <nay...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > Your sessions (by default in cookie) needs to be moved to Active record > store or memcache store to fix this issue. >True, although storing large amounts of data in the session is rarely a good idea. Fred> For Databased sessions: > config.action_controller.session_store = :active_record_store > You need to create the session table as below > rake db:sessions:create > rake db:migrate > > OR > For Memcache sessions: > config.action_controller.session_store = :mem_cache_store > Also you need to setup a mem cache server and configure it as below > config.cache_store = :mem_cache_store, ''localhost'', ''127.0.0.1:11211'', > {:namespace => ''myapp123''} > > -NAYAK > > On Wed, May 27, 2009 at 10:52 AM, Mk 27 <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>wrote: > > > > > > > I altered a controller to use a session variable in place of an instance > > variable, and this happened > > > Status: 500 Internal Server Error > > ActionController::Session::CookieStore::CookieOverflow > > > In the docs, it does say: > > > "If you have more than 4K of session data [...] pick another session > > store." > > > What does the phrase "pick another session store" mean? My purpose in > > doing this is to keep track of a list assembled by the user. If the > > user then chooses a sort option, I need to sort the list as it exists. > > AFAIK there are no other ways to doing this. I know nothing about > > cookies; does matter how big they are? > > > And, of course, how can I solve my problem? > > -- > > Posted viahttp://www.ruby-forum.com/. > > -- > - NAYAK
On Wed, May 27, 2009 at 1:14 PM, Frederick Cheung < frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > > On May 27, 6:45 am, NAYAK <nay...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi, > > > > Your sessions (by default in cookie) needs to be moved to Active record > > store or memcache store to fix this issue. > > > True, although storing large amounts of data in the session is rarely > a good idea. > *Agreed* > Fred > > For Databased sessions: > > config.action_controller.session_store = :active_record_store > > You need to create the session table as below > > rake db:sessions:create > > rake db:migrate > > > > OR > > For Memcache sessions: > > config.action_controller.session_store = :mem_cache_store > > Also you need to setup a mem cache server and configure it as below > > config.cache_store = :mem_cache_store, ''localhost'', ''127.0.0.1:11211'', > > {:namespace => ''myapp123''} > > > > -NAYAK > > > > On Wed, May 27, 2009 at 10:52 AM, Mk 27 < > rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>wrote: > > > > > > > > > > > > > I altered a controller to use a session variable in place of an > instance > > > variable, and this happened > > > > > Status: 500 Internal Server Error > > > ActionController::Session::CookieStore::CookieOverflow > > > > > In the docs, it does say: > > > > > "If you have more than 4K of session data [...] pick another session > > > store." > > > > > What does the phrase "pick another session store" mean? My purpose in > > > doing this is to keep track of a list assembled by the user. If the > > > user then chooses a sort option, I need to sort the list as it exists. > > > AFAIK there are no other ways to doing this. I know nothing about > > > cookies; does matter how big they are? > > > > > And, of course, how can I solve my problem? > > > -- > > > Posted viahttp://www.ruby-forum.com/. > > > > -- > > - NAYAK > > >-- - NAYAK --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Yes, you should store simply an array of ID''s, not the entire objects. An ID (integer) is about 4 bytes or so from memory, so it won''t be terribly much information... ---------------------------------------------- Learn: http://sensei.zenunit.com/ Last updated 20-May-09 (Rails, Basic Unix) Blog: http://random8.zenunit.com/ Twitter: http://twitter.com/random8r On 27/05/2009, at 6:36 PM, NAYAK wrote:> > > On Wed, May 27, 2009 at 1:14 PM, Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > wrote: > > > > On May 27, 6:45 am, NAYAK <nay...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi, > > > > Your sessions (by default in cookie) needs to be moved to Active > record > > store or memcache store to fix this issue. > > > True, although storing large amounts of data in the session is rarely > a good idea. > Agreed > Fred > > For Databased sessions: > > config.action_controller.session_store = :active_record_store > > You need to create the session table as below > > rake db:sessions:create > > rake db:migrate > > > > OR > > For Memcache sessions: > > config.action_controller.session_store = :mem_cache_store > > Also you need to setup a mem cache server and configure it as below > > config.cache_store = :mem_cache_store, ''localhost'', > ''127.0.0.1:11211'', > > {:namespace => ''myapp123''} > > > > -NAYAK > > > > On Wed, May 27, 2009 at 10:52 AM, Mk 27 <rails-mailing- > l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>wrote: > > > > > > > > > > > > > I altered a controller to use a session variable in place of an > instance > > > variable, and this happened > > > > > Status: 500 Internal Server Error > > > ActionController::Session::CookieStore::CookieOverflow > > > > > In the docs, it does say: > > > > > "If you have more than 4K of session data [...] pick another > session > > > store." > > > > > What does the phrase "pick another session store" mean? My > purpose in > > > doing this is to keep track of a list assembled by the user. If > the > > > user then chooses a sort option, I need to sort the list as it > exists. > > > AFAIK there are no other ways to doing this. I know nothing about > > > cookies; does matter how big they are? > > > > > And, of course, how can I solve my problem? > > > -- > > > Posted viahttp://www.ruby-forum.com/. > > > > -- > > - NAYAK > > > > > -- > - NAYAK > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Julian Leviston wrote:> Yes, you should store simply an array of ID''s, not the entire objects. > An ID (integer) is about 4 bytes or so from memory, so it won''t be > terribly much information...This seems a terrible flaw* to me then: how am I supposed to store this kind of data? I cannot use a normal global, instance, or class variable as these could become confused if multiple users are accessing the service at once. Am I supposed to create a new, temporary per user database -- and how would I do that? I guess I could keep track of the search terms that produced the list instead of the list itself, then when a sort is selected, reapply the search and then sort. *but maybe not surprising considering the nature of the html/http beast. -- Posted via http://www.ruby-forum.com/.
Vishwanath Nayak wrote:> For Databased sessions: > config.action_controller.session_store = :active_record_store > You need to create the session table as below > rake db:sessions:create > rake db:migrateAh, I guess that would be the temporary db solution...maybe I''ll try this first. -- Posted via http://www.ruby-forum.com/.
On May 27, 1:46 pm, Mk 27 <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Julian Leviston wrote: > > Yes, you should store simply an array of ID''s, not the entire objects. > > An ID (integer) is about 4 bytes or so from memory, so it won''t be > > terribly much information... > > This seems a terrible flaw* to me then: how am I supposed to store this > kind of data? I cannot use a normal global, instance, or class variable > as these could become confused if multiple users are accessing the > service at once. Am I supposed to create a new, temporary per user > database -- and how would I do that? >Why a per user database? this could be stored in the database completely normally. Fred> I guess I could keep track of the search terms that produced the list > instead of the list itself, then when a sort is selected, reapply the > search and then sort. > > *but maybe not surprising considering the nature of the html/http beast. > -- > Posted viahttp://www.ruby-forum.com/.
Frederick Cheung wrote:> On May 27, 1:46�pm, Mk 27 <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> > Why a per user database? this could be stored in the database > completely normally. > > FredThen I will run into the same "simultaneous" user problem. And it is not data that needs to be kept. Let me flesh this out a bit, as I am sure other people have dealt with almost identical issues: The database contains a list of music albums. The user can view a list of all of them, or they could see a list based on some search criteria (artist or category). I would like to elaborate on this to allow the existing list on view to become more highly customized, using drag and drop, deleting and adding chunks, etc. By default, the list appears sorted alphabetically by title. But the user should also be able to re-sort the existing list based on another criteria -- eg, album length in mb, release date, etc. So rather that just deliver the list as it is requested using an @instance variable, I''m keeping it in the session hash. This way, if they click "Sort by release date", I know what they are looking at and want sorted. AFAIK it looks like I have two options: 1)Move the session data from cookie to Active Record 2)Use the session data to store the previous search terms rather than the whole list, meaning reproduce the list and sort it (which I guess is what I would have done if I had known there was such a tiny limit on the session store size -- at 20-60 bytes per item, it does not take much of list to reach 4k. I was working on a "use memory not processor" bias. I guess that is backward?) Opinions? -- Posted via http://www.ruby-forum.com/.
Julian Leviston wrote:> Yes, you should store simply an array of ID''s, not the entire objects. > An ID (integer) is about 4 bytes or so from memory, so it won''t be > terribly much information... > > ---------------------------------------------- > Learn: http://sensei.zenunit.com/ > Last updated 20-May-09 (Rails, Basic Unix) > Blog: http://random8.zenunit.com/ > Twitter: http://twitter.com/random8rHow can I tell if my program is storing an array or the entire object? Where in the code should I look? The create_sessions migration? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.