What is Keep-alive? OverviewBy default, HTTP links are usually closed after the request is complete. This means that the server closes the TCP link after the delivery of the response has been completed. To keep the link open to satisfy multiple requests, you can use the keep-alive
cannot detect that the network has been disconnected abnormally. What should we do?
We know that TCP has a connection detection mechanism, that is, if no data is transmitted within the specified time (generally 2 hours), a keep-alive datagram will be sent to the peer end, the serial number used is the serial number of the last byte of the last sent packet. If the peer receives the data, it returns a tcp
Keep Alive under TCPWe often say that the TCP keep alive, is to ensure the validity of the connection, at a certain time interval to send a probe packet, based on the reply to confirm that the connection is valid. Typically, upper-level applications provide their own heartbeat detection mechanisms, and the Linux kernel
Each time you click on the city page button to jump to the first page will request data, which results in low performance,
we keep-alive The contents of the display in the App.vue.2, each click on the city to take the corresponding data rendering to the home pagethen click on the city page to jump to the homepage questions about getting city data appeared (no request was sent, only the first data was r
1. What is the keep-alive mode?
The HTTP protocol adopts the "request-response" mode. When the common mode is used, that is, the non-keepalive mode, a new connection is required for each request/response client and server, disconnect immediately after completion (the HTTP protocol is connectionless). When the keep-alive
current state of the connection, make a non-blocking, 0-byte Send call. If the call successfully returns or throws a Waewouldblock error code (10035), the socket is still connected, otherwise, the socket is no longer in a connected state.
However, I found in practical applications that MSDN's approach to this kind of processing in many cases is not valid, can not detect the network has been abnormally disconnected. So what do we do?
We know that TCP has a connection detection mechanism, that
Brief introductionKeep-alive is a configuration parameter in the HTTP request header information, which is commonly known as the HTTP Long connection, HTTP 1.0 and HTTP 1.1 are supported, the property is turned off by default in HTTP1.0, and can be configured to open in header information (Connection keep-alive), HTTP1.1 in this property is enabled by default, th
One. HTTP protocol is a connection protocol, so that each connection to re-open a TCP HTTP socket, the short-term host to the server request will be very slow, if you can maintain the connection, you can save the socket Open,socket close and other times, Early in the http1.0 protocol appended the Keep-alive field, connection:keep-alive, the client sends HTTP cont
Determine the end of an HTTP request in Keep-Alive mode. When a short connection is used, each HTTP request corresponds to a TCP connection. after the request is complete, the connection is immediately disconnected, and the server returns EOF. Therefore, the end of a request can be determined based on EOF. in the short connection mode below, each HTTP request corresponds to a TCP connection. after the reque
Code used to determine the end of an HTTP request in the Keep-Alive mode. Therefore, you can determine the end of a request based on EOF. the following code (PHP) is very common: Copy the code as follows: $ fp is the handle while (!) produced by fsockopen (! Feof ($ fp) {echofgets (so you can judge the end of a request based on EOF. the following code (PHP) is very common:
The code is as follows:
// $ Fp
This article is an opportunity outline:
Existing requirements
Advantages and disadvantages of each solution
Related issues Extension
Keep-alive use of the detailed
Existing RequirementsThere are many list data presentation pages in each project, and often include some filter criteria and pagination.Also, clicking on a column in the table requires a route to jump into the
Basic introductionKeep alive can be set at the operating system level for connections made to this machine. A simple TCP packet is returned to the remote host within the set time to detect if the remote host is still responding.There are 2 main application scenarios:1. Know earlier that the remote host was down.Under normal circumstances a host and a Host B have established a connection. A sent a message to the B host, B said received, a began to wait
determine the current status of the connection, please do not block, zero-byte send call. If the call is successful or the waewouldblock error code (10035) is triggered, the socket is still in the connection status; otherwise, the socket is no longer in the connection status.
However, in practical applications, I found that this method described by msdn is often ineffective and cannot detect that the network has been disconnected abnormally. What should we do?
We know that TCP has a connecti
current status of the connection, please do not block, zero-byte send call. If the call is successful or the waewouldblock error code (10035) is triggered, the socket is still in the connection status; otherwise, the socket is no longer in the connection status.
However, in practical applications, I found that this method described by msdn is often ineffective and cannot detect that the network has been disconnected abnormally. What should we do?
We know that TCP has a connection detection mech
The version after Haproxy 1.5 supports 5 ways to connect-Kal:keep Alive ("option Http-keep-alive") which is the default Mode:allRequests and responses is processed, and connections remain open but idleBetween responses and new requests. The default way to keep connections-Tun:tunnel ("option Http-tunnel"): This is the
When a short connection is used, each HTTP request corresponds to a TCP connection. after the request is complete, the connection is immediately disconnected, and the server returns EOF. Therefore, you can determine the end of a request based on EOF. the following code (PHP) is very common:
The code is as follows:
// $ Fp is the handle generated by fsockopen ().
While (! Feof ($ fp )){
Echo fgets ($ fp );
}
(Note: The short Connection mode is marked with "Connection: close" in the header and
When a short connection is used, each HTTP request corresponds to a TCP connection. after the request is complete, the connection is immediately disconnected, and the server returns EOF. Therefore, you can determine the end of a request based on EOF. the following code (PHP) is very common:
The code is as follows:
// $ Fp is the handle generated by fsockopen ().While (! Feof ($ fp )){Echo fgets ($ fp );}
(Note: The short Connection mode is marked with "Connection: close" in the header and "C
When using short connection mode, each HTTP request corresponds to a TCP connection, the connection is immediately disconnected after the request completes, and the server returns EOF. So you can judge the end of a request based on EOF, the following code (PHP) is common:
Copy to ClipboardWhat to refer to:
[www.bkjia.com]$FP is a handle produced by Fsockopen ()
while (!feof ($fp)) {
Echo fgets ($FP);
}
(Note: The short connection mode is marked with "Connection:close" in the head, and the long
The keep-alive feature makes the client-to-server connection persistent, and when a subsequent request to the server occurs, the Keep-alive feature avoids establishing or re-establishing the connection. Most Web servers on the market, including Iplanet, IIS, and Apache, support HTTP
The default connection timeout time of IIS is 2 minutes. Therefore, when the node program uses keep-alive for access, the keep-alive time should not exceed 2 minutes. Otherwise, after the request is complete, the node continues to maintain the connection. If IIS is disconnected after 2 minutes, the underlying TCP of th
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.