> From: Wang Han [mailto:[EMAIL PROTECTED]
> the app sends some request to servlet and will handle the response
> after 5 minutes.
> But in the servlet side, it handles the request too fast and always
> sends response back to app in 30 seconds.
>
> So I wonder is there a way to add some delay in tomcat to slow down
> the speed of response?
>
> I know invoking thread.sleep() in servlet is not recommend , so any
> other way please?

It's not recommended because the thread is considered busy through the sleep, 
and isn't recycled to handle another request.  This is a big problem in 
high-load environments as you want maximum throughput with minimum threads... 
but, you have an unusual requirement!

To start with, I'd take the naive approach and see whether it worked well 
enough for the job.  I'd use thread.sleep(), and make sure I had enough worker 
threads (configured in server/conf.xml) to handle the number of outstanding 
requests you want to generate.  That could be many thousands (I don't know your 
requirements), and each one potentially consumes a thread on the host operating 
system, so make sure you're running on a system that has enough memory and 
enough threads configured in the OS.  Sorry I can't be specific on what 
"enough" is, but I've never done this myself!

A second - and completely different - approach would be to throttle the 
bandwidth out of the server in some way, such that the responses were buffered 
for the required time.  I'm not sure this is feasible at the link layer, as I 
presume you're using HTTP, so the TCP acks would have to get back in a timely 
fashion.  If you're able to manage that somehow, though, connecting the Tomcat 
server via the networking equivalent of two tin cans and a piece of string - 
possibly a serial lead? - might provide the slowdown you're looking for.

                - Peter "1200/75 is the future" Crowther

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

Reply via email to