You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Robert Casties <ca...@mpiwg-berlin.mpg.de> on 2007/07/28 19:26:31 UTC

Throttling load using semaphore in a servlet?

Is it OK to use a semaphore in a servlet? Are there any special problems
that arise?

My problem is that I have an image processing servlet that uses a lot of
CPU depending on certain circumstances. Therefore I want to limit the
number of concurrently running servlets running heavy operations while
at the same time continue to run servlets with only light operations.

Currently I have implemented the logic in the servlet itself using a
semaphore for the heavy operations.

Now I am running into problems with my production server (a pound proxy
serving two tomcats on two separate machines) where all semaphore
tickets are taken but no heavy operations are running.

I will continue to look in my code to see if I'm leaking semaphore
tickets but at the same time I was wondering if this was a problem with
Tomcat's own thread handling that got influenced by my semaphore.

Any thoughts?

Thanks
	Robert


---------------------------------------------------------------------
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