• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Session limits

 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

We created a windows explorer like gui using a servlet that generates the html to displays files and folders from a document management system. At first we thought the data would be relatively small (less than 100 files) but now it looks like it will be over 36,000 files and folders.

Currently, we create an index through an API from the DMS. We store this index in the session because of performance issues. Each file and folder is a class with attributes that is referenced by one class. The file and folder size aren't relevant since we only store attributes about them.

Finally my question.... having a session object with 36,000 classes referenced is a BAD idea right? Secondly, how could I determine the current size of the session?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"How big is the session" isn't actually a meaningful question. When you "store" something in the session you merely create a reference to it. So if you "add" a 36,000 item array to the session you have "used up" the size of one reference.

If you already have the objects in memory, storing references to them in the session only increases the memory footprint by the references.
[ September 15, 2005: Message edited by: Bear Bibeault ]
 
Ranch Hand
Posts: 502
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, let's keep the caching-the-index-in-the-session question aside for a bit. Are you planning on generating an html with 36,000 files and folders to the client? If yes, then your performance would degrade because of the huge HTML that you will generate. If no, then you must be making the user search for certain files, right. Then wouldn't it be simpler and more efficient to query the data that is required by the user and not cache anything?

Ok, now going back to your caching the index:- You can cache your index in the Application scope. This has 2 advantages:- 1) reduced memory usage, because there is just one index and 2) any changes in the index would be reflected immediately across multiple sessions. You have to worry about synchronizing your index, but it's not much differrent than synchronizing your index thatis stored in the session.

However, the disadvantage with caching your index in application/session is that you will have challenge distributing your application across multiple servers. If you deploy your application on multiple web servers, and each web server caches it's own index, then you have to worry about synchronizing the indexes (indices?) across servers
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic