Need Some Suggestions
Hi Friends,
This is about improving the response time of the JSPs. I mean I have to display data from a table through a JSP page. The Queries are very heavy. Each time the jsp page is accessed by the user, a database intensive query is executed , which inturn fills the result set and which is further used by the JSP to display the Report/Data of the Result Set. There is one thing that the data is likely, to show a change only once in a period of a Day that is 24 hours. So I believe it is going to be a very intensive operation. Because my JSP has at least 12 links and each link means 12 intensive Queries. SO it means that if I click at a link a Query gets executed (Everytime a click is made) and data is displayed.(The Same Data my get Queried again and again).
I think Since the Data changes only once in a Day(24 hours).How do I handle this situation without going into one SQL Execution per click of a link kind of Situation.
Which in turn Reduces the Response time of the JSP to a great extent.
And I guess makes the process inefficient also. Also toubling tha Database.
Please Help me with a Way out of it.
Thanks
[1170 byte] By [
Vishal.MK] at [2007-9-30 22:53:45]

So just cache the data - don't go back to the database with every click.
If the data is refreshed once every 24 hours, and clients don't mind using that single data set, store it in memory at application scope as an attribute or serialize it to a file in some way.
The only drawback to that is memory. How big are the data sets? Most problems like this trade off time for space and visa versa.
Sure your queries are optimal? Have you checked your SQL and query plans to see if you can do better?
If the logic is that complex, ever thought about capturing it in stored procedures or something?
Does your database have primary keys defined for all the tables? Do you have any indexes that might speed up searching?
%
> Hi Friends,
> This is about improving the response time of the
> JSPs. I mean I have to display data from a table
> through a JSP page. The Queries are very heavy. Each
> time the jsp page is accessed by the user, a database
> intensive query is executed , which inturn fills the
> result set and which is further used by the JSP to
> display the Report/Data of the Result Set. There is
> one thing that the data is likely, to show a change
> only once in a period of a Day that is 24 hours. So I
> believe it is going to be a very intensive operation.
> Because my JSP has at least 12 links and each link
> means 12 intensive Queries. SO it means that if I
> click at a link a Query gets executed (Everytime a
> click is made) and data is displayed.(The Same Data
> my get Queried again and again).
The exact problem is unclear.
First you did add some timing code to determine specifically that it is the queries, rather than say the connection or some other code that is the problem right?
And you are not dragging 100megs across the network right? You aren't doing filters, joins, searches and/or ordering via java rather than via the database?
You also mention "intensive" queries. So why are they intensive? Have you profiled the query itself in the database (not via the java code.) Is it intensive because there are many parts or because there is something odd about the database (like a lack of indexes or large volume.) Or could it be that the query is just structured incorrectly.
As noted also if the data only changes once a day then caching (any number of strategies) is an excellect strategy regardless of anything else. This is particularily true if the query is the same for each user. You could even go further than just caching the data but also caching the page as well.
And if the data is updated in a trackable step then regardless of the update cycle the cache can be refreshed automatically at that time.
Hi,
1) What Database are u using. Oracle or SQL Server
2) On which OS is it ported. Unix, or windows.
3) What application server are u using and on which machine did u host .
4) Are u writing any kind of bussiness logic in JSP pages. (Any kind of manupulation or any kind of adding colors to the tables in the jsp pages).
Let me know about this.
Ratan at 2007-7-7 13:27:52 >
