• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

How to handle large number of concurrent users?

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
When maintaning session for a system with very large number of concurrent users, how to manage the memory with very large session-timeout value? Is there a way to handle this? Ofcourse we cant increase the JVM memory.

Thanks in Advance,
Siva
 
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have lot of servers and hardware in cluster

However stoing objects in the session object should be done judiciously.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The thing to remember is that a session is little more than a map full of references to objects on the heap. In other words, the session itself takes up very little memory.

Once you understand that, it should be pretty easy to picture how your use of sessions will affect your app under different loads.

If you have a high volume site, especially if most of the users are only on your site for a second or two, it wouldn't make a lot of sense to load up a session that is going to hang around for 30 minutes with megabytes of data.
Picture how much memory it would take for Google to cache all of your search results in session.

If, on the other hand, your app has a lot of users who log in and then stay on your site for long periods of time, and possibly perform the same functions over and over again (a payroll entry application for instance) then you might actually be able to save memory, reduce the number of times the system needs to run Garbage Collection, or reduce Database IO by caching frequently used objects in the user's session so they don't need to be created and populated over and over again.


On clustering:
If you're using session replication to cluster your app, everything written to session has to be replicated (usually with Java Object Serialization over TCP/IP). This is work that your CPUs and network will have to handle.
It also means that clustering won't really change your memory requirements because all of the nodes in the cluster will have to hold all of the session objects.

Like most design questions, the answer is "it depends".
 
reply
    Bookmark Topic Watch Topic
  • New Topic