aspose file tools
The moose likes Performance and the fly likes Storing data in session. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Performance
Reply Bookmark "Storing data in session." Watch "Storing data in session." New topic
Author

Storing data in session.

pramod mhatre
Greenhorn

Joined: Dec 27, 2012
Posts: 6
I need help to sort out this issue.
my application uses web services for getting results from suppliers.
General flow is search->reprice->booking
In this I want to insert all xml from search to book related to booking reference number in database after booking. So I can design GUI for checking all xml's from front end.
For every action from search to book are there so many xml's. While searching product I use near about 10 suppliers for getting result, so total xml's are more than 100. I need to keep it in session so that I can use proper xml to store in database after booking against booking reference number. My problem is some xml;s are having size 2 to 5 MB. So I think it will cause performance issue with system. Previously I used to store it in db but it also took lot of time to insert and application gets heavily hit it cause db connection exhaust. I need solution where I can maintain all xml in db against booking reference number. Also I can not leave other suppliers search xml after selecting particular product because user can go back and select another product.

Thanks In Advance.
Jayesh A Lalwani
Bartender

Joined: Jan 17, 2008
Posts: 1322
    
    8

XML is not a good solution for storing data. XML is useful when you are communicating between applications. For storage of data, it adds a lot of overhead. It might be better for you to parse the XML and take the data out of it, and store the data in the database
pramod mhatre
Greenhorn

Joined: Dec 27, 2012
Posts: 6
Thanks Jayesh but I am using data from xml for processing as per your suggestion.But our requirement is in case booking fails we need to check what was data xml provided by supplier. Our application use web service for getting data from some other servers of suppliers. Combine all results from all suppliers and show it to end user. Within this process sometimes data mishandling can be done. Sometimes we get proper supplier xml response but while digesting and showing it to front end it gets changed because of some misread while digesting. So we need to check what was the original xml.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12327
    
    1
I would write the XML document to a temporary file, storing the name of the temporary file in the session.

Bill

Java Resources at www.wbrogden.com
pramod mhatre
Greenhorn

Joined: Dec 27, 2012
Posts: 6
Thanks Bill, but I tried it previously, for file read write it takes more time. If I am writing xml in file at the time of search it increase response time for showing search result at browser waiting to complete file writing thread.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12327
    
    1
pramod mhatre wrote:Thanks Bill, but I tried it previously, for file read write it takes more time. If I am writing xml in file at the time of search it increase response time for showing search result at browser waiting to complete file writing thread.


Actually, I doubt that.

If you try to parse the incoming stream to a DOM and then try to serialize it back to text in a file, sure that will be slow - lots of wasted object creation there.

If you just treat the request as a character stream and write it to disk it will be very fast.

Bill
pramod mhatre
Greenhorn

Joined: Dec 27, 2012
Posts: 6
Thanks Bill..
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Storing data in session.
 
Similar Threads
updating check box with HQL in Struts 1.3
Data concurrency issue with multiple MDB instances reading messages from a Queue
Database Location - Bodgitt & Scarper
booking Procedure
Problem while using session for transferring huge data from controller to session