tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Performance with many small requests
Date Fri, 08 May 2009 12:56:41 GMT
Peter Crowther wrote:
>> From: David Kerber []
>> The synchronized section doesn't do a whole lot, so it
>> doesn't take long to process.
> Indeed.  So take a thread dump and see what's happening before making *any* changes to
this key part.
>> My question is, what kinds of operations need to be
>> synchronized?  All I do is decrypt the data from the POST,
>> send a small
>> acknowledgement response back to the site, and write the line
>> to the log
>> file.  Does that sound like something that would need to be
>> synchronized?  If not, pulling that out would be a really easy test to
>> see if it helps my performance issue.
> Decrypt: parallel.
> Send ack: parallel.
> Increment counters: synced.
> Write to log file: synced (or you'll have some very odd stuff happening).

Would a single thread executor service alongside an atomic counter be
useful here?  (my concurrency knowledge isn't so hot).

I'm not sure if a) this is suitable or b) if it would solve the problem,
as you may still end up with a delayed write to the log during peaky
periods - at least they'd be in the right order though.

You could be dumping runnables into it during the post which would
return quickly for the next request.  You'd have to consider
exec.shutdown() & exec.shutdownNow() in your servlet destroy to ensure
you didn't drop data during a shutdown or app restart


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

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

View raw message