This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JSP and the fly likes Suggestion for filter saving Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Suggestion for filter saving" Watch "Suggestion for filter saving" New topic
Author

Suggestion for filter saving

Adi Kulkarni
Ranch Hand

Joined: Mar 12, 2009
Posts: 86
Hello all,

I'm having a web reporting system developed using J2EE. There are several reports and each of these reports have several columns(8 on an average). The column data can be sorted and filtered.

I have to write a logic to enable the saving of sort and filter for a particular user.

There are 2 flavors here, one is the permanent saving of data, where the data will be saved in the Database. The second one is the temporary saving of data, where the filter/sort data will be saved till the session exists.

Now every time the user makes any filter to any report, I need to save that data so that if the user browses through some other report and comes back, he should see the filtered report.

Now, there are again two options for me to save. The first one is saving the data to session and accessing it from the session variables.
The second one is database again where every time a filter is used, the values will be stored to the DB.



Storing data in the session seems to be a better option for me considering the frequent DB operations to store the temporary data.

My question here is that, is it advisable to store this data to session ? Whats the recommended suggestion for storing the temporary data ?


Thanks,
Aditya


SCJP 1.5
Adi Kulkarni
Ranch Hand

Joined: Mar 12, 2009
Posts: 86
I just need inputs on whether the session object can be used to significant data.

What is the memory allocated to a session object and does it tend to overflow if the data size increases ?

Kindly help me with this query.

Thanks,
Aditya
ramprasad madathil
Ranch Hand

Joined: Jan 24, 2005
Posts: 489

I just need inputs on whether the session object can be used to significant data.
What is the memory allocated to a session object and does it tend to overflow if the data size increases ?
Kindly help me with this query.


Maybe and then again maybe not

If you are looking for a specific number, it isn't there. It depends on the hardware you use for the server, the memory allocated to the heap, the size and tenure of other objects (besides the session) that uses the heap, the session passivation interval set on your server and many more things.

In effect, you'll have to profile/performance test your application mimicking various load conditions to arrive at a safe answer.

cheers,
ram.

Adi Kulkarni
Ranch Hand

Joined: Mar 12, 2009
Posts: 86
Thanks,

So does that mean I can implement it using session for now ?

Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3179
    
  49

Adi Kulkarni wrote:So does that mean I can implement it using session for now ?

Yes, having a memory overflow just because of storing data on sessions is not that often with the modern day hardware infrastructures. You can implement the session storage and perform some stress testing to find out how it really affects. If it's getting bigger, you may need some horizontal scaling on a distributed environment.


Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
Adi Kulkarni
Ranch Hand

Joined: Mar 12, 2009
Posts: 86
Thanks Devaka,

I shall implement using session then.

~Aditya
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Suggestion for filter saving