You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Abh N <vi...@yahoo.co.in> on 2006/07/19 06:27:38 UTC

Intermediate write in JSP

Hi,
   
  I have requirement where in I have to fetch around 30k (size around 8MB) records from DB and render in xls.
   
  I am looping through the result set and then using  response.getOutputStream for writing the data
   
  The server has a time out of 5min so by the time data gets completely rendered server times out
   
  What it did was - Kept a counter , when I am finishing looping thru 500 records i write to output stream
   
  b=0
  while rs.next {
   
  if(b==500){
  // write to output stream
  b=0
  }
   
  b++
  }
   
  I am able to overcome server time , once the download is complete I am able to see only last 500 records
   
  Any suggestion on how to overcome this problem
   
  Thanks
   

 				
---------------------------------
 Find out what India is talking about on Yahoo! Answers India.
 Send FREE SMS from New Yahoo! Messenger to Mobile: Download NOW!

Re: Intermediate write in JSP

Posted by Martin Gainty <mg...@hotmail.com>.
I agree with Nikola-

I would run an execution plan on the query in question ..and do so locally (vs a DB 500 miles distant)
specifically note the access (do you see any FTS?) and time deltas (more than 30 sec to see results merits tuning(
Note 
-the attenuated time delta and 
-faster access via hinted HASH/NL Joins etc..

HTH
Martin --
*********************************************************************
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.



----- Original Message ----- 
From: "Nikola Milutinovic" <al...@yahoo.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Wednesday, July 19, 2006 3:01 AM
Subject: Re: Intermediate write in JSP


>> I had a similar issue in the past that I overcome by having the servlet
>> start a separate thread that was producing the report,
>> And a jsp page refreshing every 10 seconds or so checking for completion.
> 
> 
> That is, of course, the asynchronous application design. Sometimes it is necessary, but it does bring a question. What is being so slow? Sending the amount of data you're sending is not slower than it can be. My guess is that DB is taking a rather long time to complete the query. I would not blame the network, because the Net connection between DB and TC should be at least as fast as the one between TC and your client.
> 
> So, the original poster might wanna take a look at the DB for speeding it up. It might not be possible, though.
> 
> Nix.
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
>

Re: Intermediate write in JSP

Posted by Nikola Milutinovic <al...@yahoo.com>.
> I had a similar issue in the past that I overcome by having the servlet
> start a separate thread that was producing the report,
> And a jsp page refreshing every 10 seconds or so checking for completion.


That is, of course, the asynchronous application design. Sometimes it is necessary, but it does bring a question. What is being so slow? Sending the amount of data you're sending is not slower than it can be. My guess is that DB is taking a rather long time to complete the query. I would not blame the network, because the Net connection between DB and TC should be at least as fast as the one between TC and your client.

So, the original poster might wanna take a look at the DB for speeding it up. It might not be possible, though.

Nix.




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Intermediate write in JSP

Posted by "Phil (waex)" <ph...@waex.com>.
Hi, 

I had a similar issue in the past that I overcome by having the servlet
start a separate thread that was producing the report,
And a jsp page refreshing every 10 seconds or so checking for completion.
Philippe


-----Original Message-----
From: Abh N [mailto:viks4tec@yahoo.co.in] 
Sent: 19 July 2006 08:17
To: Tomcat Users List
Subject: Re: Intermediate write in JSP

Thanks Michael ...i will try this option.
   
  I have one more issue.... while looping throught the result set we see the
memory usage increases contineously and then drops (after looping through
~5k) and then  increases again.
  Is there any memory managemnt we can do from our side to that it does not
reaches peak limit.
Do I need to run gc after looping for some record set Michael Jouravlev
<jm...@gmail.com> wrote:
  Try setting buffer size to (8x10^6/3x10^4)x500 == 135K.

On 7/18/06, Abh N wrote:
> Hi,
>
> I have requirement where in I have to fetch around 30k (size around 8MB)
records from DB and render in xls.
>
> I am looping through the result set and then using 
> response.getOutputStream for writing the data
>
> The server has a time out of 5min so by the time data gets completely 
> rendered server times out
>
> What it did was - Kept a counter , when I am finishing looping thru 
> 500 records i write to output stream
>
> b=0
> while rs.next {
>
> if(b==500){
> // write to output stream
> b=0
> }
>
> b++
> }
>
> I am able to overcome server time , once the download is complete I am 
> able to see only last 500 records
>
> Any suggestion on how to overcome this problem
>
> Thanks
>
>
>
> ---------------------------------
> Find out what India is talking about on Yahoo! Answers India.
> Send FREE SMS from New Yahoo! Messenger to Mobile: Download NOW!
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe,
e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org



 				
---------------------------------
 Find out what India is talking about on Yahoo! Answers India.
 Send FREE SMS from New Yahoo! Messenger to Mobile: Download NOW!


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Intermediate write in JSP

Posted by Abh N <vi...@yahoo.co.in>.
Thanks Michael ...i will try this option.
   
  I have one more issue.... while looping throught the result set we see the memory usage increases contineously and then drops (after looping through ~5k) and then  increases again.
  Is there any memory managemnt we can do from our side to that it does not reaches peak limit.
Do I need to run gc after looping for some record set
Michael Jouravlev <jm...@gmail.com> wrote:
  Try setting buffer size to (8x10^6/3x10^4)x500 == 135K.

On 7/18/06, Abh N wrote:
> Hi,
>
> I have requirement where in I have to fetch around 30k (size around 8MB) records from DB and render in xls.
>
> I am looping through the result set and then using response.getOutputStream for writing the data
>
> The server has a time out of 5min so by the time data gets completely rendered server times out
>
> What it did was - Kept a counter , when I am finishing looping thru 500 records i write to output stream
>
> b=0
> while rs.next {
>
> if(b==500){
> // write to output stream
> b=0
> }
>
> b++
> }
>
> I am able to overcome server time , once the download is complete I am able to see only last 500 records
>
> Any suggestion on how to overcome this problem
>
> Thanks
>
>
>
> ---------------------------------
> Find out what India is talking about on Yahoo! Answers India.
> Send FREE SMS from New Yahoo! Messenger to Mobile: Download NOW!
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org



 				
---------------------------------
 Find out what India is talking about on Yahoo! Answers India.
 Send FREE SMS from New Yahoo! Messenger to Mobile: Download NOW!

Re: Intermediate write in JSP

Posted by Michael Jouravlev <jm...@gmail.com>.
Try setting buffer size to (8x10^6/3x10^4)x500 == 135K.

On 7/18/06, Abh N <vi...@yahoo.co.in> wrote:
> Hi,
>
>   I have requirement where in I have to fetch around 30k (size around 8MB) records from DB and render in xls.
>
>   I am looping through the result set and then using  response.getOutputStream for writing the data
>
>   The server has a time out of 5min so by the time data gets completely rendered server times out
>
>   What it did was - Kept a counter , when I am finishing looping thru 500 records i write to output stream
>
>   b=0
>   while rs.next {
>
>   if(b==500){
>   // write to output stream
>   b=0
>   }
>
>   b++
>   }
>
>   I am able to overcome server time , once the download is complete I am able to see only last 500 records
>
>   Any suggestion on how to overcome this problem
>
>   Thanks
>
>
>
> ---------------------------------
>  Find out what India is talking about on Yahoo! Answers India.
>  Send FREE SMS from New Yahoo! Messenger to Mobile: Download NOW!
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org