A method, apparatus, and device for network link degradation
By obtaining client requests in the network access link and using the status interface to test connection speed and switch status codes, the problem of link unavailability caused by network line failure was solved, thus ensuring smooth network link operation and software system stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANGHAI ZHONGTONGJI NETWORK TECH CO LTD
- Filing Date
- 2023-04-19
- Publication Date
- 2026-05-08
AI Technical Summary
Existing network access link solutions suffer from the problem of the entire link becoming unusable due to network line failures.
By obtaining the client's access request, the status interface is called to test the connection speed, determine whether the current network line is faulty, and switch to the target network line based on the status code, including the regular gateway domain name line and the backup escape domain name line.
Ensuring smooth network connectivity at low cost and in a short time guarantees the stability of the software system and avoids overall unavailability due to network line failures.
Smart Images

Figure CN116346579B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of Internet technology, specifically relating to a method, apparatus, and device for network link degradation. Background Technology
[0002] With the rapid development of mobile networks, the quality of service (QoS) of software systems has become an increasingly important concern. Resource scarcity, expensive equipment investment, and the ever-increasing number of users all hinder the development of software systems. At the same time, the growing demand for mobility and higher expectations for service quality and business operations necessitate continuous improvement in the stability of software systems. Therefore, system stability assurance solutions that leverage existing network equipment, resources, and capacity to ensure the stability of software systems, thereby maximizing the average QoS and improving efficiency, have emerged.
[0003] Existing network access solutions typically involve clients such as apps, PCs, and mini-programs actively requesting a domain name. After DNS resolution, the target host IP is located, and the request travels through the network operator's line (China Mobile, China Telecom, China Unicom) to the target gateway. The target gateway forwards the request to the main service, which then responds to the client. When the gateway or the operator's line fails, all requests cannot reach the main service, directly rendering the entire application or app unusable. Therefore, existing network access solutions suffer from the problem of the entire link becoming unusable due to network line failures. Summary of the Invention
[0004] To address this issue, the present invention provides a method, apparatus, and device for network link degradation, which helps to solve the problem that existing network access link solutions suffer from the inability of the entire link to function due to network line failures.
[0005] To achieve the above objectives, the present invention adopts the following technical solution:
[0006] In a first aspect, the present invention provides a method for network link degradation, comprising:
[0007] Obtain the client's access request;
[0008] The status interface is called to perform a connection speed test on the current network line based on the access request, and to determine whether the current network line is faulty; wherein, the current network line includes the regular gateway domain name line and the backup escape domain name line;
[0009] If the current network line fails, the status code of the status interface is determined; wherein, the status code includes the gateway status code and the HTTP status code;
[0010] Based on the status code, the current network line is switched to the target network line.
[0011] Further, the step of switching the current network line to the target network line according to the status code includes:
[0012] When the HTTP status code is the first preset error code, a connection speed test is performed on the conventional gateway domain name line, and the current network line is switched to the first target network line;
[0013] When the gateway status code is the second preset error code, a connection speed test is performed on the backup escape domain name line, and the current network line is switched to the second target network line.
[0014] Furthermore, the first preset error code is the code corresponding to a fault in the network operator or a single data center; and
[0015] Perform a connection speed test on the conventional gateway domain name line, and switch the current network line to the first target network line, including:
[0016] Call the status interface to perform connection speed tests on the regular gateway domain name lines, and select the regular gateway domain name line with the fastest response speed as the first target network line.
[0017] Switch the current network line to the first target network line.
[0018] Furthermore, the second preset error code is the code corresponding to a gateway failure; and
[0019] The connection speed of the backup escape domain name line is tested, and the current network line is switched to the second target network line, including:
[0020] The status interface is invoked to test the connection speed of the backup escape domain name lines, and the backup escape domain name line with the fastest response speed is selected as the second target network line.
[0021] Switch the current network line to the second target network line.
[0022] Furthermore, the method also includes:
[0023] If both the regular gateway domain name line and the backup escape domain name line are unavailable, the client will be switched to offline mode and the operation data will be saved locally.
[0024] Furthermore, the method also includes:
[0025] A background timer will automatically start after the current network line is switched or the client enters offline mode.
[0026] The background timer is controlled to access the status interface at preset time intervals to test the connection speed of the regular gateway domain name line.
[0027] Furthermore, the conventional gateway domain name lines include a first preset number of default CDN three-line domain names and a second preset number of combined gateway domain names; wherein, the combined gateway domain names are formed by arranging and combining multiple operators and multiple data centers.
[0028] Secondly, the present invention provides a network link degradation apparatus, comprising:
[0029] The request retrieval module is used to retrieve access requests from clients;
[0030] The speed test module is used to call the status interface to perform a connection speed test on the current network line based on the access request, and to determine whether the current network line has failed; wherein, the current network line includes the regular gateway domain name line and the backup escape domain name line;
[0031] The status code determination module is used to determine the status code of the status interface if the current network line fails; wherein the status code includes the gateway status code and the HTTP status code;
[0032] The line switching module is used to switch the current network line to the target network line according to the status code.
[0033] Furthermore, the line switching module is specifically used for:
[0034] When the HTTP status code is the first preset error code, a connection speed test is performed on the conventional gateway domain name line, and the current network line is switched to the first target network line;
[0035] When the gateway status code is the second preset error code, a connection speed test is performed on the backup escape domain name line, and the current network line is switched to the second target network line.
[0036] Thirdly, the present invention provides a network link degradation device, comprising:
[0037] One or more memories on which executable programs are stored;
[0038] One or more processors are configured to execute the executable program in the memory to implement the steps of any of the methods described above.
[0039] The present invention, by adopting the above technical solution, has at least the following beneficial effects:
[0040] This invention obtains client access requests, calls the `status` interface, and performs connection speed tests on the current network line based on the access requests to determine if the current network line is faulty. The current network line includes a regular gateway domain name line and a backup escape domain name line. If the current network line is faulty, the status code of the `status` interface is determined; the status code includes a gateway status code and an HTTP status code. Based on the status code, the current network line is switched to a target network line. By switching the current network line based on the status code when a fault occurs, this invention solves the problem of existing network access link solutions where the entire link becomes unusable due to a faulty current network line. It achieves uninterrupted network connectivity at a lower cost, in a shorter time, and without requiring deployment modifications, thus ensuring the stability of the software system.
[0041] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description
[0042] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0043] Figure 1 This is a flowchart illustrating a network link degradation method according to an embodiment of the present invention;
[0044] Figure 2 This is a block diagram illustrating a network link degradation device according to an embodiment of the present invention;
[0045] Figure 3 This is a block diagram illustrating a network link degradation device according to an embodiment of the present invention. Detailed Implementation
[0046] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be described in detail below. Obviously, the described embodiments are merely some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other implementation methods obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0047] Please see Figure 1 , Figure 1 This is a flowchart illustrating a network link degradation method according to an embodiment of the present invention, such as... Figure 1 As shown, the method includes the following steps:
[0048] Step S11: Obtain the client's access request;
[0049] Step S12: Call the status interface to perform a connection speed test on the current network line based on the access request, and determine whether the current network line has failed; wherein, the current network line includes the regular gateway domain name line and the backup escape domain name line;
[0050] Step S13: If the current network line fails, determine the status code of the status interface; wherein, the status code includes the gateway status code and the HTTP status code;
[0051] Step S14: Switch the current network line to the target network line according to the status code.
[0052] It should be noted that, in this embodiment, the executing entity is the server.
[0053] In this embodiment, the client refers to applications such as apps and mini-programs on devices like mobile phones or computers. When an application starts or is opened for the first time, it sends a request to access the server, establishing a network link with the server to exchange information. During this interaction, the network link connection speed needs to be tested to ensure smooth network connectivity and the stability of the software system.
[0054] It should be noted that the current network lines include a regular gateway domain name line and a backup escape domain name line. Before establishing a network link, the network lines need to be configured. Generally, only the regular gateway domain name line is configured. In this embodiment, the network lines are also configured with a backup escape domain name line, which is used to bypass the gateway and access the main server when the regular gateway domain name line fails.
[0055] It should be noted that in this embodiment, users are not allowed to manually switch the backup escape domain name line.
[0056] It should be noted that when a network line fails, the current network line needs to be switched to another network line based on the status code of the status interface to restore network connectivity.
[0057] The health status of the status interface indicates the availability of the entire network link. The status code of the status interface is the corresponding error code generated when an error occurs on the interface, including gateway status codes and HTTP status codes.
[0058] Understandably, this embodiment obtains the client's access request, calls the status interface, and performs a connection speed test on the current network line based on the access request to determine whether the current network line has failed. The current network line includes the regular gateway domain name line and the backup escape domain name line. If the current network line fails, the status code of the status interface is determined; the status code includes the gateway status code and the HTTP status code. Based on the status code, the current network line is switched to the target network line. By switching the current network line based on the status code when a failure occurs, this solution addresses the problem in existing network access link solutions where a failure of the current network line renders the entire link unusable. It achieves uninterrupted network connectivity at a lower cost, in a shorter time, and without requiring deployment modifications, thus ensuring the stability of the software system.
[0059] Further, the step of switching the current network line to the target network line according to the status code includes:
[0060] When the HTTP status code is the first preset error code, a connection speed test is performed on the conventional gateway domain name line, and the current network line is switched to the first target network line;
[0061] When the gateway status code is the second preset error code, a connection speed test is performed on the backup escape domain name line, and the current network line is switched to the second target network line.
[0062] It should be noted that both HTTP status codes and gateway status codes have corresponding error codes. Each error code represents a type of fault. Based on each error code, you can test the connection speed of the current network line by selecting between the regular gateway domain line and the backup escape domain line, and try switching network lines.
[0063] It should be noted that in this embodiment, there are no specific limitations on the first preset error code and the second preset error code.
[0064] Furthermore, the first preset error code is the code corresponding to a fault in the network operator or a single data center; and
[0065] Perform a connection speed test on the conventional gateway domain name line, and switch the current network line to the first target network line, including:
[0066] Call the status interface to perform connection speed tests on the regular gateway domain name lines, and select the regular gateway domain name line with the fastest response speed as the first target network line.
[0067] Switch the current network line to the first target network line.
[0068] In practical applications, if the HTTP status code is not 200, it indicates the first preset error code, meaning that a network failure has occurred due to a fault in the network operator or a single data center, causing the network link to be down. In this case, the status interface needs to be called to perform connection speed tests on the regular gateway domain name lines, and then the line with the fastest response time should be selected as the first target network line for switching.
[0069] Furthermore, the second preset error code is the code corresponding to a gateway failure; and
[0070] The connection speed of the backup escape domain name line is tested, and the current network line is switched to the second target network line, including:
[0071] The status interface is invoked to test the connection speed of the backup escape domain name lines, and the backup escape domain name line with the fastest response speed is selected as the second target network line.
[0072] Switch the current network line to the second target network line.
[0073] It should be noted that in practical applications, if the gateway status code displays S203, S205, S206, S207, S208, S213, S214, S218, G400, or G500, the gateway status code indicates the second preset error code. This means that a gateway failure has caused a network line failure, resulting in a network link outage. In this case, it is necessary to call the status interface to bypass the gateway, test the connection speed of the backup escape domain name line, and then use the line with the fastest response speed as the second target network line to switch to.
[0074] It should be noted that in practical applications, when the status code displays 200, SYS000, or S204, it indicates that the network line is normal and no line switching is required.
[0075] Understandably, in scenarios involving network operator failures, single data center failures, or gateway failures, selecting a switching strategy based on status codes ensures the smooth operation of the overall network link of the software system and improves the quality of system services.
[0076] It should be noted that in this embodiment, the service speed is obtained by calculating the time from DnsStart to ResponseBodyEnd using EventListener. However, this embodiment does not specify a particular method for selecting the fastest connection line through connection speed testing.
[0077] Furthermore, the method also includes:
[0078] If both the regular gateway domain name line and the backup escape domain name line are unavailable, the client will be switched to offline mode and the operation data will be saved locally.
[0079] It should be noted that when both the regular gateway domain name line and the backup escape domain name line fail, the network line will not be switched, the client will be switched to offline mode, and the operation data will be saved locally. Once the network line is restored, the operation data will be uploaded and synchronized to the backend server.
[0080] Furthermore, the method also includes:
[0081] A background timer will automatically start after the current network line is switched or the client enters offline mode.
[0082] The background timer is controlled to access the status interface at preset time intervals to test the connection speed of the regular gateway domain name line.
[0083] It should be noted that when a network line is switched or a client enters offline mode, the system will automatically start a background timer to trigger a connection speed test at certain preset intervals, polling the health status of regular gateway domain name lines, that is, intermittently accessing the status interface. Once a regular gateway domain name line is found to be normal, the current network line will be switched back to that line.
[0084] It should be noted that in this embodiment, the preset time can be 5 minutes, and no specific limit is made on the specific value of the preset time.
[0085] It should be noted that when the client enters offline mode, a text bar can be floated above the client's homepage to remind the user, and a modal pop-up can also be set to prevent users from making excessive requests that could lead to a data avalanche, data loss that could confuse users, or repeated login attempts.
[0086] Furthermore, the conventional gateway domain name lines include a first preset number of default CDN three-line domain names and a second preset number of combined gateway domain names; wherein, the combined gateway domain names are formed by arranging and combining multiple operators and multiple data centers.
[0087] It should be noted that in practical applications, operators generally include China Mobile, China Unicom, and China Telecom, and a data center is the address where the server is located. For example, if there are two data centers, combining the operators and data centers will result in six combined gateway domain names; if there are two default CDN three-line domain names, then a total of eight regular gateway domain name lines will be obtained. It should be noted that the first and second preset quantities are settings based on needs, and this example does not impose specific limitations on them.
[0088] Please see Figure 2 , Figure 2 This is a block diagram illustrating a network link degradation device according to an embodiment of the present invention. The network link degradation device 2 includes:
[0089] The request retrieval module 21 is used to retrieve the client's access request;
[0090] The speed test module 22 is used to call the status interface to perform a connection speed test on the current network line based on the access request, and to determine whether the current network line has failed; wherein, the current network line includes the regular gateway domain name line and the backup escape domain name line;
[0091] The status code determination module 23 is used to determine the status code of the status interface if the current network line fails; wherein the status code includes the gateway status code and the HTTP status code.
[0092] The line switching module 24 is used to switch the current network line to the target network line according to the status code.
[0093] Furthermore, the line switching module 24 is specifically used for:
[0094] When the HTTP status code is the first preset error code, a connection speed test is performed on the conventional gateway domain name line, and the current network line is switched to the first target network line;
[0095] When the gateway status code is the second preset error code, a connection speed test is performed on the backup escape domain name line, and the current network line is switched to the second target network line.
[0096] Regarding the network link degradation device 2 in the above embodiments, the specific operation methods of each module have been described in detail in the embodiments of the related methods, and will not be elaborated here.
[0097] Please see Figure 3 , Figure 3 This is a block diagram illustrating a network link degradation device according to an embodiment of the present invention. The network link degradation device 3 includes:
[0098] One or more memories 31, on which executable programs are stored;
[0099] One or more processors 32 are configured to execute the executable program in the memory 31 to implement the steps of any of the methods described above.
[0100] Regarding the network link degradation device 3 in the above embodiments, the specific method by which its processor 32 executes the program in the memory 31 has been described in detail in the embodiments related to the method, and will not be elaborated here.
[0101] It is understood that the same or similar parts in the above embodiments can be referred to each other, and the contents not described in detail in some embodiments can be referred to the same or similar contents in other embodiments.
[0102] It should be noted that in the description of this invention, the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this invention, unless otherwise stated, "a plurality of" or "more" means at least two.
[0103] It should be understood that when an element is referred to as "fixed to" or "set on" another element, it may be directly on the other element or may have an intervening element present at the same time; when an element is referred to as "connected to" another element, it may be directly connected to the other element or may have an intervening element present at the same time. In addition, the term "connected" as used herein may include wireless connections; the word "and / or" as used includes any unit and all combinations of one or more of the associated listed items.
[0104] Any process or method description in the flowchart or otherwise herein can be understood as: representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process, and the scope of preferred embodiments of the invention includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as will be understood by those skilled in the art to which embodiments of the invention pertain.
[0105] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0106] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.
[0107] Furthermore, the functional units in the various embodiments of the present invention can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.
[0108] The storage media mentioned above can be read-only memory, disk, or optical disk, etc.
[0109] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0110] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. A method for network link degradation, characterized in that, include: Obtain the client's access request; The status interface is called to perform a connection speed test on the current network line based on the access request, and to determine whether the current network line is faulty; wherein, the current network line includes the regular gateway domain name line and the backup escape domain name line; If the current network line fails, the status code of the status interface is determined; wherein, the status code includes the gateway status code and the HTTP status code; Based on the status code, switching the current network line to the target network line includes: When the HTTP status code corresponds to a fault in the network operator or a single data center, the status interface is invoked to perform a connection speed test on the regular gateway domain name lines, and the regular gateway domain name line with the fastest response speed is selected as the first target network line; the current network line is then switched to the first target network line. When the gateway status code corresponds to a gateway failure, the status interface is invoked to test the connection speed of the backup escape domain name line, and the backup escape domain name line with the fastest response speed is selected as the second target network line; the current network line is then switched to the second target network line.
2. The method according to claim 1, characterized in that, The method further includes: If both the regular gateway domain name line and the backup escape domain name line are unavailable, the client will be switched to offline mode and the operation data will be saved locally.
3. The method according to claim 2, characterized in that, The method further includes: A background timer will automatically start after the current network line is switched or the client enters offline mode. The background timer is controlled to access the status interface at preset time intervals to test the connection speed of the regular gateway domain name line.
4. The method according to claim 1, characterized in that, The conventional gateway domain name lines include a first preset number of default CDN three-line domain names and a second preset number of combined gateway domain names; wherein, the combined gateway domain names are formed by arranging and combining multiple operators and multiple data centers.
5. A device for network link degradation, characterized in that, include: The request retrieval module is used to retrieve access requests from clients; The speed test module is used to call the status interface to perform a connection speed test on the current network line based on the access request, and to determine whether the current network line has failed; wherein, the current network line includes the regular gateway domain name line and the backup escape domain name line; The status code determination module is used to determine the status code of the status interface if the current network line fails; wherein the status code includes the gateway status code and the HTTP status code; The line switching module is used to switch the current network line to the target network line according to the status code; specifically, when the HTTP status code is the code corresponding to a fault in the network operator or a single data center, it calls the status interface to perform connection speed tests on the regular gateway domain name lines, selects the regular gateway domain name line with the fastest response speed as the first target network line, and switches the current network line to the first target network line. When the gateway status code corresponds to a gateway failure, the status interface is invoked to test the connection speed of the backup escape domain name line, and the backup escape domain name line with the fastest response speed is selected as the second target network line; the current network line is then switched to the second target network line.
6. A device for network link degradation, characterized in that, include: One or more memories on which executable programs are stored; One or more processors are configured to execute the executable program in the memory to implement the steps of the method according to any one of claims 1-4.
Citation Information
Patent Citations
Mobile terminal network domain name switching method, device and equipment
CN115665088A