I have my API running on a tomcat server and would like to know how multiple incoming requests are handled i.e., when the server receives multiple requests at the same time are they processed in parallel or one after the other?
Asked
Active
Viewed 1,436 times
1 Answers
0
You can use the logging facilities of tomcat, on your server.xml file you have something like:
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
Make sure it is uncommented, so all requestes will be logged, then you are able to know how many requests are you handling.
Requests are processed in parallel as far as tomcat run the requests in threads so it will handle requests concurrently.

alphamikevictor
- 1,062
- 6
- 19
-
Thanks for the information. Could you also please tell me what to do to change the processing to one after the other? – Meher May 14 '15 at 07:37
-
Do you mean you want to process in serial rather than in parallel? – alphamikevictor May 14 '15 at 08:49
-
Yes, I want to test the server in that configuration. – Meher May 14 '15 at 09:19
-
Then you need to perform some tricks, like using a JMS with a maximum concurrence of 1, otherwise you won't be able to achive this; unless you can only access from one point and launch Request one after other. – alphamikevictor May 14 '15 at 09:30
-
Instead of sending requests serially from the client can't I change some settings on the server side so that the incoming requests are kept in a queue? – Meher May 14 '15 at 09:55
-
You can use a JMS to process the _core_ of the petition and limit the JMS Queue to a max of 1 client. Perhaps you can configure Tomcat HTTP connector (https://tomcat.apache.org/tomcat-7.0-doc/config/http.html) with `maxConnections=1` or `maxThreads=1`, but this will impact on whole Tomcat performance. Why do you need this strange behaviour? – alphamikevictor May 14 '15 at 11:01
-
I am new to this and am just testing all possibilities. Thank you very much for your help :) – Meher May 14 '15 at 12:08