Haporoxy's keeplaive ZZ

Source: Internet
Author: User
Tags haproxy

Reproduced by a person summed up
Http://hi.baidu.com/%D3%E3%B5%C1%B5%C1/blog/item/04ffd1b1854f69ef30add1e8.html

Httpclose, Http-server-close, Forceclose, http-pretend-keepalive

Transport mode for http: A TCP connection may contain multiple requests and replies,

That is: Client----TCP1----HAProxy----TCP2----Server

By default, Haproxy only parses the first request for each connection, chooses a server to do the load, and then forwards subsequent requests for that connection to the server, which is the keep-alive mode, which is

Client---keepalive---HAProxy---keepalive---Server.

If you do not want to transfer subsequent request to the same server, but instead select the server for each request, there are two ways: one is to enable the Httpclose option, and the Connection is added automatically in the protocol header of request and response: Close "so that each connection only processes one request. The second is to enable the Http-server-close option to maintain the client's connection, but each request in the connection is handled separately, assigned to a different server, and the server-side processing is completed and the connection is closed immediately.

Client---keepalive/httpclose---HAProxy---httpclose---Server.

If you want to close the TCP connection immediately after each request answer, you can use the Httpclose mode, which is

Client---httpclose---HAProxy---httpclose---Server.

If the server does not want to close the connection to the haproxy after responding to the request, but instead uses the connection to continue serving other request, you can enable the http-pretend-keepalive option, which is

Client---keepalive/httpclose---HAProxy---keepalive---Server.

If the http-pretend-keepalive and Httpclose options are enabled at the same time, the Client---httpclose---HAProxy---keepalive---Server, which is generally not recommended.

If some servers do not close the connection after receiving "Connection:close", and the client fails to close the connection in a timely manner, it will cause a large number of concurrent connections, then the Forceclose option can be enabled and the connection is actively closed by Haproxy.

Haporoxy keeplaive ZZ

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.