HTTP operates on what is called a request-response model. This means that a client generates a request for information and passes it to the server, which answers it. In the original implementation of HTTP, each request creates a new socket connection to the server, sends the request, then reads from that connection to get the response. Client keep-alives in NetScaler are the same as HTTP keep-alives. Client keep-alive is the process multiple request-response using the same socket connection.
Under HTTP 1.0, there is no official specification for how keep-alive operates.
If the browser supports keep-alive, it adds an additional header to the request:
Connection: Keep-Alive
When the server receives this request and generates a response, it also adds a header to the response:
Connection: Keep-Alive
Note: Under HTTP 1.1, the official keep-alive method is different. All connections are kept alive unless stated otherwise with the following header:
Connection: close
Background
When the NetScaler system has the Client keep-alives disabled and the server response to the client contains a Connection: close in the HTTP header, NetScaler passes the HTTP header on to the client without modifying it:
…
Hypertext Transfer Protocol
HTTP/1.0 200 OK
Response Code: 200
Connection: close
Content-Type: text/html; charset=utf-8
Content-Length: 29700
…
When the NetScaler system has the Client keep-alives enabled and the server response to the client contains a Connection: close in the HTTP header, NetScaler does two things to the HTTP header.
1. The existing Connection: header field is renamed to a unique header field.
2. A new Connection: header field is added with the keep-alive as its value.
HTTP/1.0 200 OK
Response Code: 200
Cneonction: close
Content-Type: text/html; charset=utf-8
Content-Length: 29700
Connection: Keep-Alive
Note: In some circumstances older or special application or Web pages are designed to only render the Web page after the browser receives the Connection: close. This type of design has undesirable results that will need to be solved within the application or Web page or disabling Client keep-alive.
Enabling and Disabling Client Keep-Alive
Client keep-alive can be enabled or disabled either on a global scale or on a per service basis. By default, the system’s Client keep-alive feature is disabled.
• To enable the Client keep-alive feature globally, enter the following CLI command:
enable ns mode CKA
• To disable the Client keep-alive feature globally, enter the following CLI command:
disable ns mode CKA
• To enable the Client Keep-Alive Feature for a service, enter the following CLI command:
set service
• To disable the Client Keep-Alive Feature for a service, enter the following CLI command:
set service
没有评论:
发表评论