`

apache mod_jk timeout

    博客分类:
  • JAVA
 
阅读更多

有个页面渲染时间太长结果就被转到错误页面去了,故查了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. 

分享到:
评论

相关推荐

    Jboss6+mod_jk+apache2.2集群配置

    ### JBoss6 + mod_jk + Apache2.2 集群配置详解 #### 一、概述 在当今高并发、大数据的环境下,单一服务器往往难以满足业务需求,因此搭建服务器集群成为提升系统性能和可用性的有效手段之一。本文主要介绍如何...

    Jboss6+mod_jk+apache2.2集群实现session的复制

    ### JBoss 6 + mod_jk + Apache 2.2 集群实现 Session 复制详解 #### 一、概述 随着互联网技术的发展与普及,越来越多的企业开始重视Web服务的高可用性和负载均衡能力。在这样的背景下,利用JBoss 6、mod_jk和...

    ubuntu linux下apache与tomcat的整合.txt

    这一步确保 Apache 在启动时加载了 mod_jk 模块,并且包含了 mod_jk 的具体配置信息。 #### 配置 Tomcat server.xml 还需要对 Tomcat 的 `server.xml` 文件进行相应配置,以便使其能够正确地接收来自 Apache 的...

    负载均衡方案及详细配置.pdf

    在本文中,我们将介绍如何使用 Apache、Tomcat 和 mod_jk 实现负载均衡方案。 一、概述 负载均衡的原理是将来自客户端的请求分配到多台服务器上,以提高系统的可用性和性能。当一台服务器down机后,系统可以自动...

    Apache2.2+tomcat6.0配置[归类].pdf

    然后,安装Apache服务器,并将JK模块的.so文件重命名为mod_jk.so,将其复制到Apache的modules目录。 接下来,配置Apache的httpd.conf文件。在该文件末尾添加如下内容,以启用JK模块并包含JK模块的配置文件: ```...

    Glassfish V2与Apache的整合

    别忘了将mod_jk模块的动态链接库文件`mod_jk-1.2.26-httpd-2.2.4.so`复制到Apache的`modules`目录,并将`tomcat-ajp.jar`,`commons-modeler.jar`,`commons-logging.jar`三个依赖库文件复制到Glassfish的`lib`目录...

    Apache和Tomcat实现集群和负载均衡(WindowsNT)

    <session-timeout>30</session-timeout> <domain>.yourdomain.com</domain> <path>/ ``` **五、配置Apache虚拟主机和负载均衡** 在Apache的httpd.conf文件中,配置虚拟主机和负载均衡策略。 ```...

    Tomcat +Apache实现负载均衡

    - `connection_pool_timeout`、`socket_timeout`、`connect_timeout`和`reply_timeout`等参数控制连接超时和性能。 5. **单机环境下的负载均衡**: - 在同一台设备上配置多实例Tomcat和Apache,可以实现本地测试...

    apache和tomcat整合.pdf

    - **复制mod_jk.so模块**:`cp mod_jk.so /usr/local/apache2/modules` ##### 4. 配置Apache以使用mod_jk - **加载mod_jk模块**:编辑`httpd.conf`文件,添加`LoadModule jk_module modules/mod_jk.so` - **创建JSP...

    Apache与Tomcat整合的简单方法.pdf

    5. 将编译好的mod_jk.so复制到Apache的modules目录:`# cp ./apache-2.0/mod_jk.so /usr/local/apache2/modules/` #### 六、配置Apache与Tomcat ##### 6.1 配置mod_jk 在`/usr/local/apache2/conf/`目录下创建两个...

    Apache+Tomcat+MySQL 环境搭建

    Timeout 300 KeepAlive On MaxKeepAliveRequests 0 KeepAliveTimeout 15 MaxRequestsPerChild 0 ThreadsPerChild 50 ``` 2. **配置 JDK 环境变量** - 设置`JAVA_HOME`、`CLASSPATH`和`PATH`。 ```ini ...

    Apache+Tomcat服务器集群配置详细步骤

    org.apache.catalina.HA.session.timeout=30 ``` **步骤4:启动服务** - 启动Apache服务。 - 分别启动两个Tomcat实例。 - 访问部署在Tomcat上的应用,验证负载均衡效果。 #### 四、总结 通过上述步骤,我们成功...

    JBoss集群配置的Session复制

    <TCPPING timeout="3000" initial_hosts="${192.168.1.104[7810],192.168.1.106[7810]}" port_range="1" num_initial_members="3"/> ``` 这里的配置指定了集群中节点的初始地址列表、通信端口以及超时时间等参数,...

    APACHE 2.2.4与TOMCAT6.0.14整合教程

    - 其他参数如`lbfactor`、`cachesize`、`cache_timeout`等,用于优化负载均衡性能,如调整权重、缓存大小和超时时间。 #### Tomcat配置同步 在完成Apache的配置后,还需确保Tomcat的配置与之匹配,尤其是Connector...

    MySQL Tomcat Apache优化

    - **配置mod_proxy**:与mod_jk类似,mod_proxy也允许Apache将请求转发给Tomcat。配置过程包括定义代理规则、设置代理缓存策略等。 #### 5. Apache的访问用法规则 为了保护服务器的安全并确保资源的有效利用,需要...

    Apache与tomcat配置

    Apache通常通过mod_jk、mod_proxy_ajp或其他模块与Tomcat通信,实现负载均衡和请求转发。 正确配置Apache和Tomcat的协同工作,能够充分利用两者的优势,提供高效、稳定且安全的Web服务环境。在实际操作中,应根据...

    nginx和tomcat配置SSL和负载均衡配置

    这种方式下,Apache 使用 mod_jk 或 mod_proxy 模块来分发请求到后端的多个 Tomcat 实例。这里以 mod_jk 为例,展示基本配置: 1. **Apache 配置**: - 在 Apache 的配置文件(通常是 `httpd.conf` 或 `apache2....

Global site tag (gtag.js) - Google Analytics