by default tomcat can only process two concurrent requests for the same JSP page?
posted 2 years ago
hi, I encountered the issue of the limited concurrency in tomcat.
In my code, I use Apache HttpClient to send multiple concurrent requests from the client box to the JSP page on server box. Surprisingly, from the server-side log, I noticed tomcat can only process two requests for the particular JSP page concurrently, the requests after the first two would be processed sequentially.
I guess JSP page would be compiled into the thread-safe servlet, which should be able to be called by multiple threads concurrently. I'm not sure where I can change the configurations?
By default, Tomcat can easily process two hundred concurrent requests per JSP page. Or servlet, for that matter. In fact, on my quad-core system, it can process up to 4 of those requests not only concurrently, but simultaneously. The only time that breaks down is when you have more incoming requests than you have processor threads in the thread pool.
If you're seeing what appears to be serial operation, you're either processing so fast that the concurrent capabilities aren't apparent (which is good, since you're getting fast turnaround), OR one of the stages in the pipeline is bottle-necking them. Quite likely you're not doing the client requests as asynchronous operations.
An IDE is no substitute for an Intelligent Developer.