size or complexity of object in session impact performance?


Performance and scalability: size or complexity of object in session impact performance?

  1. Hi, Here is a question, the web application I worked on has a big object (complexy object grapch, about 100kb) store in session, now is it going to be a performance problem? If the size is too big, I can try to reduce it, but is it better to break the object into many smllar objects and store them into session? Which way will be a bigger problem? Thanks. David
  2. Hi David, 100KB sessions will mainly be an issue if you're clustering your sessions, thus forcing network operations and serialization of the session state. This is especially an issue for platforms that use multicast for updates. You didn't specify your app server, but most mainstream implementations transfer the complete session as a single network operation and individually serialize-deserialize each session attribute. With these assumptions, breaking up the graph will probably increase serialized size a bit. But if the typical request accesses only a portion of the graph, then this approach may be more efficient as you'll pay the full serialization-deserialization cost only for the changed attributes. I wrote a BEA dev2dev article on clustered session management a while back that goes into a bit more detail ... it discusses Tangosol Coherence and BEA WebLogic session management, but the concepts are fairly generic. On most app servers, it's a rule of thumb to try to keep sessions in the ~1KB to ~10KB range. Unless your session access is very read-heavy, going beyond this may mean finding a more efficient approach to session management (either a packaged solution or added development effort). Jon Purdy Tangosol, Inc.