This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
I am executing a query in a servlet and storing the resultset in a arraylist.Then I send the arraylist through session to jsp, for display. I am noticing that executing query ,looping etc are not taking time but when I pass the request from servlet to jsp,it takes lot of time. My resultset can be big containing 150 records or small depending on query. How can I avoid this bottleneck.What are the other way I can send resultset to jsp so that time can be decreased?
Thank you Ben for reply. I have an asp application which searches records from db.It does all query,searching,business logic in one file.Now we have redesigned it based on j2ee architecture.All processing at servlet and then pass resultset to jsp using session.JSp does pagination etc.But I see somehow this application takes more time then original application.I am printing no of seconds at each step and maximum time taken is when I pass the request from servlet to jsp. Thats is
Then on jsp I again get the time printed as soon as I retrieve the session.I see it takes maximum time at this step.Though db is large but no time is consumed in executing query. Since this application is based on prev application so everybody expects same or atleast high performance from it. Are there any suggestions? Thanks again.
Then it sounds like the bottleneck is in the query execution.
Joined: Dec 22, 2006
Thank you Ben. There is bottleneck in query execution only. I am using jtds driver to connect to SQL Server.Is this making my application slower than original asp application?Are there other alternatives to increase performance? Thanks again.
I think you need to optimise your query. Build indexes on the table if the data is huge. If your earlier application is using pagination then it may be querying the small data which it want to display on each page rather than the whole chunk of data being stored in the Session.
For an Enterprise Application storing a huge chunk of data in the session object is not recommended. More over your application will go for a toss in a clustered environment as Session replication will fail for non serialized objects like Resultset.