• 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 Scope & Memory issue

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

In one of the application, the development team used the ActionForm scope as "session". Form beans have list of objects (some cases hash map) which are been retrieved from DB.The issue is we started seeing out of memory errors and we feel the session scope for action form is causing problems.

As this app is in production, is there a way to fix this scope issue.? If struts config is changed to request scope...many UIs are failing as they have some dependency...
I know it is an open question....any one dealt with fixing this type of issue in a large scale app ( more than 400 UI)?

Thanks in advance.

Regards,
Vinod Kumar
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does "400 UI" mean?

In any case, I only keep things in session when I need them in session: I've never put things like search results etc. into a form bean, because they're not part of the form. I put those things in request scope so they'll be collected as soon as possible. If the items in session are data for things like drop-downs, etc. make sure they actually need to be in session scope (as opposed to application scope). If they were put in session for performance reasons consider doing the caching in a different layer.
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is a good question.
We have the similar scenarios when we find a lot of layouts which have no interaction with struts actions.
These are mostly the jsp or a template made by sitemesh.
Since we cannot use url to past request object with href link (same with redirectAction), we must use session.
These sessions are spring sessin beans.
One solution that we do is to use struts2 dispatcher with sitemesh, such that the current layout (menu, navigation button highlight etc.) will be kept but the user can make change to the main body only.
For some pages (eg. item list table, search table etc.) that we must display the content BEFORE it gets submit action, then we must use session.

I am looking for a good solution to get rid of session.

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another solution would be to probably remove the form from the session everytime an expected flow is completed.

For ex. in a registration flow if you have

Reg. Page A -> Reg. Page B -> Reg Summary -> Reg. Confirm

You can remove the form bean from the session before going into the Reg. Confirm and set in the request any data you want in the Reg. Confirm page. The only problem in this approach will be that if the user moves away from the expected path i.e. he does not reach the Reg. Confirm page then the memory remains loaded with the data. But this approach should ideally improve the overall memory management for you with minimum efforts.


 
If you believe you can tell me what to think, I believe I can tell you where to go. Go read this tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic