Storing large data in HTTP Session (Java Application)

Posted by Umesh Awasthi on Programmers See other posts from Programmers or by Umesh Awasthi
Published on 2013-10-17T18:49:08Z Indexed on 2013/10/17 22:18 UTC
Read the original article Hit count: 538

I am asking this question in continuation with http-session-or-database-approach.

I am planning to follow this approach.

  1. When user add product to cart, create a Cart Model, add items to cart and save to DB.
  2. Convert Cart model to cart data and save it to HTTP session.
  3. Any update/ edit update underlying cart in DB and update data snap shot in Session.
  4. When user click on view cart page, just pick cart data from Session and display to customer.

I have following queries regarding HTTP Session

  • How good is it to store large data (Shopping Cart) in Session?
  • How scalable this approach can be ? (With respect to Session)
  • Won't my application going to eat and demand a lot of memory?
  • Is my approach is fine or do i need to consider other points while designing this?

Though, we can control what all cart data should be stored in the Session, but still we need to have certain information in cart data being stored in session?

© Programmers or respective owner

Related posts about design

Related posts about database