A network connection optimization method, device, equipment and storage medium
By optimizing network connections, including selecting optimal network nodes and establishing connection pools, monitoring and correcting network connections, we solve the problems of network instability and poor user experience in weak network environments, and achieve more efficient network connections and user experience. experience.
Patent Information
- Application Number
- CN202410940706.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-15
- Publication Date
- 2024-10-08
- Estimated Expiration
- 2044-07-15
AI Technical Summary
In a weak network environment, the existing technology has unstable network connections, long domain name resolution, security risks, and imperfect network analysis and monitoring, resulting in high user payment failure rates and poor user experience.
By obtaining the server's network node data, select the optimal network address node to establish a connection, establish a network connection pool, monitor the historical response time of business requests, set the timeout, determine whether the request times out, perform network diagnosis, and generate a diagnosis strategy for correction; In the case of weak network conditions, methods such as resource caching, data compression, request merging, and high-traffic module shielding are used to optimize network connections.
It improves the stability of the network connection and user experience, reduces the payment failure rate, optimizes traffic consumption in weak network environments, and provides a better interactive experience.
Smart Images

Figure CN118488089B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of network connection, and in particular to a network connection optimization method, device, equipment and storage medium. Background Art
[0002] Applications widely used in offline physical industries such as retail and public services have high requirements for transaction efficiency and stability. When users use them through various terminals such as mini-programs, some stores have poor network environments, which may cause the following problems: unstable domain name resolution, which depends on operators and often takes more than 150ms, and there are security risks. For example, multiple domain name system (DNS) hijacking problems have caused the page to be tampered with, and the application was unavailable in batches when the merchant scanned the code due to operator failures; poor weak network experience, due to the characteristics of small bandwidth and high packet loss rate, the weak network environment will significantly increase the page loading time and interface request time, and the user payment failure rate will increase, and there is still a lack of optimization methods; network analysis and monitoring are not perfect, and it is currently impossible to actively analyze the network environment for customers and provide optimization suggestions. Summary of the invention
[0003] The present disclosure provides a network connection optimization method, device, equipment and storage medium to at least solve the above technical problems existing in the prior art.
[0004] According to a first aspect of the present disclosure, there is provided a network connection optimization method, comprising: acquiring network node data of a server based on a first service interface, selecting an optimal network address node based on the network node data, and establishing a network link between the server and a client based on the optimal network address node;
[0005] Establishing a network connection pool based on the network link, acquiring a service request generated by the client, selecting a service network link corresponding to the service request based on the network connection pool, and sending the service request based on the service network link;
[0006] Obtaining a historical response time of the service request and monitoring a network signal of the user, setting a timeout time of a request link corresponding to the service request based on the size of the service request, the historical response time, and the network signal of the user, and determining whether the service request has timed out based on the timeout time;
[0007] The connection data corresponding to the business request is saved locally, and network diagnosis is performed based on the connection data and historical network problems to generate a network diagnosis result, or the connection data is uploaded to the server to generate the network diagnosis result, a corresponding diagnosis strategy is generated based on the network diagnosis result, and the network connection is corrected based on the diagnosis strategy.
[0008] In one possible implementation, selecting the optimal network address node based on the network node data includes:
[0009] The network node data includes a network node list of the server and corresponding network node connection records, wherein the network node connection records include connection success records, connection failure records and connection time records;
[0010] Raising the priority of the network nodes corresponding to successful connections and short connection times in the network node connection records, and lowering the priority of the network nodes corresponding to failed connections in the network node connection records;
[0011] The network nodes in the network node list are prioritized based on the network node connection records to obtain a ranking result, and the optimal network node in the network node list is selected based on the ranking result.
[0012] In one embodiment, the method further comprises:
[0013] Obtaining a first connection speed when the service network link uses a first transmission protocol and a second connection speed when the service network link uses a second transmission protocol;
[0014] comparing the first connection speed and the second connection speed, and selecting a transmission protocol corresponding to the fastest connection speed for sending the service request;
[0015] The quality of the network links in the network connection pool is monitored in real time, and the network links with poor quality or disconnected are reconnected.
[0016] In one possible implementation manner, judging whether the service request has timed out based on the timeout period includes:
[0017] The request link includes: interface acquisition, network connection, first packet response and data transmission. Correspondingly, the timeout period of the request link includes: interface acquisition timeout period, network connection timeout period, first packet timeout period and data transmission timeout period.
[0018] The interface acquisition timeout period is used to monitor whether the acquisition of the network node data of the server based on the first service interface times out;
[0019] The network connection timeout period is used to monitor whether the network connection path between the server and the client established based on the optimal network address node times out;
[0020] The first packet timeout time is used to monitor whether the time taken to return the first data packet after sending the service request based on the service network link has timed out;
[0021] The data transmission timeout period is used to monitor whether the time for the client to obtain the return data of the service request has timed out;
[0022] After the service request times out, error information is generated, a connection retry instruction and a weak network prompt are generated based on the error information, and in response to the retry instruction, the request link corresponding to the timeout is reconnected or cache downgraded.
[0023] In one embodiment, the method further comprises:
[0024] Cache the resources required to load the service request based on the client local, browser and content distribution network, obtain the patch file of the service request in real time, and update the resources based on the patch file and the cache;
[0025] Acquire the user's network signal, network quality and network delay in real time, determine the user with poor network signal and / or low network quality and / or high network delay as the first user, and shield the high-traffic module in the return data sent to the first user;
[0026] Compressing the data transmitted in the network connection based on a first compression algorithm, and sending and receiving the compressed data in the network connection;
[0027] Acquire a display information service request corresponding to the display information interface, merge the display information service requests to generate a public service request, and send the public service request based on the service network link.
[0028] In one embodiment, the method further comprises:
[0029] monitoring the network status of the user in real time, generating a network abnormality feedback instruction when the network status of the user is poor, generating a connection waiting effect on the user's interactive interface in response to the network abnormality feedback instruction, and sending a network abnormality pop-up box or a network timeout feedback page to the user based on the interactive interface;
[0030] When the interactive interface is loaded, the skeleton screen plug-in is called, and a placeholder image is generated based on the skeleton screen plug-in when the interactive interface is loaded.
[0031] According to a second aspect of the present disclosure, a network connection optimization device is provided, comprising:
[0032] A node selection unit, configured to obtain network node data of the server based on the first service interface, select an optimal network address node based on the network node data, and establish a network link between the server and the client based on the optimal network address node;
[0033] A connection management unit, configured to establish a network connection pool based on the network link, obtain a service request generated by the client, select a service network link corresponding to the service request based on the network connection pool, and send the service request based on the service network link;
[0034] a request management unit, configured to obtain a historical response time of the service request and monitor a network signal of the user, set a timeout time of a request link corresponding to the service request based on the size of the service request, the historical response time, and the network signal of the user, and determine whether the service request has timed out based on the timeout time;
[0035] A network diagnostic unit is used to save the connection data corresponding to the business request locally, perform network diagnosis based on the connection data and historical network problems, and generate a network diagnostic result, or upload the connection data to the server to generate the network diagnostic result, generate a corresponding diagnostic strategy based on the network diagnostic result, and correct the network connection based on the diagnostic strategy.
[0036] In one embodiment, the device further comprises:
[0037] A traffic reduction unit is used to cache the resources required to load the service request based on the client local, browser and content distribution network, and obtain the patch file of the service request in real time, and update the resources based on the patch file and the cache; obtain the user's network signal, network quality and network delay in real time, determine the user with poor network signal and / or low network quality and / or high network delay as the first user, and shield the high-traffic module in the return data sent to the first user; compress the data transmitted in the network connection based on the first compression algorithm, and send and receive the compressed data in the network connection; obtain the display information service request corresponding to the display information interface, merge the display information service requests, generate a public service request, and send the public service request based on the service network link;
[0038] An interaction enhancement unit is used to monitor the user's network status in real time, generate a network abnormality feedback instruction when the user's network status is poor, generate a connection waiting effect on the user's interaction interface in response to the network abnormality feedback instruction, and send a network abnormality pop-up box or a network timeout feedback page to the user based on the interaction interface; when the interaction interface is loaded, call a skeleton screen plug-in, and generate a placeholder image based on the skeleton screen plug-in when the interaction interface is loaded.
[0039] According to a third aspect of the present disclosure, there is provided an electronic device, including:
[0040] at least one processor; and
[0041] a memory communicatively connected to the at least one processor; wherein,
[0042] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the present disclosure.
[0043] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the method described in the present disclosure.
[0044] The present invention discloses a network connection optimization method, device, equipment and storage medium, which obtains network nodes by using the first service interface, selects the best network nodes, pre-establishes a network connection pool and selects the best network connection by performing protocol selection, and sets corresponding timeouts for each link and monitors it to optimize the network connection. In addition, a user diagnosis strategy is given through network diagnosis to repair network problems. For users in weak network conditions, the method of reducing the number of resource loading times, compressing transmission data, merging business requests, and shielding high-traffic modules is used to reduce traffic consumption and optimize the user's interactive experience. It provides users with a better user experience in weak networks and a better user experience in good networks.
[0045] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present disclosure are shown in an exemplary and non-limiting manner, in which:
[0047] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts.
[0048] Figure 1 The following is a schematic diagram showing the implementation process of a network connection optimization method according to an embodiment of the present disclosure. Figure 1 ;
[0049] Figure 2 The following is a schematic diagram showing the implementation process of a network connection optimization method according to an embodiment of the present disclosure. Figure 2 ;
[0050] Figure 3 A schematic diagram of a network connection optimization device according to an embodiment of the present disclosure is shown;
[0051] Figure 4 A schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0052] In order to make the purpose, features, and advantages of the present disclosure more obvious and easy to understand, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0053] Figure 1 The following is a schematic diagram showing the implementation process of a network connection optimization method according to an embodiment of the present disclosure. Figure 1 ,like Figure 1 As shown, a network connection optimization method according to an embodiment of the present disclosure includes the following steps:
[0054] Step 101: acquiring network node data of a server based on a first service interface, selecting an optimal network address node based on the network node data, and establishing a network link between the server and a client based on the optimal network address node.
[0055] In the disclosed embodiment, the network node data includes a network node list of a server and corresponding network node connection records, wherein the network node connection records include connection success records, connection failure records, and connection time records; the priority of the network nodes corresponding to successful connections and short connection times in the network node connection records is increased, and the priority of the network nodes corresponding to connection failures in the network node connection records is reduced; the network nodes in the network node list are prioritized based on the network node connection records to obtain a ranking result, and the optimal network node in the network node list is selected based on the ranking result. Among them, the first server interface is a multi-terminal application domain name resolution service (Hypertext Transfer Protocol Domain Name System, HTTPDNS), and the network node data is the Internet Protocol (IP) data of the server, and correspondingly, the IP data includes an IP list and an IP connection record.
[0056] Step 102: establish a network connection pool based on the network link, obtain the service request generated by the client, select a service network link corresponding to the service request based on the network connection pool, and send the service request based on the service network link.
[0057] In the disclosed embodiment, a network connection pool is pre-built when an application is started or awakened, and protocol racing is performed at the same time, specifically: obtaining a first connection speed when the service network link uses a first transmission protocol and a second connection speed when the service network link uses a second transmission protocol; comparing the first connection speed and the second connection speed, and selecting the transmission protocol corresponding to the fastest connection speed for sending the service request. Among them, the first transmission protocol is Internet Protocol version 4 (IPV4), and the second transmission protocol is Internet Protocol version 6 (IPV6). After the racing, the fastest protocol is selected for the user to use.
[0058] In the embodiment of the present disclosure, after the network connection pool is established, it needs to be maintained, including: real-time monitoring of the quality of the network links in the network connection pool, and reconnecting the network links with poor quality or disconnected.
[0059] Step 103, obtain the historical response time of the service request and monitor the user's network signal, set the timeout time of the request link corresponding to the service request based on the size of the service request, the historical response time, and the user's network signal, and determine whether the service request has timed out based on the timeout time.
[0060] In the disclosed embodiment, timeout control is independently set at each node, specifically: the request link includes: interface acquisition, network connection, first packet response and data transmission, and correspondingly, the timeout period of the request link includes: interface acquisition timeout period, network connection timeout period, first packet timeout period and data transmission timeout period; wherein, the interface acquisition timeout period is used to monitor whether the acquisition of network node data of the server based on the first service interface has timed out; the network connection timeout period is used to monitor whether the network connection path between the server and the client established based on the optimal network address node has timed out; the first packet timeout period is used to monitor whether the time taken to return the first data packet after sending the service request based on the service network link has timed out; the data transmission timeout period is used to monitor whether the time taken for the client to obtain the return data of the service request has timed out.
[0061] In the disclosed embodiment, error information is generated after a service request times out, a connection retry instruction and a weak network prompt are generated based on the error information, and in response to the retry instruction, the request link corresponding to the timeout is reconnected or cache downgraded.
[0062] Step 104: save the connection data corresponding to the business request locally, perform network diagnosis based on the connection data and historical network problems, and generate a network diagnosis result, or upload the connection data to the server to generate the network diagnosis result, generate a corresponding diagnosis strategy based on the network diagnosis result, and correct the network connection based on the diagnosis strategy.
[0063] In the disclosed embodiment, historical network problems are collected, a case library is established, and the connection data stored locally is compared with the case library, and network commands such as the system software development kit (SDK) or the Internet packet searcher (PING), the domain name system (DNS) are used to perform network diagnosis and generate diagnostic results. The connection data includes: operator, signal, network speed, etc. The user is given self-service processing suggestions based on the diagnostic results.
[0064] In the disclosed embodiment, the connection data may also be uploaded to the server, a network diagnosis result may be manually generated based on the connection data, a corresponding diagnosis strategy may be generated, and the network connection may be corrected based on the diagnosis strategy.
[0065] In the embodiment of the present disclosure, in order to reduce the traffic consumption under poor network conditions, optimization can be performed through four aspects: resource loading, data compression, request merging and differentiated transmission. Specifically, the optimization includes: based on the client local, browser and content delivery network (Content Delivery Network) The method comprises the following steps: a first compression algorithm is used to compress the data transmitted in the network connection, and the compressed data is sent and received in the network connection; wherein the first compression algorithm may be a file compression program (GZIP) compression algorithm, and a display information service request corresponding to the display information interface is obtained, and the display information service requests are merged to generate a public service request, and the public service request is sent based on the service network link; wherein the display information interface may be a carousel image, an activity interface, etc. in the homepage of the application, and the network signal, network quality and network delay of the user are obtained in real time, and a user with poor network signal and / or low network quality and / or high network delay is determined as a first user, and a high-traffic module in the return data sent to the first user is shielded, wherein the first user is a user with poor network quality, and the high-traffic module includes: a carousel image, a bulletin board, and other high-traffic consumption modules on the homepage.
[0066] In the disclosed embodiments, in order to enhance the user's interactive experience, the interaction under weak network conditions may be modified and the rendering speed of the interactive interface may be improved, specifically including: real-time monitoring of the user's network condition, generating a network abnormality feedback instruction when the user's network condition is poor, generating a connection waiting effect on the user's interactive interface in response to the network abnormality feedback instruction, and sending a network abnormality pop-up box or a network timeout feedback page to the user based on the interactive interface; when the interactive interface is loaded, calling a skeleton screen plug-in, and generating a placeholder image based on the skeleton screen plug-in when the interactive interface is loaded, so as to visually reduce the user's anxiety while waiting.
[0067] Figure 2 The following is a schematic diagram showing the implementation process of a network connection optimization method according to an embodiment of the present disclosure. Figure 2 ,like Figure 2 As shown, a network connection optimization method according to an embodiment of the present disclosure includes the following steps:
[0068] Step 201: Select the best node to establish a network connection.
[0069] In the disclosed embodiment, a complete request network transmission is divided into the following links: DNS obtains IP address, establishes network connection, sends data, responds to the first packet and receives data, wherein the optimal node is selected to establish a network connection for the DNS to obtain IP address part, specifically: for the client and application programming interface (Application Programming Interface, API), SDK accesses the third-party HTTPDNS service, obtains a set of IP lists issued, and sorts them according to the IP usage records in the IP list, including: connection success, connection failure and connection time records. The strategy with good connection success rate and high performance is prioritized, and the nodes with continuous failures are eliminated. Preferably, the optimal initial IP is generated through the end-side horse racing algorithm, and the strategy is cached according to the user network granularity, and the corresponding strategy is loaded in time when the network is switched. The client dynamically replaces the IP to obtain the preferred IP to directly access the business server. By accessing the HTTPDNS service and directly obtaining the domain name IP through HTTP requests, the risk of hijacking can be avoided.
[0070] In the disclosed embodiment, the client enters the HTTPDNS server based on the Hypertext Transfer Protocol (HTTP) to connect to the authoritative HTTPDNS server, or enters the traditional local domain name (Local DNS) based on the User Datagram Protocol (UDP) to connect to the authoritative HTTPDNS server. Among them, the UDP protocol is used as a backup to ensure business continuity.
[0071] Step 202: Establish a network connection pool, and send a service request based on the network connection pool.
[0072] In the disclosed embodiment, a network connection pool is established, and a service request is sent based on the network connection pool in the network connection establishment part, specifically: a network connection pool is established based on a network link, and a connection is established in advance through a pre-established network connection pool based on the Android network framework (OKHTTP) when the application is started and awakened, and a protocol race is performed at the same time, and the fastest protocol is selected for the user from IPV6 and IPV4. For example, by comparison, the connection speed of the IPV4 protocol is 150ms slower than the connection speed of IPV6, so the IPV6 protocol is selected. Obtain the service request of the client, and send the service request based on the above connection pool and the selected protocol.
[0073] In the disclosed embodiment, a heartbeat keep-alive mechanism is used to perform routine maintenance on the network connection pool, regularly detect the quality of network links in the network connection pool, and reconnect and restore abnormalities, such as poor quality or disconnected network links.
[0074] Step 203: Network timeout management.
[0075] In the disclosed embodiment, after the service request is sent, the request process can be managed overtime, specifically: set independent timeout control on each request node, quickly perceive the timeout reason, where the timeout nodes include: DNS timeout, connection timeout, first packet timeout and request timeout, set different timeouts for each node of each interface request according to the complexity of the service, whether failure retry is possible and historical timeouts, dynamically adjust the interface request timeout according to the real-time network status and interface response time, avoid unnecessary failures caused by too short request time, and support timeout processing such as automatic retry, weak network prompt, cache downgrade, etc. In addition, when the network is unobstructed, cache the network requests that meet the rules, and use the cache to return the network request when the network is weak, which can also optimize the user experience.
[0076] Step 204: call the network self-service diagnosis tool.
[0077] In the disclosed embodiment, in order to locate various network problems, a network self-service diagnosis tool is used, specifically: exhaustively disassemble historical network problems to establish a network problem case library, and collect local network information of the client, including: operator, signal, network speed, etc., use system SDK or network commands such as PING, DNS, etc. to detect, obtain detection results, and give corresponding self-service processing suggestions. Specifically, collect abnormal network phenomena of users, including: normal network access but white screen, failure to load payment code, slow wireless network speed, etc.; exhaustively list the possible problems of abnormal network phenomena, including: router abnormality, poor signal / no traffic, DNS hijacking, operator IP ban, user mistakenly shut down the network, etc.; according to the above abnormal network phenomena and exhaustively listed problems, call the diagnostic method in the diagnostic tool, including: terminal network configuration analysis, detection of signal strength, rate, network card, comparison of HTTPDNS and Local DNS results, detection of corresponding node connectivity and delay; and execute corresponding diagnostic commands, including: speed measurement, bandwidth, DNS, etc., and determine the repair suggestions required by the user according to the execution results of the diagnostic commands, including: switching networks, adjusting router configurations, modifying DNS nodes, etc.
[0078] In the disclosed embodiment, the local network information data of the client may also be uploaded to the server, and the existing network problems may be further detected through manual detection methods to provide targeted repair strategies.
[0079] Step 205: weak network traffic management.
[0080] In the disclosed embodiment, in order to reduce the traffic consumption under weak network, adjustments can be made from four aspects, including: resource loading, data compression, request merging, and content differentiated transmission. Specifically: introduce local, browser, and CDN multi-level caches on the client to reduce the number of resource downloads, implement incremental updates, and only need to load the changed patch files after a single production, thereby reducing the number of resource loading times; reduce the size of messages and pictures through the GZIP compression algorithm, and reduce the amount of data transmission through data compression; merge multiple small requests of mini-programs or applications into a larger request to reduce the number of requests, where a small request can be an interface for the homepage to obtain display information, such as carousels, consultations, activities, etc., and call the actual interface and return data of the above small request at one time by adding a public interface, while the backend is obtained asynchronously by multi-threading, thereby reducing the number of network connections; identify users with poor network signals, quality, and latency, shield high-traffic consumption modules such as carousels and bulletin boards, and complete differentiated transmission.
[0081] Step 206: Improving user interaction experience.
[0082] In the disclosed embodiment, in order to enhance the user interaction experience, the interaction under weak network is optimized and recoverability settings are added, as well as the rendering speed of application pages is improved. Specifically, the pages of various terminals such as mini-programs and point of sale (POS) are reconstructed, and a resource loading progress bar, request loading effect, and weak network prompt are introduced to promptly feedback network abnormalities to users, allowing users to retry or choose other operations in white screen or timeout scenarios, thereby improving interactivity and recoverability under weak network conditions; a skeleton screen automatic generation plug-in is integrated into the front-end construction process, a skeleton screen is used instead of a white screen, and a placeholder image of less than 1kb is generated, thereby achieving a lazy loading effect from a blurred placeholder to a complete image, thereby visually reducing the user's anxiety while waiting.
[0083] Figure 3 A schematic diagram of a network connection optimization device according to an embodiment of the present disclosure is shown. Figure 3 As shown, a network connection optimization device in an embodiment of the present disclosure includes:
[0084] The node selection unit 301 is used to obtain the network node data of the server based on the first service interface, select the optimal network address node based on the network node data, and establish a network link between the server and the client based on the optimal network address node.
[0085] The node selection unit 301 is also used for: the network node data includes a network node list of the server and corresponding network node connection records, wherein the network node connection records include connection success records, connection failure records and connection time records; increasing the priority of the network nodes corresponding to successful connections and short connection times in the network node connection records, and reducing the priority of the network nodes corresponding to connection failures in the network node connection records; prioritizing the network nodes in the network node list based on the network node connection records to obtain a sorting result, and selecting the optimal network node in the network node list based on the sorting result.
[0086] The connection management unit 302 is used to establish a network connection pool based on the network link, obtain the service request generated by the client, select a service network link corresponding to the service request based on the network connection pool, and send the service request based on the service network link.
[0087] The connection management unit 302 is also used to obtain a first connection speed when the service network link uses a first transmission protocol and a second connection speed when the service network link uses a second transmission protocol; compare the first connection speed with the second connection speed, and select the transmission protocol corresponding to the fastest connection speed for sending the service request; monitor the quality of the network links in the network connection pool in real time, and reconnect the network links with poor quality or that have been disconnected.
[0088] The request management unit 303 is used to obtain the historical response time of the service request and monitor the user's network signal, set the timeout time of the request link corresponding to the service request based on the size of the service request, the historical response time, and the user's network signal, and determine whether the service request has timed out based on the timeout time.
[0089] The request management unit 303 is also used for the request link to include: interface acquisition, network connection, first packet response and data transmission. Correspondingly, the timeout period of the request link includes: interface acquisition timeout period, network connection timeout period, first packet timeout period and data transmission timeout period; wherein, the interface acquisition timeout period is used to monitor whether the acquisition of network node data of the server based on the first service interface has timed out; the network connection timeout period is used to monitor whether the network connection path between the server and the client established based on the optimal network address node has timed out; the first packet timeout period is used to monitor whether the time taken for returning the first data packet after sending the service request based on the service network link has timed out; the data transmission timeout period is used to monitor whether the time taken for the client to obtain the return data of the service request has timed out; an error message is generated after the service request times out, a connection retry instruction and a weak network prompt are generated based on the error message, and in response to the retry instruction, the request link corresponding to the timeout is reconnected or cache downgraded.
[0090] The network diagnosis unit 304 is used to save the connection data corresponding to the business request locally, perform network diagnosis based on the connection data and historical network problems, and generate a network diagnosis result, or upload the connection data to the server to generate the network diagnosis result, generate a corresponding diagnosis strategy based on the network diagnosis result, and correct the network connection based on the diagnosis strategy.
[0091] The traffic reduction unit 305 is used to cache the resources required to load the service request based on the client local, browser and content distribution network, and obtain the patch file of the service request in real time, and update the resources based on the patch file and the cache; obtain the user's network signal, network quality and network delay in real time, determine the user with poor network signal and / or low network quality and / or high network delay as the first user, and shield the high-traffic module in the return data sent to the first user; compress the data transmitted in the network connection based on the first compression algorithm, and send and receive the compressed data in the network connection; obtain the display information service request corresponding to the display information interface, merge the display information service requests to generate a public service request, and send the public service request based on the service network link.
[0092] The interaction enhancement unit 306 is used to monitor the user's network status in real time. When the user's network status is poor, a network abnormality feedback instruction is generated. In response to the network abnormality feedback instruction, a connection waiting effect is generated on the user's interaction interface, and a network abnormality pop-up box or a network timeout feedback page is sent to the user based on the interaction interface; when the interaction interface is loaded, a skeleton screen plug-in is called, and a placeholder image is generated based on the skeleton screen plug-in when the interaction interface is loaded.
[0093] In an exemplary embodiment, the node selection unit 301, the connection management unit 302, the request management unit 303, the network diagnosis unit 304, the traffic attenuation unit 305 and the interaction enhancement unit 306 can be implemented by one or more central processing units (CPU), graphics processing units (GPU), application specific integrated circuits (ASIC), DSP, programmable logic devices (PLD), complex programmable logic devices (CPLD), field programmable gate arrays (FPGA), general-purpose processors, controllers, microcontrollers (MCU), microprocessors, or other electronic components.
[0094] Regarding the device in the above embodiment, the specific manner in which each module and unit performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0095] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device and a readable storage medium.
[0096] Figure 4 A schematic block diagram of an example electronic device 800 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0097] like Figure 4 As shown, the device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 to a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0098] A number of components in the device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0099] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above, such as a network connection optimization method. For example, in some embodiments, a network connection optimization method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of a network connection optimization method described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform a network connection optimization method in any other appropriate manner (e.g., by means of firmware).
[0100] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0101] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0102] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0103] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0104] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0105] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0106] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0107] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0108] The above is only a specific embodiment of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present disclosure, which should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A network connection optimization method, It is characterized in that The method comprises: Acquire network node data of the server based on the first service interface, select an optimal network address node based on the network node data, and establish a network link between the server and the client based on the optimal network address node; Establishing a network connection pool based on the network link, acquiring a service request generated by the client, selecting a service network link corresponding to the service request based on the network connection pool, and sending the service request based on the service network link; Obtaining a historical response time of the service request and monitoring a network signal of the user, setting a timeout time of a request link corresponding to the service request based on the size of the service request, the historical response time, and the network signal of the user, and determining whether the service request has timed out based on the timeout time; The connection data corresponding to the service request is stored locally, and network diagnosis is performed based on the connection data and historical network problems to generate a network diagnosis result, or the connection data is uploaded to the server to generate the network diagnosis result, a corresponding diagnosis strategy is generated based on the network diagnosis result, and the network connection is corrected based on the diagnosis strategy; The network node data includes a network node list of the server and corresponding network node connection records, wherein the network node connection records include connection success records, connection failure records and connection time records; Raising the priority of the network nodes corresponding to successful connections and short connection times in the network node connection records, and lowering the priority of the network nodes corresponding to failed connections in the network node connection records; Prioritize the network nodes in the network node list based on the network node connection records to obtain a ranking result, and select the best network node in the network node list based on the ranking result; The request link includes: interface acquisition, network connection, first packet response and data transmission. Correspondingly, the timeout period of the request link includes: interface acquisition timeout period, network connection timeout period, first packet timeout period and data transmission timeout period. The interface acquisition timeout period is used to monitor whether the acquisition of the network node data of the server based on the first service interface has timed out; The network connection timeout period is used to monitor whether the network connection path between the server and the client established based on the optimal network address node times out; The first packet timeout time is used to monitor whether the time taken to return the first data packet after sending the service request based on the service network link has timed out; The data transmission timeout period is used to monitor whether the time for the client to obtain the return data of the service request has timed out; After the service request times out, error information is generated, a connection retry instruction and a weak network prompt are generated based on the error information, and in response to the retry instruction, the request link corresponding to the timeout is reconnected or cache downgraded.
2. The method according to claim 1, It is characterized in that The method further comprises: Obtaining a first connection speed when the service network link uses a first transmission protocol and a second connection speed when the service network link uses a second transmission protocol; comparing the first connection speed and the second connection speed, and selecting a transmission protocol corresponding to the fastest connection speed for sending the service request; The quality of the network links in the network connection pool is monitored in real time, and the network links with poor quality or disconnected are reconnected.
3. The method according to claim 1, It is characterized in that The method further comprises: The resources required to be loaded by the service request are cached based on the client local, browser and content distribution network, and the patch file of the service request is obtained in real time, and the resources are updated based on the patch file and the cache; Acquire the user's network signal, network quality and network delay in real time, determine the user with poor network signal and / or low network quality and / or high network delay as the first user, and shield the high-traffic module in the return data sent to the first user; Compressing the data transmitted in the network connection based on a first compression algorithm, and sending and receiving the compressed data in the network connection; Acquire a display information service request corresponding to the display information interface, merge the display information service requests to generate a public service request, and send the public service request based on the service network link.
4. The method according to claim 1, It is characterized in that The method further comprises: monitoring the network status of the user in real time, generating a network abnormality feedback instruction when the network status of the user is poor, generating a connection waiting effect on the user's interactive interface in response to the network abnormality feedback instruction, and sending a network abnormality pop-up box or a network timeout feedback page to the user based on the interactive interface; When the interactive interface is loaded, the skeleton screen plug-in is called, and a placeholder image is generated based on the skeleton screen plug-in when the interactive interface is loaded.
5. A network connection optimization device, It is characterized in that The device comprises: A node selection unit, configured to obtain the network node data of the server based on the first service interface, select an optimal network address node based on the network node data, and establish a network link between the server and the client based on the optimal network address node; A connection management unit, configured to establish a network connection pool based on the network link, obtain a service request generated by the client, select a service network link corresponding to the service request based on the network connection pool, and send the service request based on the service network link; a request management unit, configured to obtain a historical response time of the service request and monitor a network signal of the user, set a timeout time of a request link corresponding to the service request based on the size of the service request, the historical response time, and the network signal of the user, and determine whether the service request has timed out based on the timeout time; A network diagnosis unit, configured to locally store the connection data corresponding to the service request, perform network diagnosis based on the connection data and historical network problems, and generate a network diagnosis result, or upload the connection data to the server to generate the network diagnosis result, generate a corresponding diagnosis strategy based on the network diagnosis result, and modify the network connection based on the diagnosis strategy; The node selection unit is further configured to: the network node data includes a network node list of a server and corresponding network node connection records, wherein the network node connection records include connection success records, connection failure records, and connection time records; increase the priority of network nodes corresponding to successful connections and short connection times in the network node connection records, and reduce the priority of network nodes corresponding to connection failures in the network node connection records; prioritize the network nodes in the network node list based on the network node connection records to obtain a ranking result, and select the optimal network node in the network node list based on the ranking result; The request management unit is also used for the request link to include: interface acquisition, network connection, first packet response and data transmission. Correspondingly, the timeout period of the request link includes: interface acquisition timeout period, network connection timeout period, first packet timeout period and data transmission timeout period. The interface acquisition timeout period is used to monitor whether the acquisition of network node data of the server based on the first service interface has timed out. The network connection timeout period is used to monitor whether the network connection path between the server and the client established based on the optimal network address node has timed out. The first packet timeout period is used to monitor whether the time taken to return the first data packet after sending the service request based on the service network link has timed out. The data transmission timeout period is used to monitor whether the time taken for the client to obtain the return data of the service request has timed out. After the service request times out, an error message is generated. A connection retry instruction and a weak network prompt are generated based on the error message. In response to the retry instruction, the request link corresponding to the timeout is reconnected or cache downgraded.
6. The device according to claim 5, It is characterized in that The device also includes: A traffic reduction unit is used to cache the resources required to load the service request based on the client local, browser and content distribution network, and obtain the patch file of the service request in real time, and update the resources based on the patch file and the cache; obtain the user's network signal, network quality and network delay in real time, determine the user with poor network signal and / or low network quality and / or high network delay as the first user, and shield the high-traffic module in the return data sent to the first user; compress the data transmitted in the network connection based on the first compression algorithm, and send and receive the compressed data in the network connection; obtain the display information service request corresponding to the display information interface, merge the display information service requests, generate a public service request, and send the public service request based on the service network link; An interaction enhancement unit is used to monitor the user's network status in real time, generate a network abnormality feedback instruction when the user's network status is poor, generate a connection waiting effect on the user's interaction interface in response to the network abnormality feedback instruction, and send a network abnormality pop-up box or a network timeout feedback page to the user based on the interaction interface; when the interaction interface is loaded, call a skeleton screen plug-in, and generate a placeholder image based on the skeleton screen plug-in when the interaction interface is loaded.
7. An electronic device, It is characterized in that include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 4.
8. A non-transitory computer-readable storage medium storing computer instructions, It is characterized in that The computer instructions are used to make a computer execute the method according to any one of claims 1-4.
