原创文章,转载请注明:来自有关tengine几个超时时间说明
负载均衡的客户和技术支持同学经常问: 7层 HTTP Keepalive 超时时间 是15秒 和http 60S 这个超时时间有什么区别? 下边列出来具体的含义
1. keepalive_timeout 15s;
长连接中连续两个http/https请求之间空闲的最大时间,超过此时间后没有收到新请求会关闭TCP长连接
The first parameter sets a timeout during which a keep-alive client connection will stay open on the server side. The zero value disables keep-alive client connections. The optional second parameter sets a value in the “Keep-Alive: timeout=time” response header field. Two parameters may differ.
The “Keep-Alive: timeout=time” header field is recognized by Mozilla and Konqueror. MSIE closes keep-alive connections by itself in about 60 seconds.
2. proxy_connect_timeout 5s;
等待一台后端ECS TCP三次握手完成过程的超时时间,超时后选择下一台ECS或关闭与client的连接
Defines a timeout for establishing a connection with a proxied server. It should be noted that this timeout cannot usually exceed 75 seconds.
3. proxy_read_timeout 60s;
等待一台ECS 回复http/https请求的响应时间
Defines a timeout for reading a response from the proxied server. The timeout is set only between two successive read operations, not for the transmission of the whole response. If the proxied server does not transmit anything within this time, the connection is closed.
4. client_body_timeout 60s
两次连续可读body数据时的超时时间间隔, 超时后返回408 Request Timeout请求超时。客户端没有在服务器预备等待的时间内完成一个请求的发送。
Defines a timeout for reading client request body. The timeout is set only for a period between two successive read operations, not for the transmission of the whole request body. If a client does not transmit anything within this time, the 408 (Request Time-out) error is returned to the client.
5. client_header_timeout 1m;
读客户端请求头超时间, 超时后返回408 Request Timeout请求超时。客户端没有在服务器预备等待的时间内完成一个请求的发送。
Defines a timeout for reading client request header. If a client does not transmit the entire header within this time, the 408 (Request Time-out) error is returned to the client.
6. send_timeout 1m;
两次连续向客户端可写body数据时的超时时间间隔,超时后直接完毕连接
Sets a timeout for transmitting a response to the client. The timeout is set only between two successive write operations, not for the transmission of the whole response. If the client does not receive anything within this time, the connection is closed.
7. ssl_handshake_timeout 60s;
完成https ssl握手过程超时时间
Specifies a timeout for the SSL handshake to complete.
8. ssl_session_timeout 5m;
同一客户端https参数重用缓存时间,可以提高ssl握手交互的效率
Specifies a time during which a client may reuse the session parameters.
9. proxy_send_timeout 60s
两次连续向后端ECS可写body数据时的超时时间间隔,超时后直接完毕连接
Sets a timeout for transmitting a request to the proxied server. The timeout is set only between two successive write operations, not for the transmission of the whole request. If the proxied server does not receive anything within this time, the connection is closed.