nicholas.henry-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Sep-26 18:02 UTC
Storing Objects in a Session - how much is too much?
I''m using a web service and to avoid duplicate calls to the service I am caching objects in the session. The object count is probably around 500 max. Is this ok? Is this silly??? Should I be looking at alternative methods. I''m using ActiveRecord/Database sessions. The reason I am asking is that I am having memory issues and wondering if this maybe the cause of it. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Zed A. Shaw
2006-Sep-26 18:42 UTC
Re: Storing Objects in a Session - how much is too much?
On Tue, 26 Sep 2006 18:02:46 -000066 nicholas.henry-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> > I''m using a web service and to avoid duplicate calls to the service I > am caching objects in the session. The object count is probably around > 500 max. Is this ok? Is this silly??? Should I be looking at > alternative methods. I''m using ActiveRecord/Database sessions. The > reason I am asking is that I am having memory issues and wondering if > this maybe the cause of it.Well, first off you probably didn''t measure to see if storing in the session (that goes into the same database) is actually faster than just using the database anyway. Second, you''re taking the 500 objects and multiplying them by however many users you have, rather than sharing then a more space efficient way. I''d say rethink this completely, but first just don''t worry about it, use the AR cleanly without any caching tricks, then profile your app and tune the parts that are slow. -- Zed A. Shaw, MUDCRAP-CE Master Black Belt Sifu http://www.zedshaw.com/ http://mongrel.rubyforge.org/ http://www.lingr.com/room/3yXhqKbfPy8 -- Come get help. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Nicholas Henry
2006-Sep-26 18:46 UTC
Re: Storing Objects in a Session - how much is too much?
Just to clarify, I''m not pulling the data from a database connected to my rails app, I''m pulling the data from an external web service (i.e. I don''t own the data). So yes, definitely pulling the data from the session is faster than executing another query from the web service. On 9/26/06, Zed A. Shaw <zedshaw-dd7LMGGEL7NBDgjK7y7TUQ@public.gmane.org> wrote:> > On Tue, 26 Sep 2006 18:02:46 -000066 > nicholas.henry-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > > > > > I''m using a web service and to avoid duplicate calls to the service I > > am caching objects in the session. The object count is probably around > > 500 max. Is this ok? Is this silly??? Should I be looking at > > alternative methods. I''m using ActiveRecord/Database sessions. The > > reason I am asking is that I am having memory issues and wondering if > > this maybe the cause of it. > > Well, first off you probably didn''t measure to see if storing in the session (that goes into the same database) is actually faster than just using the database anyway. Second, you''re taking the 500 objects and multiplying them by however many users you have, rather than sharing then a more space efficient way. > > I''d say rethink this completely, but first just don''t worry about it, use the AR cleanly without any caching tricks, then profile your app and tune the parts that are slow. > > -- > Zed A. Shaw, MUDCRAP-CE Master Black Belt Sifu > http://www.zedshaw.com/ > http://mongrel.rubyforge.org/ > http://www.lingr.com/room/3yXhqKbfPy8 -- Come get help. > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
but you can always store data localy once retrieved... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---