tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <rainer.j...@kippdata.de>
Subject Re: So many timeout values
Date Wed, 28 Oct 2009 17:55:44 GMT
On 28.10.2009 17:29, Mohit Anchlia wrote:
> Based on what I have seen is that we often get HTTP code 502 and by
> increasing socket timeout those errors disappear. I am not sure why
> that happens.
> 
> Based on the feedback I got it looks like the below properties file is
> ok except the socket timeout piece and I should probably remove that?

Yes. See below.

> Here is workers.properties file:
> ##
> worker.list=status,tc
> 
> ## Worker Configuration##
> 
> # All entries in this section take the form:
> #       worker.<workername>.<directive>=<value>
> # Worker names are defined in the worker.list directive above.
> 
> 
> # Configuration specifying the worker named "status" as a status worker.
> # This worker can be used to administer the other configured workers.
> worker.status.type=status
> 
> 
> # Configuration for the default load balancer worker.
> # Uncomment the configuration for the "tc"
> # worker, and the two "node" workers below to enable.
> # Also add "lb" to the workers.list directive
> # above.  The default  for the load balancer worker is
> # round-robin distribution of requests over
> # all active nodes.  There are currently two nodes set
> # up for the load balanced worker, add more
> # to this list if required.  Sticky sessions is defaulted to true.
> worker.tc.type=lb
> worker.tc.balance_workers=appfe1,appfe2,appfe3,appfe4
> 
> worker.tc.sticky_session=true

That's default, but setting it does not harm.

> # Two load balanced workers, called node1 and node2.
> # Copy the configurations and add to the
> #       worker.tc.balanced_workers
> # list above to add more nodes to the Tomcat cluster.

Think about using a template, which makes config management easier:

# template
worker.template.type=ajp13
worker.template.port=8009
worker.template.socket_timeout=5
worker.template.socket_keepalive=true
worker.template.prepost_timeout=5
worker.template.connect_timeout=5000
worker.template.retries=3
worker.template.recycle_timeout=900

then

worker.appfe1.reference=worker.template
worker.appfe1.host=appfe1

worker.appfe2.reference=worker.template
worker.appfe2.host=appfe2

...

Concerning the following config: prepost timeout is in milliseconds. 5
is way to short.

> # appfe1
> worker.appfe1.type=ajp13
> worker.appfe1.port=8009
> worker.appfe1.host=appfe1
> worker.appfe1.socket_timeout=5
> worker.appfe1.socket_keepalive=true
> worker.appfe1.prepost_timeout=5
> worker.appfe1.connect_timeout=5000
> worker.appfe1.retries=3
> worker.appfe1.recycle_timeout=900
> 
> # Refererence BHP Apache tuning guide before uncomment the following
> line. The unit of reply_timeout is millisecond.
> #worker.appfe1.reply_timeout=0
> 
> # appfe2
> worker.appfe2.type=ajp13
> worker.appfe2.port=8009
> worker.appfe2.host=appfe2
> worker.appfe2.socket_timeout=5
> worker.appfe2.socket_keepalive=true
> worker.appfe2.prepost_timeout=5
> worker.appfe2.connect_timeout=5000
> worker.appfe2.retries=3
> worker.appfe2.recycle_timeout=900
> 
> # Refererence BHP Apache tuning guide before uncomment the following
> line. The unit of reply_timeout is millisecond.
> #worker.appfe2.reply_timeout=0
> 
> # appfe3
> worker.appfe3.type=ajp13
> worker.appfe3.port=8009
> worker.appfe3.host=appfe3
> worker.appfe3.socket_timeout=5
> worker.appfe3.socket_keepalive=true
> worker.appfe3.prepost_timeout=5
> worker.appfe3.connect_timeout=5000
> worker.appfe3.retries=3
> worker.appfe3.recycle_timeout=900
> 
> # Refererence BHP Apache tuning guide before uncomment the following
> line. The unit of reply_timeout is millisecond.
> #worker.appfe3.reply_timeout=0
> 
> # appfe4
> worker.appfe4.type=ajp13
> worker.appfe4.port=8009
> worker.appfe4.host=appfe4
> worker.appfe4.socket_timeout=5
> worker.appfe4.socket_keepalive=true
> worker.appfe4.prepost_timeout=5
> worker.appfe4.connect_timeout=5000
> worker.appfe4.retries=3
> worker.appfe4.recycle_timeout=900

Now w.r.t. the params, I would slightly change (assuming version 1.2.28):

# template
worker.template.type=ajp13
worker.template.port=8009
# Only use it if you find a good reason for it :)
# worker.template.socket_timeout=5
worker.template.socket_connect_timeout=10000
worker.template.socket_keepalive=true
worker.template.ping_mode=A
worker.template.ping_timeout=10000
worker.template.connection_pool_minsize=0
worker.template.connection_pool_timeout=900
worker.template.retries=3
worker.template.recovery_options=7

# Refererence BHP Apache tuning guide before uncomment the
# following line. The unit of reply_timeout is millisecond.
# Then also set worker.lb.max_reply_timeouts=10
#worker.template.reply_timeout=60000

I would also recommend

worker.lb.error_escalation_time=0

but opinions about this vary.

Note that you need to check, whether your Java Memory and Garbage
Collection configuration is fine. Otherwise in case of using large
memory the backend might experience long GC pauses triggering some of
the above timeouts.

Note that connection_pool_timeout (the same as recycle_timeout but not
deprecated) should be set to the same time interval than connectTimeout
in Connector of server.xml. But in server.xml you must use milliseconds,
in workers.properties the attribute is in seconds.

Regards,

Rainer

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


Mime
View raw message