In a web application very slow requests with up to 30 seconds run time has been measured. The MySQL log file does not show any depending slow query, so the problem must be searched in GlassFish or in the application.
With special logging the reason for the bad performance could be found in an class with compiled regular expression pattern, which was used as blacklist filter for all user.
The object was saved on application scope level and the method for checking inputs was defined with synchronized. This bug causes that all following requests must wait, until the check of the current request has completly finished.
Despite of the bugfixing the logs still show up to thousand requests per day with long run time. Strangely enough this occured on the first call of HttpServletRequest.getParameter.
A discussion with Jean-Francois Arcand of Sun adduced, that the long run time come from slow clients or network connections. GlassFish tries to read the requested data, but these have not been send or have been send to slowly from the client.
Advanced logging shows, that the slow requests occur mainly with WAP clients and on POST requests. Seemingly the POST parameter will be send on explicit request.
The problem with slow clients or network connections can naturally not be solved by GlassFish. Only to do is to increase the request queue size in HTTP Service, to ensure that pooled requests will not expire/reject.
Max Pending Count: 8192
[1] GlassFish V2
Author: Johannes HammoudComments Date: 06.07.2008