On 7-May-2009, at 17:28, Peter Crowther wrote:
From: David kerber [mailto:dcker...@verizon.net]
The tomcat application simply takes the post request,
does a checksum verification of it, decrypts the
lightly-encrypted data,
and writes it to a log file with the timestamps and site
identifiers I
mentioned above. Pretty simple processing, and it is all inside a
synchronized{} construct:
protected synchronized void doPost(HttpServletRequest request,
HttpServletResponse response )
throws ServletException, IOException {
synchronized ( criticalProcess ) {
totalReqCount++;
dailyReqCount++;
processRequest( request, response, false );
}
}
Doesn't the "synchronized" in the above mean that you're essentially
single-threading Tomcat? So you have all this infrastructure... and
that sync may well be the bottleneck.
That would be my impression too. It is best to avoid making the
synchronized scope so large, unless there is a very good reason.
David, do you have any reason for this? Beyond the counter, what other
stuff do you synchronise? Also, it has generally been recommended to
me to avoid hitting the disk in every request, since you may result
with an I/O bottle neck, so if you can write the logs in batches you
will have better performance. If you know that you are only going to
have very few users at a time (say, less than 10), it may not be worth
the time optimising this, but if you know that you are going to get at
least several hundred, then this is something to watch out for.
André-John
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org