I have an application which generates reports. Currently this is already in place. Here a servlet (A) invokes another servlet (B) to get the job done. Now i have a new requirement to run multiple reports at a time. I have done it in a sequential manner. Thus A invokes B several times one after another. For the generate of each report a DB2 sp is invoked ( which get the Report data). Actually the DB2 sp is time sonsuming & it take an average of 15 mins. Thus if i have 5 reports to be run it will take an avg of 15 * 5 = 75 mins. I have 2 queries: 1. If i do this in a multithreaded way ( by spawning different threads for each reports form Servlet A )will it help reducing the time? 2. Is it a good idea to spawn a thread from a servlet?
Multiple reports at a time? Is it for one user or multiple user. - If multiple user then servlet is already multithreaded. - If one user, then why need multiple reports simultaneously?
I think you need to tune your SQL or DB. - Indexes must be there on appropriate columns. Specifically on columns which participates in condition - ORing should be after ANDing - Use LIKE operator instead of functions like substr(), if any is being used.
posted 15 years ago
It is for One User. Multiple reports run simultaneously for 1 user. For each report a .csv file is generated
This sounds like a candidate for an asynchrous process - since the DB operation is so time consuming, you can't reasonably expect the user to wait for a response. Perhaps JMS to generate the reports and JavaMail to delover them?
I have to agree with Adeel Ansari though, if this is taking so long you might want to review your DB configuration and/or how you've written your Stored Precedures. [ March 29, 2005: Message edited by: Paul Sturrock ]