In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail what is a long link, and the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
Persistent connection means that multiple data packets can be sent continuously on a connection. During the connection maintenance period, if no data packets are sent, both parties need to send link detection packets, which are mostly used for frequent and peer-to-peer communications. and the number of connections can't be too many.
Persistent connections are:
I. definition
Short connection means that when there is data exchange between the two sides of the communication, a connection is established, and after the data transmission is completed, the connection is disconnected, that is, only one service is sent at a time.
Persistent connection means that multiple packets can be sent continuously on a single connection. If no packets are sent during the connection maintenance, both parties need to send link detection packets.
Long connections are mostly used for frequent operations, point-to-point communication, and the number of connections should not be too many. Each TCP connection requires a three-step handshake, which takes time. If each operation is a short connection, then the processing speed will be much lower, so it will continue to open after each operation, and the next time you send a packet directly, it will be OK, and there is no need to establish a TCP connection. For example, database connections use long connections, frequent communication with short connections will cause socket errors, and frequent socket creation is also a waste of resources.
Http services like WEB sites generally use short links, because long links will consume certain resources for servers, while thousands or even hundreds of millions of clients with short connections like WEB sites will save some resources. If long links are used, and there are thousands of users at the same time, it can be imagined if each user occupies a connection. Therefore, the amount of concurrency is large, but each user needs to use short connection when there is no need for frequent operation.
In short, the choice of long and short connections depends on the situation.
II. Application
(1) the principle of mobile phone push
The principle of mobile phone push service is very simple, that is, by establishing a connection link between the mobile phone and the server, when a message needs to be sent to the mobile phone, it can be sent through this link. Although the process of using push service is slightly different, it is generally similar to IOS's APNS.
1. First, the application registers the message push.
2. IOS asks APNS Server for deviceToken. The application accepts deviceToken.
3. The application sends the deviceToken to the PUSH server program.
4. The server program sends messages to the APNS service.
5. The APNS service sends messages to the iPhone application
(2) Evaluation criteria of push plan
The generally accepted evaluation of the push scheme is based on the 4s standard: 1.Safe (security) 2. Stable (stable) 3.Save (power saving, flow saving and cost saving) 4.Slim (small size)
1.Safe (Security)
The push scheme should support transparent transmission and various encryption schemes to ensure the security of information transmission.
The ID system of the push scheme should be independent of the existing ID system of websites or services, so as to ensure the accuracy of information delivery after users log in on different mobile phones, and avoid misdelivery of information caused by network transmission due to the failure of unbinding events.
2. Stable (stable)
Stability includes two parts, one is the stability of the server side, the other is the stability of the mobile phone side.
Server stability, because the use of long-connection scheme, the cost and requirements of the server, push scheme for server development requirements are very high, server stability under massive thread connections is very challenging. General criteria include:
-Peak when online at the same time (usually according to server stability evaluation when millions of concurrent connections are made)
-APCge delay time for messages with high concurrency (1 million messages are generally processed per minute)
-Service stability (generally required to be more than 99.9% available throughout the year, backup, load balancing, etc.)
In view of the difficulty of stable server development, small teams do not recommend their own development, it is recommended to use a stable third-party push solution, such as a push, butterfly and so on.
The stability of the mobile phone is mainly due to the difficulties of long-term stable networking of mobile phones due to the complex network conditions and the adaptation of mobile phone models in China, so stability is very important. The general evaluation criteria include:
-the proportion of users who are connected for more than 23.5 hours per day (indicating the stability of the network)
-the rate of receipt within 9 hours after the message is sent (indicates the arrival rate)
Generally speaking, the push scheme should be the sub-operator of the network, the provincial and sub-model should be adapted, and the workload of self-development is heavy.
3.Save (savings)
Power saving should pay attention to CPU hibernation, generally using service to shorten standby time percentage judgment.
Saving traffic should pay attention to the modification of the protocol and the processing of redundant data packets, which is generally judged by the monthly traffic of no-load waiting machine.
Cost saving should consider the number of simultaneous connections carried by a single server. The more simultaneous connections you can hold, the lower the cost. The top level in the industry is 500000 connections per single server.
4.Slim (small)
Push service should be as small as possible, do not affect the size and complexity of the main program, generally less than 300K is appropriate.
About what is a long connection to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.