KK List of Java 8
KK List of Java 8
Dongsoon Choi
The first thing that hits your mind is that Tomcat will be paused by full
GC without responding to all requests being processed. In this
case, what will happen to Apache while Tomcat is paused and
requests are not processed?
While Tomcat is paused, requests will continuously flow into Apache at
200 req/s. In general, before full GC occurs, responses to requests can
be sent quickly by the service with only 10 or more httpd processes.
However, because Tomcat is paused now, new httpd processes will
continuously be created for new inflowing requests within the range
allowed by the MaxClients parameter value of the httpd.conf file. As
the default value is 256, it will not care that the requests are inflowing
at 200 req/s.
At this time, how about the newly created httpd processes?
Httpd processes forwards requests to Tomcat by using the idle
connections in the AJP connection pool managed by
the mod_jk module. If there is no idle connection, it will request to
create new connections. However, because Tomcat is paused, the
request to create new connections will be rejected. Therefore, these
requests will be queued in the backlog queue as many as the size of
the backlog queue, set in the AJP Connector of
the server.xml file, allows.
If the number of queued requests exceed the size of the backlog
queue, a Connection is Refused error will be returned to Apache
and Apache will return the HTTP 503 error to users.
In the assumed situation, the default size of backlogs is 100 and the
requests are flowing in at 200 req/s. Therefore, more than 100
requests will receive the 503 error for 1 second of the pause time
caused by full GC.
In this situation, if full GC is over, sockets in the backlog queue are
retrieved by Tomcat's acceptance and assigned to worker threads
within the range allowed by MaxThreads (defaults to 200) in order to
process requests.
MaxClients
option.