RE: Prioritizing incoming requests

2010-08-05 Thread Caldarale, Charles R
> From: B. Balakrishna Rao [mailto:balakrishna_...@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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Prioritizing incoming requests

2010-08-05 Thread Juha Laiho
On 5.8.2010 15:50, Caldarale, Charles R wrote:
>> From: B. Balakrishna Rao [mailto:balakrishna_...@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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Prioritizing incoming requests

2010-08-05 Thread Christopher Schultz
-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  on Tomcat

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

4. Each connector also uses an  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
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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org