You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "B. Balakrishna Rao" <ba...@persistent.co.in> on 2010/08/05 07:49:31 UTC

Prioritizing incoming requests

Hi,

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?

Thanks,
Bala.

DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.

Re: Prioritizing incoming requests

Posted by Juha Laiho <Ju...@iki.fi>.
On 5.8.2010 15:50, Caldarale, Charles R wrote:
>> From: B. Balakrishna Rao [mailto:balakrishna_rao@persistent.co.in]
>> Subject: Prioritizing incoming requests
>>
>> I would like to know if we can prioritizing the incoming requests 
>> in Tomcat.
> 
> Not via configuration.  You're free to adjust the thread priority in your code by calling the appropriate JRE APIs; whether or not that will have any affect depends on the underlying OS.

Note though that when there's an abundance of resources (no
competition), prioritization will not help. In other words,
for the prioritization to have any significant effect, you'll
need to have a (slight) shortage of resources to begin with.

"Report" requests sounds something that might well need to
do more work on the server side than "cart" requests. And more
work will mean slower response, for the general case at least.
-- 
..Juha

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


RE: Prioritizing incoming requests

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: B. Balakrishna Rao [mailto:balakrishna_rao@persistent.co.in]
> Subject: Prioritizing incoming requests
> 
> I would like to know if we can prioritizing the incoming requests 
> in Tomcat.

Not via configuration.  You're free to adjust the thread priority in your code by calling the appropriate JRE APIs; whether or not that will have any affect depends on the underlying OS.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


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


Re: Prioritizing incoming requests

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

B.,

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
another

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
request:
  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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkxa35QACgkQ9CaO5/Lv0PBgiwCgj0ofLFKVweQ6b8MoB93zOZzh
lXwAn1Bi5ivmSeV8lMU7nRfqqgF/xCzA
=MsAs
-----END PGP SIGNATURE-----

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