Hello. I have a quick question regarding storing rails sessions in memcached. Based on what I''ve read, it seems like storing sessions in memcached is one of the fastest session stores for Rails. The question I have has to do with premature ageing out of session objects due to cache pressure coming from other objects in memcached. How does one deal with this? Is there a way to segment memcached to disallow ageing out of session objects due to cache pressure coming from other objects that I might want to store in memcached? Thanks for any help here. -- 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-/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 11/24/06, Sam <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hello. I have a quick question regarding storing rails sessions in > memcached. Based on what I''ve read, it seems like storing sessions in > memcached is one of the fastest session stores for Rails. The question > I have has to do with premature ageing out of session objects due to > cache pressure coming from other objects in memcached. How does one > deal with this? Is there a way to segment memcached to disallow ageing > out of session objects due to cache pressure coming from other objects > that I might want to store in memcached?Memcache doesn''t work like that, items don''t expire or get deleted to make room for new items. Memcache can expire items according to how you configure it, or not expire items at all. I haven''t looked at any of the memcache session stores for ruby, but in most cases memcache is used with some sort of permanent backing storage, because memcache just uses memory and if you stop memcached you lose everything in the cache. Chris --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ok, so it is a good idea to then store sessions in memcached? I don''t believe Rails maintains a backing store for these sessions. Rails filestore doesn''t seem right as it would require too many disk I/Os. I read a document on Rails sessions management and it seems like memcached does the job and will allow us to scale across multiple machines when the time comes. It seems like if the cache is full and we store in sessions in the cache then a user will no longer be able to login due to memcache becoming full. I really would not want to manage such code in my controllers to force invalidate other objects to allow for new logins. Anybody have any good ideas here? Thanks. snacktime wrote:> On 11/24/06, Sam <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> >> Hello. I have a quick question regarding storing rails sessions in >> memcached. Based on what I''ve read, it seems like storing sessions in >> memcached is one of the fastest session stores for Rails. The question >> I have has to do with premature ageing out of session objects due to >> cache pressure coming from other objects in memcached. How does one >> deal with this? Is there a way to segment memcached to disallow ageing >> out of session objects due to cache pressure coming from other objects >> that I might want to store in memcached? > > Memcache doesn''t work like that, items don''t expire or get deleted to > make room for new items. Memcache can expire items according to how > you configure it, or not expire items at all. I haven''t looked at any > of the memcache session stores for ruby, but in most cases memcache is > used with some sort of permanent backing storage, because memcache > just uses memory and if you stop memcached you lose everything in the > cache. > > Chris-- 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-/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 11/24/06, Sam <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Ok, so it is a good idea to then store sessions in memcached? I don''t > believe Rails maintains a backing store for these sessions. Rails > filestore doesn''t seem right as it would require too many disk I/Os. I > read a document on Rails sessions management and it seems like memcached > does the job and will allow us to scale across multiple machines when > the time comes. > > It seems like if the cache is full and we store in sessions in the cache > then a user will no longer be able to login due to memcache becoming > full. I really would not want to manage such code in my controllers to > force invalidate other objects to allow for new logins. Anybody have > any good ideas here?You manage it the same way you do any other store. If your filesystem runs out of space when using database/file storage it''s no different then if memcached runs out of memory. Chris --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---