tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Prioritizing incoming requests
Date Thu, 05 Aug 2010 15:58:12 GMT
Hash: SHA1


On 8/5/2010 1:49 AM, B. Balakrishna Rao wrote:
> I would like to know if we can prioritizing the incoming requests in
> Tomcat. Let's say, I have a report module and a cart module in my web
> application. I would like to give more priority to report module than
> the cart module as Report modules seems to take longer period of
> time. By doing so, What I am thinking is that, Tomcat would give high
> priority to the report requests over the cart requests so that
> reports requests would take lesser time to execute?

While there's no way to prioritize requests per se, you can play tricks
like the following:

1. Implement your reporting actions in one webapp, the cart actions in

2. Deploy the two webapps into two different <Services> on Tomcat

3. Create a <Connector> for each service, where the reporting webapp's
<Connector> contains more request processor threads than the cart's
webapp's <Connector>

4. Each connector also uses an <Executor> which specifies the thread
priority for the request processors

This gives you a kind of poor-man's prioritization.

Another thing you could do is deploy everything together, configure two
<Connector>s for Tomcat, and then always use the high-priority
connector/port for reporting actions and always use the low-priority
connector/port for cart actions.

I have no idea what can or cannot be done with Comet, but it's
conceivable that you could do something like the following using Comet
(which IIRC allows a request to be handled by more than one thread):

1. When a Comet request comes in, put the request into a priority queue
that you write yourself, then take-out the top-priority request and
process it

2. The priority should probably depend on the following attributes of a
  a. The amount of time the request has been in the queue
  b. The type of request (report or cart)

Of course, you really have to watch-out for requests being lost in the
queue if the number of Comet requests and the number of requests in the
queue don't match. Don't ask me how to do that.

Just a couple of ideas.

- -chris
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message