If you fill the session cookie with 4kb of data, that means every http request 
after that to that domain will require the user to upload 4kb of data, which 
may not seem like much, but on a mobile phone for instance, loading a page with 
50 images, that becomes 4*50 = 200kb - pretty significant considering most home 
internet connections do not have very fast upload in many countries. On my own 
internet on a good day that’s at least 2 seconds of uploading.  

So it is best to use session cookies only to store a very small identifier, 
then store more information in a local database or file. If you have a look in 
the rack project you’ll see some other session handlers which do exactly this, 
so you can keep writing data in to the ‘session’ but have it stored locally, 
with only a small cookie with an ID number to lookup the local data stored in 
to the browser.  

—
Bluebie


On Saturday, 7 December 2013 at 8:27 am, Charles McKnight wrote:

> Sure wish the W3C would devise a better state mechanism than cookies...
>  
> On Dec 6, 2013, at 12:49 PM, Magnus Holm <judo...@gmail.com 
> (mailto:judo...@gmail.com)> wrote:
>  
> > You should not store a large amount of data in the session. The
> > session is stored in a cookie, and everything you store there has to
> > be sent back and forth over the network. You can however store an ID
> > in the session and lookup data in your database.
> >  
> > // Magnus Holm
> >  
> >  
> > On Tue, Dec 3, 2013 at 12:04 PM, Francois Sery <sery.franc...@gmail.com 
> > (mailto:sery.franc...@gmail.com)> wrote:
> > > hi , i need some advices.
> > > I a little Camping app i have to store a cart in a session . i tried
> > > achieving it using the default camping/session but it is limited to 4K and
> > > my card miss some data.
> > > how can store more than 4k in a session ? thanks.
> > >  
> > > _______________________________________________
> > > Camping-list mailing list
> > > Camping-list@rubyforge.org (mailto:Camping-list@rubyforge.org)
> > > http://rubyforge.org/mailman/listinfo/camping-list
> > >  
> >  
> > _______________________________________________
> > Camping-list mailing list
> > Camping-list@rubyforge.org (mailto:Camping-list@rubyforge.org)
> > http://rubyforge.org/mailman/listinfo/camping-list
> >  
>  
>  
> "The game's afoot. Follow your spirit, and upon this charge, cry God for 
> Harry, England, and St. George." --- Sherlock Holmes
>  
> _______________________________________________
> Camping-list mailing list
> Camping-list@rubyforge.org (mailto:Camping-list@rubyforge.org)
> http://rubyforge.org/mailman/listinfo/camping-list
>  
>  


_______________________________________________
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Reply via email to