Re: Fw: Can not understand how maxThreads of Connectors works

2013-01-25 Thread Hermes Flying
I am using the correct server.xml.
In the version 5.5.36 the maxThreads of 0 has no effect due to this code in 
org.apache.tomcat.util.net.PoolTcpEndpoint


 public void setMaxThreads(int maxThreads) {
    if( maxThreads  0)
        tp.setMaxThreads(maxThreads);
    }

So what I observe is correct. I.e. with 0 there is no error and also my web 
application works fine since it defaults to 200 threads.
Will check this out in Tomcat 6






 From: Christopher Schultz ch...@christopherschultz.net
To: Tomcat Users List users@tomcat.apache.org 
Sent: Thursday, January 24, 2013 9:09 PM
Subject: Re: Fw: Can not understand how maxThreads of Connectors works
 
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

André,

On 1/24/13 12:14 PM, André Warnier wrote:
 Now, considering this, there are a number of possibilities : - the
 documentation is totally wrong - there is a bug in Tomcat - your
 Tomcat server is not using this server.xml - or, it being rather
 unlikely that processing 0 requests is what a normal user would
 want, the Tomcat developers have coded this so that an obviously
 nonsensical value of 0 would result in the default (of 200) being
 applied.

That last one is not true: the code will happily accept maxThreads=0
but then will throw an exception when the connector tries to actually
start its Executor.

I suspect Hermes is editing some unrelated server.xml file: his
observations seem totally in-line with that hypothesis.

Hermes, try modifying your server.xml file to be syntactically
incorrect. For example, put a !-- into the middle of the file and
try to start Tomcat. If it still starts, you are editing the wrong file.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEBhv8ACgkQ9CaO5/Lv0PDUWgCfWY/BUyhl4rQkZUC19SNB2P72
sckAn2dZwfEd7uVZz6eg0HuPmuZC81j6
=YVBj
-END PGP SIGNATURE-

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

Re: Fw: Can not understand how maxThreads of Connectors works

2013-01-25 Thread André Warnier

Hermes Flying wrote:

I am using the correct server.xml.
In the version 5.5.36 the maxThreads of 0 has no effect due to this code in 
org.apache.tomcat.util.net.PoolTcpEndpoint


 public void setMaxThreads(int maxThreads) {
if( maxThreads  0)
tp.setMaxThreads(maxThreads);
}

So what I observe is correct. I.e. with 0 there is no error and also my web 
application works fine since it defaults to 200 threads.
Will check this out in Tomcat 6



On Jan 16, you wrote this :

Hermes Flying wrote:
 Hi,
 I am using Tomcat 6 (I think it is version 33 but will double check)
 And JVM is Java 6 from IBM
 Do you need exact versions?


And you haven't provided any other version number since then.

So why are you quoting Tomcat 5.5.36 code above ?
Do you actually enjoy confusing people on this list and causing them to uselessly spend 
time answering your questions and trying to reproduce the symptoms which you indicate ?


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



Re: Fw: Can not understand how maxThreads of Connectors works

2013-01-25 Thread Mark Thomas
 On Jan 16, you wrote this :
 
 Hermes Flying wrote:
 Hi,
 I am using Tomcat 6 (I think it is version 33 but will double check)
 And JVM is Java 6 from IBM
 Do you need exact versions?

 
 And you haven't provided any other version number since then.
 
 So why are you quoting Tomcat 5.5.36 code above ?
 Do you actually enjoy confusing people on this list and causing them to
 uselessly spend time answering your questions and trying to reproduce
 the symptoms which you indicate ?

+1

The behaviour in 6.0.x is significantly different to that of 5.5.x.

Mark


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



Re: Fw: Can not understand how maxThreads of Connectors works

2013-01-25 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Hermes,

On 1/25/13 4:16 AM, Hermes Flying wrote:
 I am using the correct server.xml. In the version 5.5.36 the 
 maxThreads of 0 has no effect due to this code in 
 org.apache.tomcat.util.net.PoolTcpEndpoint

You said you were using Tomcat 6. Now you say you are using Tomcat
5.5.36. This is why I asked (long ago) to give us exact versions.

 So what I observe is correct. I.e. with 0 there is no error and
 also my web application works fine since it defaults to 200
 threads. Will check this out in Tomcat 6

Maybe then we'll finally be on the same page.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEC3kIACgkQ9CaO5/Lv0PBZUQCfWTYi3fmEi45N+wWGCVqz+yGf
4ZUAn1CdzM0CexovENDj3YJBhYCa1JIG
=Gc1n
-END PGP SIGNATURE-

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



Re: Fw: Can not understand how maxThreads of Connectors works

2013-01-25 Thread Hermes Flying
Hi,
I actually deploy in 2 servers one in 6 and one in 5. I noticed the same 
behavior described (that was not believed).
I did not aim in taking anyone's time.
All I wanted to do is verify the functionality using really small values.
In a previous mail it was written by someone that he tested this in 6 and he 
said the browser stuck.
I did not notice that.





 From: Christopher Schultz ch...@christopherschultz.net
To: Tomcat Users List users@tomcat.apache.org 
Sent: Friday, January 25, 2013 9:34 PM
Subject: Re: Fw: Can not understand how maxThreads of Connectors works
 
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Hermes,

On 1/25/13 4:16 AM, Hermes Flying wrote:
 I am using the correct server.xml. In the version 5.5.36 the 
 maxThreads of 0 has no effect due to this code in 
 org.apache.tomcat.util.net.PoolTcpEndpoint

You said you were using Tomcat 6. Now you say you are using Tomcat
5.5.36. This is why I asked (long ago) to give us exact versions.

 So what I observe is correct. I.e. with 0 there is no error and
 also my web application works fine since it defaults to 200
 threads. Will check this out in Tomcat 6

Maybe then we'll finally be on the same page.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEC3kIACgkQ9CaO5/Lv0PBZUQCfWTYi3fmEi45N+wWGCVqz+yGf
4ZUAn1CdzM0CexovENDj3YJBhYCa1JIG
=Gc1n
-END PGP SIGNATURE-

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

Re: Fw: Can not understand how maxThreads of Connectors works

2013-01-25 Thread Mark Thomas
On 25/01/2013 19:58, Hermes Flying wrote:
 Hi, I actually deploy in 2 servers one in 6 and one in 5. I noticed
 the same behavior described (that was not believed). I did not aim
 in taking anyone's time. All I wanted to do is verify the
 functionality using really small values. In a previous mail it was
 written by someone that he tested this in 6 and he said the browser
 stuck. I did not notice that.

Exact Tomcat version. Exact connector configuration...

This is getting tiresome.

Mark

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



Re: Fw: Can not understand how maxThreads of Connectors works

2013-01-24 Thread André Warnier

Hermes Flying wrote:

Hi,
So is there an explanation for this? All I am interested is make sure that 
after a limit, clients attempted to connect are stopped based on my 
configuration on maxThreads and accept count.
But I can not figure out how this works.



(This all being explained in vernacular language to which experts may object).

Threads in Tomcat serve to process requests.  Each Thread can process one 
request.
0 Threads = 0 requests being processed.
n Threads = n requests can be processed simultaneously (kind of).

Threads belong to either a Connector (by default), or an Executor (if you configure 
several Connectors to use an Executor, then they use the common pool of Threads of the 
Executor, instead of their own individual pool of Threads).


Having a common pool of Threads between several Connectors is normally more efficient and 
allows for a smoother operation.  Otherwise you could have the case that requests arriving 
through one Connector (e.g. HTTP) are being starved because this particular Connector has 
no more Threads available, while on the other hand another Connector (e.g. AJP) still has 
plenty of capacity.


The acceptCount is another matter entirely, working at a deeper level.
Before a Thread is assigned to process a request,
- the client requests a TCP connection to the server
- the server must accept this connection. If it doesn't within a certain time, the 
client will get an error (connect timeout).
- when the server accepts the connection, it goes into a queue. The length of that queue 
corresponds to the acceptCount of the corresponding Connector.

(If the accept queue is already full, the connection request will be rejected).
As long as the server does no further action, an accepted connection stays in the queue 
and the client request does not proceed. If that lasts a long time, the client may timeout 
(usually saying that the server is not responsive).
- whenever the server feels like it (for example, when it sees that it has at least one 
Thread free to handle a request), it will pop the first connection from the accept queue, 
and pass it to a Thread to be processed.
Now a Thread is assigned to process this request, so one less Thread is available in the 
pool of Threads.

- if another client connection happens now, it goes into the accept queue.
- whenever the original Thread is done processing the request, the Thread goes back into 
the pool of available Threads, and could be assigned to another client request currently 
sitting in the accept queue.


That's roughly how it works.
If it does not do so in your case, then it must mean that you are setting your parameters 
in the wrong place, and Tomcat is either not seeing them at all, or ignoring them because 
they are not where they should be.


The default Tomcat settings are chosen by people who know what they are doing, to obtain a 
reasonable Tomcat behaviour over a reasonable range of conditions.
If you change these settings, you can get a behaviour that is no longer reasonable or 
balanced.
For example, if you set the accepCount to 1 and maxThreads to 1, then you can have the 
following :

- 1 request accepted and allocated a Thread, thus in process
- 1 additional request being queued in the accept queue, waiting for a Thread to become 
available
And any additional client request arriving at that time will be rejected at the TCP level. 
 That will hardly result in an error that is understandable by the clients.


Intuitively, it does not seem to make a lot of sense to set up a whole machinery like a 
host, a JVM and a Tomcat, just to process one single request at a time.


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



Re: Fw: Can not understand how maxThreads of Connectors works

2013-01-24 Thread Hermes Flying
Hi,
I don't see how this answers my issue.
1) You say 0 threads means 0 requests being processed. This does not happen. 
Requests are being processed. No error noticed
2)You say: you are setting your parameters in the wrong place. This is not 
the case here.I already send an example server.xml. Will copy/paste it again 
bellow
3)It does not seem to make a lot of sense to set up a whole machinery like a 
host, a JVM and a Tomcat, just to process one single request at a time. I am 
not planning to do that, but I must see how the system behaves in various 
configuration. Tomcat does not seem to behave as expected in the trivial case.
4) The default Tomcat settings are chosen by people who know what they are 
doing, to obtain a reasonable Tomcat behaviour over a reasonable range 
of conditions What does this actually mean? That we are not supposed to 
configure Tomcat according to our needs?


?xml version='1.0' encoding='utf-8'?
Server port=8005 shutdown=SHUTDOWN

  !--APR library loader. Documentation at /docs/apr.html --
  Listener className=org.apache.catalina.core.AprLifecycleListener 
SSLEngine=on /
  !--Initialize Jasper prior to webapps are loaded. Documentation at 
/docs/jasper-howto.html --
  Listener className=org.apache.catalina.core.JasperListener /
  !-- Prevent memory leaks due to use of particular java/javax APIs--
  Listener
 className=org.apache.catalina.core.JreMemoryLeakPreventionListener /
  !-- JMX Support for the Tomcat server.
 Documentation at /docs/non-existent.html --
  Listener className=org.apache.catalina.mbeans.ServerLifecycleListener /
  Listener 
className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener /

  !-- Global JNDI resources
   Documentation at /docs/jndi-resources-howto.html
  --
  GlobalNamingResources
    !-- Editable user database that can also be used by
 UserDatabaseRealm to authenticate users
    --
    Resource name=UserDatabase auth=Container
  type=org.apache.catalina.UserDatabase
  description=User database that can be updated and
 saved
  factory=org.apache.catalina.users.MemoryUserDatabaseFactory
  pathname=conf/tomcat-users.xml /
  /GlobalNamingResources

  !-- A Service is a collection of one or more Connectors that share
   a single Container Note:  A Service is not itself a Container, 
   so you may not define subcomponents such as Valves at this level.
   Documentation at /docs/config/service.html
   --
  Service name=Catalina
  
    !--The connectors can use a shared executor, you can define one or more 
named thread pools--
    !--
   
 Executor name=tomcatThreadPool namePrefix=catalina-exec- 
    maxThreads=150 minSpareThreads=4/
    --
    
    
    !-- A Connector represents an endpoint by which requests are received
 and responses are returned. Documentation at :
 Java HTTP Connector: /docs/config/http.html (blocking  non-blocking)
 Java AJP  Connector: /docs/config/ajp.html
 APR (HTTP/AJP) Connector: /docs/apr.html
 Define a non-SSL HTTP/1.1 Connector on port 8080
    --
    Connector port=8080 maxThreads=0 acceptCount=1
 protocol=HTTP/1.1 
   connectionTimeout=2 
   redirectPort=8443 /

    !-- Define an AJP 1.3 Connector on port 8009 --
    Connector port=8009 protocol=AJP/1.3 redirectPort=8443 /


    !-- An Engine represents the entry point (within Catalina) that processes
 every request.  The Engine implementation for Tomcat stand alone
 analyzes the HTTP headers included with the request, and passes them
 on to the appropriate Host (virtual host).
 Documentation at /docs/config/engine.html
 --

    !-- You should set jvmRoute to support load-balancing via AJP ie :
    Engine name=Catalina defaultHost=localhost jvmRoute=jvm1 
    -- 
    Engine name=Catalina defaultHost=localhost


  !-- This Realm uses the UserDatabase configured in the global JNDI
   resources under the key UserDatabase.  Any edits
   that are performed against this UserDatabase are immediately
   available for use by the Realm.  --
  Realm
 className=org.apache.catalina.realm.UserDatabaseRealm
 resourceName=UserDatabase/

  !-- Define the default virtual host
   Note: XML Schema validation will not work with Xerces 2.2.
   --
  Host name=localhost  appBase=webapps
    unpackWARs=true autoDeploy=true
    xmlValidation=false xmlNamespaceAware=false


  /Host
    /Engine
  /Service
/Server





 From: André Warnier a...@ice-sa.com
To: Tomcat Users List users@tomcat.apache.org 
Sent: Thursday, January 24, 2013 11:53 AM
Subject: Re: Fw: Can not understand how maxThreads of Connectors works
 
Hermes Flying wrote:
 Hi,
 So is there an explanation for this? All I am interested is make sure that 
 after a limit, clients attempted to connect are stopped based on my

Re: Fw: Can not understand how maxThreads of Connectors works

2013-01-24 Thread André Warnier

  !-- A Service is a collection of one or more Connectors that share
   a single Container Note:  A Service is not itself a Container, 
   so you may not define subcomponents such as Valves at this level.

   Documentation at /docs/config/service.html
   --
  Service name=Catalina
  
!--The connectors can use a shared executor, you can define one or more named thread pools--

!--
   
 Executor name=tomcatThreadPool namePrefix=catalina-exec- 
maxThreads=150 minSpareThreads=4/

--


!-- A Connector represents an endpoint by which requests are received

 and responses are returned. Documentation at :
 Java HTTP Connector: /docs/config/http.html (blocking  non-blocking)
 Java AJP  Connector: /docs/config/ajp.html
 APR (HTTP/AJP) Connector: /docs/apr.html
 Define a non-SSL HTTP/1.1 Connector on port 8080
--
Connector port=8080 maxThreads=0 acceptCount=1
 protocol=HTTP/1.1 
   connectionTimeout=2 
   redirectPort=8443 /


!-- Define an AJP 1.3 Connector on port 8009 --
Connector port=8009 protocol=AJP/1.3 redirectPort=8443 /


!-- An Engine represents the entry point (within Catalina) that processes
 every request.  The Engine implementation for Tomcat stand alone
 analyzes the HTTP headers included with the request, and passes them
 on to the appropriate Host (virtual host).
 Documentation at /docs/config/engine.html
 --

!-- You should set jvmRoute to support load-balancing via AJP ie :
Engine name=Catalina defaultHost=localhost jvmRoute=jvm1 
-- 
Engine name=Catalina defaultHost=localhost



  !-- This Realm uses the UserDatabase configured in the global JNDI
   resources under the key UserDatabase.  Any edits
   that are performed against this UserDatabase are immediately
   available for use by the Realm.  --
  Realm
 className=org.apache.catalina.realm.UserDatabaseRealm
 resourceName=UserDatabase/

  !-- Define the default virtual host
   Note: XML Schema validation will not work with Xerces 2.2.
   --
  Host name=localhost  appBase=webapps
unpackWARs=true autoDeploy=true
xmlValidation=false xmlNamespaceAware=false


  /Host
/Engine
  /Service
/Server





 From: André Warnier a...@ice-sa.com
To: Tomcat Users List users@tomcat.apache.org 
Sent: Thursday, January 24, 2013 11:53 AM

Subject: Re: Fw: Can not understand how maxThreads of Connectors works
 
Hermes Flying wrote:

Hi,
So is there an explanation for this? All I am interested is make sure that 
after a limit, clients attempted to connect are stopped based on my 
configuration on maxThreads and accept count.
But I can not figure out how this works.



(This all being explained in vernacular language to which experts may object).

Threads in Tomcat serve to process requests.  Each Thread can process one 
request.
0 Threads = 0 requests being processed.
n Threads = n requests can be processed simultaneously (kind of).

Threads belong to either a Connector (by default), or an Executor (if you 
configure several Connectors to use an Executor, then they use the common pool of Threads 
of the Executor, instead of their own individual pool of Threads).

Having a common pool of Threads between several Connectors is normally more 
efficient and allows for a smoother operation.  Otherwise you could have the 
case that requests arriving through one Connector (e.g. HTTP) are being starved 
because this particular Connector has no more Threads available, while on the 
other hand another Connector (e.g. AJP) still has plenty of capacity.

The acceptCount is another matter entirely, working at a deeper level.
Before a Thread is assigned to process a request,
- the client requests a TCP connection to the server
- the server must accept this connection. If it doesn't within a certain 
time, the client will get an error (connect timeout).
- when the server accepts the connection, it goes into a queue. The length of 
that queue corresponds to the acceptCount of the corresponding Connector.
(If the accept queue is already full, the connection request will be rejected).
As long as the server does no further action, an accepted connection stays in 
the queue and the client request does not proceed. If that lasts a long time, 
the client may timeout (usually saying that the server is not responsive).
- whenever the server feels like it (for example, when it sees that it has at 
least one Thread free to handle a request), it will pop the first connection 
from the accept queue, and pass it to a Thread to be processed.
Now a Thread is assigned to process this request, so one less Thread is 
available in the pool of Threads.
- if another client connection happens now, it goes into the accept queue.
- whenever the original Thread is done processing the request

Re: Fw: Can not understand how maxThreads of Connectors works

2013-01-24 Thread Hermes Flying
Hi,

I am sure that this server.xml is the one used, since there is no other present.
Also as mentioned my plan is to cut network access after a threshold. I used 
such small values e.g. 0,1,2 to see what happens. 
Also note that I am not using SUN JVM but IBM. Not sure if this makes a 
difference





 From: André Warnier a...@ice-sa.com
To: Tomcat Users List users@tomcat.apache.org 
Sent: Thursday, January 24, 2013 7:14 PM
Subject: Re: Fw: Can not understand how maxThreads of Connectors works
 
Hermes Flying wrote:
 Hi,
 I don't see how this answers my issue.
 1) You say 0 threads means 0 requests being processed. This does not happen. 
 Requests are being processed. No error noticed

It is not only me saying it. The on-line documentation at 
https://tomcat.apache.org/tomcat-7.0-doc/config/http.html
says this :
quote

maxThreads    

The maximum number of request processing threads to be created by this 
Connector, which therefore determines the maximum number of simultaneous 
requests that can be handled. If not specified, this attribute is set to 200. 
If an executor is associated with this connector, this attribute is ignored as 
the connector will execute tasks using the executor rather than an internal 
thread pool.

unquote

Now, considering this, there are a number of possibilities :
- the documentation is totally wrong
- there is a bug in Tomcat
- your Tomcat server is not using this server.xml
- or, it being rather unlikely that processing 0 requests is what a normal user 
would want, the Tomcat developers have coded this so that an obviously 
nonsensical value of 0 would result in the default (of 200) being applied.

Pick any one of the above.

 2)You say: you are setting your parameters in the wrong place. This is not 
 the case here.I already send an example server.xml. Will copy/paste it again 
 bellow

Yes, but we cannot check from here if this is really the server.xml that your 
Tomcat is reading. Are you absolutely sure it is ? How ?

 3)It does not seem to make a lot of sense to set up a whole machinery like a 
 host, a JVM and a Tomcat, just to process one single request at a time. I am 
 not planning to do that, but I must see how the system behaves in various 
 configuration. Tomcat does not seem to behave as expected in the trivial case.

The trivial case is 0 Threads ? What happens when you set it to 1 ?

 4) The default Tomcat settings are chosen by people who know what they are 
 doing, to obtain a reasonable Tomcat behaviour over a reasonable range of 
 conditions What does this actually mean? That we are not supposed to 
 configure Tomcat according to our needs?
 

Of course you can. But if you are using nonsensical values, do you expect a 
sensible behaviour ?
Come on, man. This is open-source software, that you get to use for free.
This is not to say that it is not good software, nor that the developers do not 
try to make it as efficient and reliable as possible, nor that the people 
writing the documentation (also for free) do not make every effort to write it 
well and accurately.
On the other hand, it is kind of expected that people using Tomcat and 
configuring it, would use a bit of judgment and give the developers a bit of 
slack.

I am not a developer of Tomcat, but what I tried to provide in my explanation 
is a guideline as to how these parameters are supposed to work. That was to 
help you maybe find the reason for what appears to you as not working, but 
which apparently other people cannot reproduce.

I just tried with Tomcat 6.0.24 under Windows, and when I set
maxThreads=0 in the HTTP Connector, Tomcat starts up without error in the 
log. But if I try to access it with a browser, the browser loops saying 
connecting.. and never goes past that point.  If I set maxThreads=1, then 
Tomcat is answering with the homepage.

Same thing with Tomcat 7.0.21.

So I would say : check that the server.xml below is really the one that Tomcat 
is using.

(Additionally, I would say that it seems that when Tomcat is configured to not 
have any Threads to process requests, well it just does not process any.  Which 
seems to me like sensible behaviour under adverse circumstances.)



 
 ?xml version='1.0' encoding='utf-8'?
 Server port=8005 shutdown=SHUTDOWN
 
   !--APR library loader. Documentation at /docs/apr.html --
   Listener className=org.apache.catalina.core.AprLifecycleListener 
SSLEngine=on /
   !--Initialize Jasper prior to webapps are loaded. Documentation at 
/docs/jasper-howto.html --
   Listener className=org.apache.catalina.core.JasperListener /
   !-- Prevent memory leaks due to use of particular java/javax APIs--
   Listener
  className=org.apache.catalina.core.JreMemoryLeakPreventionListener /
   !-- JMX Support for the Tomcat server.
  Documentation at /docs/non-existent.html --
   Listener className=org.apache.catalina.mbeans.ServerLifecycleListener /
   Listener 
className

Re: Fw: Can not understand how maxThreads of Connectors works

2013-01-24 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

André,

On 1/24/13 12:14 PM, André Warnier wrote:
 Now, considering this, there are a number of possibilities : - the
 documentation is totally wrong - there is a bug in Tomcat - your
 Tomcat server is not using this server.xml - or, it being rather
 unlikely that processing 0 requests is what a normal user would
 want, the Tomcat developers have coded this so that an obviously
 nonsensical value of 0 would result in the default (of 200) being
 applied.

That last one is not true: the code will happily accept maxThreads=0
but then will throw an exception when the connector tries to actually
start its Executor.

I suspect Hermes is editing some unrelated server.xml file: his
observations seem totally in-line with that hypothesis.

Hermes, try modifying your server.xml file to be syntactically
incorrect. For example, put a !-- into the middle of the file and
try to start Tomcat. If it still starts, you are editing the wrong file.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEBhv8ACgkQ9CaO5/Lv0PDUWgCfWY/BUyhl4rQkZUC19SNB2P72
sckAn2dZwfEd7uVZz6eg0HuPmuZC81j6
=YVBj
-END PGP SIGNATURE-

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



Re: Fw: Can not understand how maxThreads of Connectors works

2013-01-23 Thread Hermes Flying
Hi,
So is there an explanation for this? All I am interested is make sure that 
after a limit, clients attempted to connect are stopped based on my 
configuration on maxThreads and accept count.
But I can not figure out how this works.







 From: Hermes Flying flyingher...@yahoo.com
To: Tomcat Users List users@tomcat.apache.org 
Sent: Monday, January 21, 2013 6:17 PM
Subject: Re: Fw: Can not understand how maxThreads of Connectors works
 
The web application works.I can not see any issue. What does this mean?




From: Mark Thomas ma...@apache.org
To: Tomcat Users List users@tomcat.apache.org 
Sent: Monday, January 21, 2013 11:06 AM
Subject: Re: Fw: Can not understand how maxThreads of Connectors works

On 21/01/2013 07:07, Hermes Flying wrote:
 
 Hi,
 Is there any update on this? I don't see any problem setting maxThreads=0

And if you try making a request with a Tomcat instance that uses that
configuration?

Mark


 
 Thank you
 
 
 - Forwarded Message -
 From: Hermes Flying flyingher...@yahoo.com
 To: Tomcat Users List users@tomcat.apache.org 
 Sent: Friday, January 18, 2013 8:55 AM
 Subject: Re: Can not understand how maxThreads of Connectors works
  
 
 Hi Chris,
 Tried with this simple server.xml and maxThreads=0 but I did not see any kind 
 of errors.Attached the catalina logs
 
 ?xml version='1.0' encoding='utf-8'?
 Server port=8005 shutdown=SHUTDOWN
 
   !--APR library loader. Documentation at /docs/apr.html --
   Listener className=org.apache.catalina.core.AprLifecycleListener 
SSLEngine=on /
   !--Initialize Jasper prior to webapps are loaded. Documentation at 
/docs/jasper-howto.html --
   Listener className=org.apache.catalina.core.JasperListener /
   !-- Prevent memory leaks due to use of particular java/javax APIs--
   Listener 
className=org.apache.catalina.core.JreMemoryLeakPreventionListener /
   !-- JMX Support for the Tomcat server.
  Documentation at /docs/non-existent.html --
   Listener className=org.apache.catalina.mbeans.ServerLifecycleListener /
   Listener 
className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener /
 
   !-- Global JNDI resources
        Documentation at /docs/jndi-resources-howto.html
   --
   GlobalNamingResources
     !-- Editable user database that can also be used by
          UserDatabaseRealm to authenticate users
     --
     Resource name=UserDatabase auth=Container
               type=org.apache.catalina.UserDatabase
               description=User database that can be updated and
  saved
               factory=org.apache.catalina.users.MemoryUserDatabaseFactory
               pathname=conf/tomcat-users.xml /
   /GlobalNamingResources
 
   !-- A Service is a collection of one or more Connectors that share
        a single Container Note:  A Service is not itself a Container, 
        so you may not define subcomponents such as Valves at this level.
        Documentation at /docs/config/service.html
    --
   Service name=Catalina
  
     !--The connectors can use a shared executor, you can define one or more 
named thread pools--
     !--
    
  Executor name=tomcatThreadPool namePrefix=catalina-exec- 
         maxThreads=150 minSpareThreads=4/
     --
    
    
     !-- A Connector represents an endpoint by which requests are received
          and responses are returned. Documentation at :
          Java HTTP Connector: /docs/config/http.html (blocking  non-blocking)
          Java AJP  Connector: /docs/config/ajp.html
          APR (HTTP/AJP) Connector: /docs/apr.html
          Define a non-SSL HTTP/1.1 Connector on port 8080
     --
     Connector port=8080 maxThreads=0 acceptCount=1
  protocol=HTTP/1.1 
                connectionTimeout=2 
                redirectPort=8443 /
 
     !-- Define an AJP 1.3 Connector on port 8009 --
     Connector port=8009 protocol=AJP/1.3 redirectPort=8443 /
 
 
     !-- An Engine represents the entry point (within Catalina) that processes
          every request.  The Engine implementation for Tomcat stand alone
          analyzes the HTTP headers included with the request, and passes them
          on to the appropriate Host (virtual host).
          Documentation at /docs/config/engine.html
  --
 
     !-- You should set jvmRoute to support load-balancing via AJP ie :
     Engine name=Catalina defaultHost=localhost jvmRoute=jvm1        
     -- 
     Engine name=Catalina defaultHost=localhost
 
 
       !-- This Realm uses the UserDatabase configured in the global JNDI
            resources under the key UserDatabase.  Any edits
            that are performed against this UserDatabase are immediately
            available for use by the Realm.  --
       Realm
  className=org.apache.catalina.realm.UserDatabaseRealm
              resourceName=UserDatabase/
 
       !-- Define the default virtual host
            Note: XML Schema validation will not work with Xerces 2.2.
        --
       Host name=localhost  appBase=webapps

Re: Fw: Can not understand how maxThreads of Connectors works

2013-01-23 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Hermes,

On 1/23/13 5:25 PM, Hermes Flying wrote:
 So is there an explanation for this? All I am interested is make
 sure that after a limit, clients attempted to connect are stopped
 based on my configuration on maxThreads and accept count. But I can
 not figure out how this works.

Sorry, but your description of what you experience does not match the
experiences of others. The conclusion is that you are not configuring
Tomcat the way you claim to be configuring it.

You never told us what versions of things you were using. You never
told us what OS you are on. You never told us how you are launching
Tomcat. You never told us where your configuration files are.

I cannot help you any further without the above information. I believe
that others can also not help you without this information.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEAjhwACgkQ9CaO5/Lv0PCSNQCgjrNeg1OWsZvWRWVfqOCEWRmP
LBsAn26IFVIG/5zXXofpNPnxEQXrFWD/
=XZvE
-END PGP SIGNATURE-

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



Re: Fw: Can not understand how maxThreads of Connectors works

2013-01-22 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Hermes,

On 1/21/13 11:17 AM, Hermes Flying wrote:
 The web application works.I can not see any issue. What does this
 mean?

My guess is that Tomcat isn't using the configuration file you are
modifying.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlD+p6sACgkQ9CaO5/Lv0PDy/gCfSagY1K29u8OpugO4plJ84s/y
7nsAn1IQSsFeH7F0mnaEnRMATmNkoKLD
=Ioar
-END PGP SIGNATURE-

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



Re: Fw: Can not understand how maxThreads of Connectors works

2013-01-21 Thread Mark Thomas
On 21/01/2013 07:07, Hermes Flying wrote:
 
 Hi,
 Is there any update on this? I don't see any problem setting maxThreads=0

And if you try making a request with a Tomcat instance that uses that
configuration?

Mark


 
 Thank you
 
 
 - Forwarded Message -
 From: Hermes Flying flyingher...@yahoo.com
 To: Tomcat Users List users@tomcat.apache.org 
 Sent: Friday, January 18, 2013 8:55 AM
 Subject: Re: Can not understand how maxThreads of Connectors works
  
 
 Hi Chris,
 Tried with this simple server.xml and maxThreads=0 but I did not see any kind 
 of errors.Attached the catalina logs
 
 ?xml version='1.0' encoding='utf-8'?
 Server port=8005 shutdown=SHUTDOWN
 
   !--APR library loader. Documentation at /docs/apr.html --
   Listener className=org.apache.catalina.core.AprLifecycleListener 
 SSLEngine=on /
   !--Initialize Jasper prior to webapps are loaded. Documentation at 
 /docs/jasper-howto.html --
   Listener className=org.apache.catalina.core.JasperListener /
   !-- Prevent memory leaks due to use of particular java/javax APIs--
   Listener 
 className=org.apache.catalina.core.JreMemoryLeakPreventionListener /
   !-- JMX Support for the Tomcat server.
  Documentation at /docs/non-existent.html --
   Listener className=org.apache.catalina.mbeans.ServerLifecycleListener /
   Listener 
 className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener /
 
   !-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
   --
   GlobalNamingResources
 !-- Editable user database that can also be used by
  UserDatabaseRealm to authenticate users
 --
 Resource name=UserDatabase auth=Container
   type=org.apache.catalina.UserDatabase
   description=User database that can be updated and
  saved
   factory=org.apache.catalina.users.MemoryUserDatabaseFactory
   pathname=conf/tomcat-users.xml /
   /GlobalNamingResources
 
   !-- A Service is a collection of one or more Connectors that share
a single Container Note:  A Service is not itself a Container, 
so you may not define subcomponents such as Valves at this level.
Documentation at /docs/config/service.html
--
   Service name=Catalina
   
 !--The connectors can use a shared executor, you can define one or more 
 named thread pools--
 !--

  Executor name=tomcatThreadPool namePrefix=catalina-exec- 
 maxThreads=150 minSpareThreads=4/
 --
 
 
 !-- A Connector represents an endpoint by which requests are received
  and responses are returned. Documentation at :
  Java HTTP Connector: /docs/config/http.html (blocking  non-blocking)
  Java AJP  Connector: /docs/config/ajp.html
  APR (HTTP/AJP) Connector: /docs/apr.html
  Define a non-SSL HTTP/1.1 Connector on port 8080
 --
 Connector port=8080 maxThreads=0 acceptCount=1
  protocol=HTTP/1.1 
connectionTimeout=2 
redirectPort=8443 /
 
 !-- Define an AJP 1.3 Connector on port 8009 --
 Connector port=8009 protocol=AJP/1.3 redirectPort=8443 /
 
 
 !-- An Engine represents the entry point (within Catalina) that processes
  every request.  The Engine implementation for Tomcat stand alone
  analyzes the HTTP headers included with the request, and passes them
  on to the appropriate Host (virtual host).
  Documentation at /docs/config/engine.html
  --
 
 !-- You should set jvmRoute to support load-balancing via AJP ie :
 Engine name=Catalina defaultHost=localhost jvmRoute=jvm1 
 -- 
 Engine name=Catalina defaultHost=localhost
 
 
   !-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key UserDatabase.  Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm.  --
   Realm
  className=org.apache.catalina.realm.UserDatabaseRealm
  resourceName=UserDatabase/
 
   !-- Define the default virtual host
Note: XML Schema validation will not work with Xerces 2.2.
--
   Host name=localhost  appBase=webapps
 unpackWARs=true autoDeploy=true
 xmlValidation=false xmlNamespaceAware=false
 
 
   /Host
 /Engine
   /Service
 /Server
 
 
 
 
 
 
 
 
  From: Christopher Schultz ch...@christopherschultz.net
 To: Tomcat Users List users@tomcat.apache.org 
 Sent: Thursday, January 17, 2013 6:57 PM
 Subject: Re: Can not understand how maxThreads of Connectors works
  
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256
 
 André,
 
 On 1/17/13 3:32 AM, André Warnier wrote:
 Quite a few messages ago, I asked the OP if he could copy/paste
 his server.xml.
 
 Yes. Getting information from the OP seems to be difficult.
 
 The reason was that if his config uses an Executor, then I believe
 the Threads settings in the 

Re: Fw: Can not understand how maxThreads of Connectors works

2013-01-21 Thread Hermes Flying
The web application works.I can not see any issue. What does this mean?




 From: Mark Thomas ma...@apache.org
To: Tomcat Users List users@tomcat.apache.org 
Sent: Monday, January 21, 2013 11:06 AM
Subject: Re: Fw: Can not understand how maxThreads of Connectors works
 
On 21/01/2013 07:07, Hermes Flying wrote:
 
 Hi,
 Is there any update on this? I don't see any problem setting maxThreads=0

And if you try making a request with a Tomcat instance that uses that
configuration?

Mark


 
 Thank you
 
 
 - Forwarded Message -
 From: Hermes Flying flyingher...@yahoo.com
 To: Tomcat Users List users@tomcat.apache.org 
 Sent: Friday, January 18, 2013 8:55 AM
 Subject: Re: Can not understand how maxThreads of Connectors works
  
 
 Hi Chris,
 Tried with this simple server.xml and maxThreads=0 but I did not see any kind 
 of errors.Attached the catalina logs
 
 ?xml version='1.0' encoding='utf-8'?
 Server port=8005 shutdown=SHUTDOWN
 
   !--APR library loader. Documentation at /docs/apr.html --
   Listener className=org.apache.catalina.core.AprLifecycleListener 
SSLEngine=on /
   !--Initialize Jasper prior to webapps are loaded. Documentation at 
/docs/jasper-howto.html --
   Listener className=org.apache.catalina.core.JasperListener /
   !-- Prevent memory leaks due to use of particular java/javax APIs--
   Listener 
className=org.apache.catalina.core.JreMemoryLeakPreventionListener /
   !-- JMX Support for the Tomcat server.
  Documentation at /docs/non-existent.html --
   Listener className=org.apache.catalina.mbeans.ServerLifecycleListener /
   Listener 
className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener /
 
   !-- Global JNDI resources
        Documentation at /docs/jndi-resources-howto.html
   --
   GlobalNamingResources
     !-- Editable user database that can also be used by
          UserDatabaseRealm to authenticate users
     --
     Resource name=UserDatabase auth=Container
               type=org.apache.catalina.UserDatabase
               description=User database that can be updated and
  saved
               factory=org.apache.catalina.users.MemoryUserDatabaseFactory
               pathname=conf/tomcat-users.xml /
   /GlobalNamingResources
 
   !-- A Service is a collection of one or more Connectors that share
        a single Container Note:  A Service is not itself a Container, 
        so you may not define subcomponents such as Valves at this level.
        Documentation at /docs/config/service.html
    --
   Service name=Catalina
  
     !--The connectors can use a shared executor, you can define one or more 
named thread pools--
     !--
    
  Executor name=tomcatThreadPool namePrefix=catalina-exec- 
         maxThreads=150 minSpareThreads=4/
     --
    
    
     !-- A Connector represents an endpoint by which requests are received
          and responses are returned. Documentation at :
          Java HTTP Connector: /docs/config/http.html (blocking  non-blocking)
          Java AJP  Connector: /docs/config/ajp.html
          APR (HTTP/AJP) Connector: /docs/apr.html
          Define a non-SSL HTTP/1.1 Connector on port 8080
     --
     Connector port=8080 maxThreads=0 acceptCount=1
  protocol=HTTP/1.1 
                connectionTimeout=2 
                redirectPort=8443 /
 
     !-- Define an AJP 1.3 Connector on port 8009 --
     Connector port=8009 protocol=AJP/1.3 redirectPort=8443 /
 
 
     !-- An Engine represents the entry point (within Catalina) that processes
          every request.  The Engine implementation for Tomcat stand alone
          analyzes the HTTP headers included with the request, and passes them
          on to the appropriate Host (virtual host).
          Documentation at /docs/config/engine.html
  --
 
     !-- You should set jvmRoute to support load-balancing via AJP ie :
     Engine name=Catalina defaultHost=localhost jvmRoute=jvm1        
     -- 
     Engine name=Catalina defaultHost=localhost
 
 
       !-- This Realm uses the UserDatabase configured in the global JNDI
            resources under the key UserDatabase.  Any edits
            that are performed against this UserDatabase are immediately
            available for use by the Realm.  --
       Realm
  className=org.apache.catalina.realm.UserDatabaseRealm
              resourceName=UserDatabase/
 
       !-- Define the default virtual host
            Note: XML Schema validation will not work with Xerces 2.2.
        --
       Host name=localhost  appBase=webapps
             unpackWARs=true autoDeploy=true
             xmlValidation=false xmlNamespaceAware=false
 
 
       /Host
     /Engine
   /Service
 /Server
 
 
 
 
 
 
 
 
  From: Christopher Schultz ch...@christopherschultz.net
 To: Tomcat Users List users@tomcat.apache.org 
 Sent: Thursday, January 17, 2013 6:57 PM
 Subject: Re: Can not understand how maxThreads of Connectors works
  
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256