apache mod_jk timeout

有个页面渲染时间太长结果就被转到错误页面去了,故查了apache的timetou 以及mod_jk的timeout,收集了一些资料记录下:

 

1:apache  httpd.conf  Timeout

http://httpd.apache.org/docs/2.0/mod/core.html

 

 

TimeOut Directive

Description: Syntax: Default: Context: Status: Module:
Amount of time the server will wait for certain events before failing a request
TimeOut seconds
TimeOut 300
server config, virtual host
Core
core

The TimeOut directive currently defines the amount of time Apache will wait for three things:

  1. The total amount of time it takes to receive a GET request.
  2. The amount of time between receipt of TCP packets on a POST or PUT request.
  3. The amount of time between ACKs on transmissions of TCP packets in responses.

We plan on making these separately configurable at some point down the road. The timer used to default to 1200 before 1.2, but has been lowered to 300 which is still far more than necessary in most situations. It is not set any lower by default because there may still be odd places in the code where the timer is not reset when a packet is sent.

 

2:mod_jk  timeout

http://tomcat.apache.org/connectors-doc/reference/workers.html

 

 

socket_timeout 0 Socket timeout in seconds used for the communication channel between JK and remote host. If the remote host does not respond inside the timeout specified, JK will generate an error, and retry again. If set to zero (default) JK will wait for an infinite amount of time on all socket operations.
socket_connect_timeout socket_timeout*1000 Socket connect timeout in milliseconds used for the communication channel between JK and remote host. If the remote host does not respond inside the timeout specified, JK will generate an error, and retry again.

Note that socket_timeout is in seconds, and socket_connect_timeout in milliseconds, so in absolute terms the default socket_connect_timeout is equal to "socket_timeout.

This feature has been added in jk 1.2.27

 

http://tomcat.apache.org/connectors-doc/generic_howto/timeouts.html

 

Low-Level TCP Timeouts

Some platforms allow to set timeouts for all operations on TCP sockets. This is available for Linux and Windows, other platforms do not support this, e.g. Solaris. If your platform supports TCP send and receive timeouts, you can set them using the worker attribute socket_timeout. You can not set the two timeouts to different values.


JK will accept this attribute even if your platform does not support socket timeouts. In this case setting the attribute will have no effect. By default the value is "0" and the timeout is disabled. You can set the attribute to some seconds value (not: milliseconds). JK will then set the send and the receive timeouts of the backend connections to this value. The timeout is low-level, it is used for each read and write operation on the socket individually.


Using this attribute will make JK react faster to some types of network problems. Unfortunately socket timeouts have negative side effects, because for most platforms, there is no good way to recover from such a timeout, once it fired. For JK there is no way to decide, if this timeout fired because of real network problems, or only because it didn't receive an answer packet from a backend in time. So remember: don't use extremely small values.


For the general case of connection establishment you can use socket_connect_timeout. It takes a millisecond value and works on most platforms, even if socket_timeout is not supported. We recommend using socket_connect_timeout because in some network failure situations failure detection during connection establishment can take several minutes due to TCP retransmits. Depending on the quality of your network a timeout somewhere between 1000 and 5000 milliseconds should be fine. Note that socket_timeout is in seconds, and socket_connect_timeout in milliseconds. 

你可能感兴趣的:(timeout)