tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Error 503 ocurring when server under load
Date Fri, 08 Oct 2010 14:20:44 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Rob,

On 10/7/2010 7:07 PM, Rob G wrote:
> Christopher Schultz wrote
>> I think you might want to compare the request processor counts you
>> have for Tomcat versus mod_jk: the default maxThreads for a Tomcat
>> <Connector> is 200, while your MaxClients settings might be
>> different on your Apache httpd configuration.
>
> Excuse my ignorance, but can you clarify where I check these settings?

Obviously, the worker settings are in your Workers.properties file that
you've already posted. The settings for Apache httpd are usually in a
file called conf/httpd.conf in the Apache httpd installation directory.
On win32, that might be something like C:\Program Files\Apache
Foundation\Apache Web Server\conf\httpd.conf

Tomcat's server settings are in conf/server.xml in the Apache Tomcat
installation directory. On win32, that might be something like
C:\Program Files\Apache Foundation\Apache Tomcat\conf\server.xml

Since you have two copies of Tomcat working, you should check both of
them. In fact, if you could post the server.xml files from both
instances and tell us how you have them configured to run side-by-side,
that would be helpful.

Pid pointed out that you might not have both instances running due to a
shutdownPort conflict. That might also be the case if you have other
ports that conflict.

>> I believe that only the Worker MPM is available on Microsoft Windows. Have you explicitly
configured an MPM?
>
> Since I don't know what an MPM is I'm going to say no.

:) That stands for "Multi-Processing Module" and it's how the Apache Web
Server serves more than one request at a time. On *NIX, you can choose
the "prefork" module which gives you one child process per simultaneous
request, or the "worker" module which gets you a single (child?) process
with many threads running within it. I just checked the documentation
and it looks like on windows, you get mpm_winnt, which is different from
even those, though it quite resembles the mpm_worker.

>> Since you're using Apache 2.x, mod_jk should be able to
>> auto-configure this value for you.
>
> Do I need to set anything to allow this auto config to happen?

No. If you don't set any value, mod_jk will compute a reasonable (and
usually correct) default. For a prefork MPM, having more than a single
connection in the connection pool is a huge waste, since a single httpd
request processor can't make more than one connection to Tomcat on the
backend. With the worker MPM, the connection pool should probably be the
same size as the number of worker threads you have configured.
Otherwise, you'll have a deficit that may cause the errors you are
encountering.

>> From my reading, you may be limiting yourself to 10 simultaneous
>> connections from Apache httpd to Tomcat, and others will get a
>> 503.
>
> What lead you to that conclusion?

Here's the text from the docs:

"
This directive has been deprecated since 1.2.16.
Cachesize defines the number of connections made to the AJP backend that
are maintained as a connection pool. It will limit the number of those
connection that each web server child process can make.

Cachesize property is used only for multi threaded web servers such as
Apache 2.0 (worker), IIS and Netscape. The cachesize property should
reflect the number of threads per child process. JK will discover the
number of threads per child process on Apache 2 web server with
worker-mpm and set its default value to match the ThreadsPerChild
Apache directive. [...]
"

Since mpm_winnt (like mpm_worker) uses ThreadsPerChild to set the number
of worker threads (and therefore simultaneous requests that can be
accepted), you'll have to know what ThreadsPerChild is set to. That's
easy: just search for that directive in httpd.conf. If it's not there,
or commented-out, the default is 64 on mpm_winnt
(http://httpd.apache.org/docs/2.0/mod/mpm_common.html#threadsperchild).

If you've left it as the default (64) and you've set worker.cachesize
(really worker.connection_pool_size) to 10, then you can accept 64
connections from clients but only call-out to Tomcat over 10 of those
connections: the others will have to wait. I'm not sure what the
scheduling algorithm is for choosing which thread gets the next
available connection from the pool (FIFO?), but it's very possible to
starve your clients even after 10 simultaneous connections.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkyvKLwACgkQ9CaO5/Lv0PBAqgCgh3/TNdasW5b6cnHXOP99BxrL
jCIAmgMt/kFdRWIut1m9QF8TmzbZ7zW3
=LXSf
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message