# Session storage

**URL:** <https://www.ruby-forum.com/t/session-storage/71684>\
**Category:** Rails\
**Created:** [October 10, 2006, 8:08pm UTC](https://www.ruby-forum.com/t/session-storage/71684 "2006-10-10T20:08:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![luke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/7ab992/32.png) [@luke](https://www.ruby-forum.com/u/luke)\
**Post date:** [October 10, 2006, 8:08pm UTC](https://www.ruby-forum.com/t/session-storage/71684/1 "2006-10-10T20:08:32Z")

</div>

I’m in process of developing my first enterprise RoR application, and  
I’m wondering which kind of session storage to use. I’ve looked over a  
lot of stuff on the net (the very popular speed comparison, a few other  
highly rated [by Google] sites that talk about it), but these don’t  
really clarify exactly what I want to know.

Once this site goes into production, it’s going to have a pretty decent  
sized system behind it… more than enough RAM to go around, tons of  
disk space. What I’m wondering is, given that you have enough RAM that  
even with very heavy loads you’re not going to run out, is using  
memory\_store a good idea?

Right now, as it is in development, I’m using a pstore setup because  
there are only a few developers working on it, and when we test out the  
production environment, it’s currently using a memory\_store. I just  
don’t know if that’s a good idea when it goes live and the boxes are  
getting slammed.

Thanks,  
Luke

---

<div class="post-metadata">

**Author:** ![luke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/7ab992/32.png) [@luke](https://www.ruby-forum.com/u/luke)\
**Post date:** [October 11, 2006, 1:41am UTC](https://www.ruby-forum.com/t/session-storage/71684/2 "2006-10-11T01:41:22Z")

</div>

On Oct 10, 2006, at 11:05 AM, Luke wrote:

> decent  
> don’t know if that’s a good idea when it goes live and the boxes are  
> getting slammed.
> 
> Thanks,  
> Luke

Hey Luke-

```
I would say that you should use the ActiveRecord session store. If

```

that doesn’t perform well enough then switch to the mysql non AR  
session store from stefan kaeyes. Then if you really need more oomph  
you can use memcached for sessions. The normal memory cache session  
that comes with rails will not work if you have more then one rails  
process running. SO if you use more then one fcgi or mongrel the  
normal memory store is not an option.

-Ezra

---

<div class="post-metadata">

**Author:** ![luke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/7ab992/32.png) [@luke](https://www.ruby-forum.com/u/luke)\
**Post date:** [October 11, 2006, 2:39am UTC](https://www.ruby-forum.com/t/session-storage/71684/3 "2006-10-11T02:39:05Z")

</div>

Ezra Z. wrote:

> Hey Luke-
> 
> I would say that you should use the ActiveRecord session store. If  
> that doesn’t perform well enough then switch to the mysql non AR  
> session store from stefan kaeyes. Then if you really need more oomph  
> you can use memcached for sessions. The normal memory cache session  
> that comes with rails will not work if you have more then one rails  
> process running. SO if you use more then one fcgi or mongrel the  
> normal memory store is not an option.

Speaking of AR Session store and memcached, is there some way to use  
memcached to cache the AR session store? I don’t want to use just  
memcached for sessions because I want to be able to flush the cache  
without destroying all the sessions. I’d like to keep the persistence.  
I’m currently using cached\_model to cache all my models, but the session  
isn’t a model.

-matthew

---

<div class="post-metadata">

**Author:** ![luke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/7ab992/32.png) [@luke](https://www.ruby-forum.com/u/luke)\
**Post date:** [October 11, 2006, 2:19pm UTC](https://www.ruby-forum.com/t/session-storage/71684/4 "2006-10-11T14:19:44Z")

</div>

Hey, thanks for the answer. I got another one in email, and that was  
appreciated also. I’m definitely thinking about using memcached, I  
will just have to spend the time learning how to set it up. Although,  
I have to say the following posters question is a good one… is there  
a way to use memcached and be able to flush the cache without  
destroying active sessions?

---

<div class="post-metadata">

**Author:** ![luke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/7ab992/32.png) [@luke](https://www.ruby-forum.com/u/luke)\
**Post date:** [October 11, 2006, 5:50pm UTC](https://www.ruby-forum.com/t/session-storage/71684/5 "2006-10-11T17:50:34Z")

</div>

Check out this really excellent article for all you need to know about  
sessions.

> **[irb Mix Tape — err.the\_blog](http://errtheblog.com/post/24)**
>
> Err the Blog: Ruby and Rails from the front.

Cheers  
Tom
