Discussions

General J2EE: Any alternative to storing information in Session object ?

  1. I have a situation in my project wherein a client has to enter data in multiple pages before the data gets actually
    submitted for processing.

    Let me explain it as below.

    Client (from browser) -> Requests 1st page -> Enters data in the 1st page -> Requests 2nd page -> Enters data in 2nd page -> Requests 3rd Page -> Enters data in 3rd page and so on... Client gives the final confirmation to process the data entered only on the final page.

    My question is, Till the client reaches final page and gives the confirmation, all the data entered by the client in previous pages has to be stored somewhere. One place to store this information is in Sessions object. But storing lot of information in Sessions object will reduce the performance. Is there any other technique other than Session object to store data entered by a client for situation such as the one described above ?
  2. Why does storing information in the session reduce performance? Are you certain of that, or did you read it somewhere? As long as the sessions are in-memory (e.g. not database persisted) then the performance will not be altered based on the amount of data in the session, as long as you have enough memory.

    Peace,

    Cameron Purdy
    Tangosol, Inc.
    Coherence: Clustered JCache for Grid Computing!
  3. You must have a ton of data and a quite a few concurrent users to slow the web server down by storing data in the session.

    Say each page has 50 string fields that you need to store.
    => 50 x 7 pages => 350 x 32 Bytes (average size of field) = 11.2 K
    lets say session object adds additional overhead of 1.8 K (just to even out the numbers).
    => Total session mem. usage = 13 k
    => 250 users => 3.25 MB
    => 1000 users => 13 MB
    => 10000 users => 130 MB
    => 25000 users => 325 MB

    You get the picture.