What's the maximum storage size of a Session?


#1

Hi there,

does anyone know (for sure) how much data we can technically store in
and later retrieve from a Rails session?

The other option to store and retrieve a really big chunk of data seems
to be a Marshal dump+load. But since this seems more complicated than
with a session, I’d prefer to work with the session if possible.

Thanks for your help!
Tom


#2

Tom Ha wrote:

does anyone know (for sure) how much data we can technically store in
and later retrieve from a Rails session?

Why not store it in the database? The session object should only store a
tiny
bit of volatile context, such as the ID of the current user…


Phlip


#3

On Dec 22, 12:07 am, Tom Ha removed_email_address@domain.invalid wrote:

Hi there,

does anyone know (for sure) how much data we can technically store in
and later retrieve from a Rails session?

It depends on the store. Cookies are limited to 4k (and that’s base64
encoded, so you actually get about 3k of storage). Database stores are
only limited by whatever size limit the column used to store the data
has.
Big sessions are generally a bad idea though

Fred


#4

Thank you !


#5

Although I have idea, I would guess that you can store as much in rails
session as you want. Your server probably won’t like you much though.