Link switching method and device, electronic equipment and storage medium

By actively detecting the main link and backup links and automatically switching, the problem of low link switching efficiency in the existing technology is solved, fast and permissionless link switching is achieved, and high service availability is improved.

CN119996298APending Publication Date: 2025-05-13DUXIAOMAN TECH (BEIJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510206900.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-25
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

In the prior art, link handover efficiency is low, and it is necessary to detect whether the backup link is available when an abnormality occurs on the main link, resulting in a long handover time and relying on link configuration permissions, affecting high service availability.

Method used

By responding to the device's link detection request, based on the preset link detection strategy, the main link and the backup link are actively probed to obtain the detection results. When the main link is in an abnormal state and the backup link is in a normal state, the communication link is automatically switched to the backup link.

Benefits of technology

This reduces the time required for link handover, avoids the need to request link configuration permissions, realizes link handover at the application layer, and improves the switching efficiency between the main link and the backup link.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119996298A_ABST
    Figure CN119996298A_ABST
Patent Text Reader

Abstract

The invention provides a link switching method and device, electronic equipment and a storage medium, and relates to the technical field of communication. In the application, link detection is performed on a main link and a standby link between a proxy server and a first device based on a preset link detection strategy in response to a link detection request of the first device, and a first link detection result and a second link detection result are obtained; and when the main link is determined to be in an abnormal state based on the first link detection result and the standby link is determined to be in a normal state based on the second link detection result, switching the communication link between the proxy server and the first device from the main link to the standby link. Therefore, whether the standby link is in the normal state or not does not need to be detected when it is determined that the main link is in the abnormal state, the time needed for link switching is shortened, link switching can be conveniently achieved without requesting for the authority of link configuration, and link switching of the application layer is achieved. Therefore, the link switching efficiency between the main link and the standby link is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a link switching method, device, electronic device and storage medium. Background Art

[0002] In various business scenarios (such as financial business scenarios), any link anomaly may cause certain losses to the target business in the business scenario (such as credit reporting business), and may even cause difficulties in the operation or maintenance of the target business. Therefore, building a high-availability business architecture for the target business is an effective way to ensure high availability of the target business.

[0003] In the related art, the construction of a high-availability architecture for services can usually be achieved through redundant design and switching of links. That is, when an abnormality occurs in the main link in the high-availability architecture for services, the backup link can be used to ensure the normal operation of the target service.

[0004] However, the use of the above-mentioned high-availability service architecture will require a long time for link switching because it is necessary to detect whether the backup link is available when an abnormality occurs in the main link. In addition, since link switching depends on link configuration information, if the link configuration authority is not available, it is necessary to request the authority to configure the link in order to implement link switching. It can be seen that the efficiency of link switching is low when the above-mentioned link switching method is used. Summary of the invention

[0005] Embodiments of the present application provide a link switching method, device, electronic device, and storage medium to improve the switching efficiency of a link.

[0006] In a first aspect, an embodiment of the present application provides a link switching method, the method comprising:

[0007] In response to a link detection request of the first device, based on a preset link detection strategy, link detection is performed on a primary link and a backup link between the proxy server and the first device to obtain a first link detection result of the primary link and a second link detection result of the backup link;

[0008] When it is determined based on the first link detection result that the primary link is in an abnormal state, and based on the second link detection result that the backup link is in a normal state, the communication link between the proxy server and the first device is switched from the primary link to the backup link.

[0009] In an optional embodiment, based on a preset link detection strategy, link detection is performed on a primary link and a backup link between the proxy server and the first device to obtain a first link detection result of the primary link and a second link detection result of the backup link, including:

[0010] According to the link detection cycle included in the link detection strategy, link status detection is performed on the main link and the backup link respectively to obtain multiple first link status codes and multiple second link status codes; wherein each first link status code indicates whether the main link is in a normal state at the corresponding link detection time, and each second link status code indicates whether the backup link is in a normal state at the corresponding link detection time;

[0011] The plurality of first link status codes are used as first link detection results, and the plurality of second link status codes are used as second link status results.

[0012] In an optional embodiment, determining that the primary link is in an abnormal state based on the first link detection result includes:

[0013] Obtaining a first set number of first link status codes from the first link detection result;

[0014] If the first set number of first link status codes includes a second set number of non-target link status codes, it is determined that the main link is in an abnormal state; wherein the non-target link status code indicates that the corresponding link does not have the ability to support the first device to respond to a service processing request initiated by the second device for the target service.

[0015] In an optional embodiment, determining that the standby link is in a normal state based on the second link detection result includes:

[0016] If the multiple second link status codes included in the second link detection result are all target link status codes, it is determined that the standby link is in a normal state; wherein the target link status code indicates that the corresponding link has the ability to support the first device to respond to a service processing request initiated by the second device for the target service.

[0017] In an optional embodiment, the method further includes:

[0018] If the plurality of second link status codes include a non-target link status code, a warning message is generated; the warning message is used to remind the user that the communication link between the first device and the proxy server cannot be switched.

[0019] In an optional embodiment, switching the communication link between the proxy server and the first device from a primary link to a backup link includes:

[0020] Obtaining the link switching strategy associated with the backup link; the link switching strategy includes: multiple emergency processing methods when the main link is in an abnormal state;

[0021] According to the link switching strategy, the communication link is switched from the primary link to the backup link.

[0022] In an optional embodiment, after the communication link between the proxy server and the first device is switched from a primary link to a backup link, the method further includes:

[0023] Performing link state detection on the main link according to the link detection period included in the link detection strategy to obtain a third link detection result of the main link;

[0024] If the third link detection result indicates that the main link recovers from the abnormal state to the normal state, the communication link is switched from the backup link to the main link.

[0025] In a second aspect, an embodiment of the present application further provides a link switching device, the device comprising:

[0026] A link detection module, configured to respond to a link detection request of the first device and perform link detection on a primary link and a backup link between the proxy server and the first device based on a preset link detection strategy, and obtain a first link detection result of the primary link and a second link detection result of the backup link;

[0027] The link switching module is used to switch the communication link between the proxy server and the first device from the main link to the backup link when it is determined based on the first link detection result that the main link is in an abnormal state and based on the second link detection result that the backup link is in a normal state.

[0028] In an optional embodiment, when link detection is performed on the primary link and the backup link between the proxy server and the first device based on a preset link detection strategy to obtain a first link detection result of the primary link and a second link detection result of the backup link, the link detection module is specifically used to:

[0029] According to the link detection cycle included in the link detection strategy, link status detection is performed on the main link and the backup link respectively to obtain multiple first link status codes and multiple second link status codes; wherein each first link status code indicates whether the main link is in a normal state at the corresponding link detection time, and each second link status code indicates whether the backup link is in a normal state at the corresponding link detection time;

[0030] The plurality of first link status codes are used as first link detection results, and the plurality of second link status codes are used as second link status results.

[0031] In an optional embodiment, when it is determined based on the first link detection result that the primary link is in an abnormal state, the link switching module is specifically configured to:

[0032] Obtaining a first set number of first link status codes from the first link detection result;

[0033] If the first set number of first link status codes includes a second set number of non-target link status codes, it is determined that the main link is in an abnormal state; wherein the non-target link status code indicates that the corresponding link does not have the ability to support the first device to respond to a service processing request initiated by the second device for the target service.

[0034] In an optional embodiment, when it is determined based on the second link detection result that the standby link is in a normal state, the link switching module is specifically configured to:

[0035] If the multiple second link status codes included in the second link detection result are all target link status codes, it is determined that the standby link is in a normal state; wherein the target link status code indicates that the corresponding link has the ability to support the first device to respond to a service processing request initiated by the second device for the target service.

[0036] In an optional embodiment, the link switching module is further configured to:

[0037] If the plurality of second link status codes include a non-target link status code, a warning message is generated; the warning message is used to remind the user that the communication link between the first device and the proxy server cannot be switched.

[0038] In an optional embodiment, when the communication link between the proxy server and the first device is switched from a primary link to a backup link, the link switching module is specifically configured to:

[0039] Obtaining the link switching strategy associated with the backup link; the link switching strategy includes: multiple emergency processing methods when the main link is in an abnormal state;

[0040] According to the link switching strategy, the communication link is switched from the primary link to the backup link.

[0041] In an optional embodiment, after the communication link between the proxy server and the first device is switched from a primary link to a backup link, the link switching module is further configured to:

[0042] Performing link state detection on the main link according to the link detection period included in the link detection strategy to obtain a third link detection result of the main link;

[0043] If the third link detection result indicates that the main link recovers from the abnormal state to the normal state, the communication link is switched from the backup link to the main link.

[0044] In a third aspect, an embodiment of the present application further provides an electronic device, including:

[0045] Processor; and

[0046] Memory for storing programs,

[0047] The program includes instructions, and when the instructions are executed by the processor, the processor executes the link switching method as described in the first aspect.

[0048] In a fourth aspect, an embodiment of the present application further provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the link switching method as described in the first aspect.

[0049] In a fifth aspect, the present application provides a computer program product, which, when called by a computer, enables the computer to execute the link switching method steps as described in the first aspect.

[0050] The beneficial effects of this application are as follows:

[0051] In the link switching method provided in the embodiment of the present application, in response to the link detection request of the first device, based on the preset link detection strategy, the main link and the backup link between the proxy server and the first device are detected, and the first link detection result of the main link and the second link detection result of the backup link are obtained; when the main link is determined to be in an abnormal state based on the first link detection result, and the backup link is determined to be in a normal state based on the second link detection result, the communication link between the proxy server and the first device is switched from the main link to the backup link. In this way, the proxy server can actively detect the main link and the backup link between the first device and the proxy server according to the link detection request of the first device and the preset link detection strategy, thereby obtaining the first link detection result of the main link and the second link detection result of the backup link. Therefore, there is no need to detect whether the backup link is in a normal state when it is determined that the main link is in an abnormal state, which reduces the time required for link switching, and link switching can be realized without requesting the permission for link configuration, that is, link switching at the application layer is realized. Therefore, the link switching efficiency between the main link and the backup link is improved.

[0052] In addition, other features and advantages of the present application will be described in the subsequent description, and partly become apparent from the description, or be understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described here are used to provide a further understanding of the present application, constitute a part of the present application, and do not constitute an improper limitation on the present application. In the drawings:

[0054] Figure 1A schematic diagram of an optional system architecture applicable to the embodiments of the present application;

[0055] Figure 2 A schematic diagram of an implementation flow of a link switching method provided in an embodiment of the present application;

[0056] Figure 3 A schematic diagram of an application scenario of communication link transmission provided in an embodiment of the present application;

[0057] Figure 4 A schematic diagram of a specific scenario for determining the link status of a primary link provided in an embodiment of the present application;

[0058] Figure 5 A schematic diagram of a specific scenario of link status determination of a backup link provided in an embodiment of the present application;

[0059] Figure 6 A method based on the embodiment of the present application is provided Figure 2 Schematic diagram of the

[0060] Figure 7 A schematic diagram of the structure of a link switching device provided in an embodiment of the present application;

[0061] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0062] The embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be construed as being limited to the embodiments described herein. Instead, these embodiments are provided to provide a more thorough and complete understanding of the present application. It should be understood that the drawings and embodiments of the present application are only for exemplary purposes and are not intended to limit the scope of protection of the present application.

[0063] It should be understood that the various steps described in the method implementation of the present application can be performed in different orders and / or performed in parallel. In addition, the method implementation may include additional steps and / or omit the steps shown. The scope of the present application is not limited in this respect.

[0064] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions of other terms will be given in the description below. It should be noted that the concepts of "first", "second", etc. mentioned in this application are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0065] It should be noted that the modifications of "one" and "plurality" mentioned in the present application are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0066] The names of the messages or information exchanged between multiple devices in the embodiments of the present application are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0067] Some of the terms used in the embodiments of the present application are explained below to facilitate understanding by those skilled in the art.

[0068] (1) Network dedicated line: referred to as dedicated line, is an independent, dedicated network connection provided for a specific user or organization. It is a dedicated communication channel or link used to connect two or more sites, usually achieved by leasing a dedicated line from an operator. It provides a point-to-point dedicated tunnel for transmitting comprehensive information services such as data and voice, and can bypass the public network to provide a safer, more reliable, and low-latency connection.

[0069] (2) Reverse proxy: This is an application mode of a proxy server, located between the client and the server, receiving and processing requests from the client on behalf of the server. For the client, the proxy server is equivalent to the target server, and there is no need to pay attention to the address of the other end that needs to be accessed.

[0070] (3) Nginx: It is a high-performance hypertext transfer protocol (HTTP) and reverse proxy World Wide Web (Web) server. It takes up few resources (such as memory, central processing unit (CPU), and disk), can handle a large number of requests at one time, and runs very stably.

[0071] (4) Active detection: refers to the detection node actively initiating a detection request to detect the survival status or health status of the detected node.

[0072] (5) Active-active high availability: This means that production systems are deployed in two data centers at different locations and provide services to the outside world. Each system has the ability to take over the business of other data centers within the recovery time objective.

[0073] (6) Service: mainly refers to services for external users (such as consumer-oriented (To consumer, ToC) type), which are deployed in computer hardware media. In a distributed architecture, a complete service is usually composed of multiple modules in the information technology (IT) system, and each module is composed of multiple instances. The classification of services in this article is divided into basic services such as databases, middleware, domain name system (DNS) resolution, etc. that provide business services with operational dependencies, and business services developed by Du Xiaoman to support the operation of business operations.

[0074] (7) Emergency plan: a plan or program prepared in advance to deal with possible emergencies or unexpected events.

[0075] Based on the above-mentioned nouns and related terminology explanations, the design concept of the embodiments of the present application is briefly introduced below:

[0076] For various business scenarios (such as financial business scenarios), any link abnormality may cause certain losses to the target business in the business scenario (such as credit reporting business), and may even cause difficulties in the operation or maintenance of the target business. Therefore, building a high-availability business architecture for the target business is an effective way to ensure high availability of the target business.

[0077] The high-availability architecture of the service is usually achieved through redundant design and switching of links. Among them, the redundant design represents a backup plan or fault-tolerant capability that can be used in the event of a failure. For example, the aforementioned redundant design can be a dual (multi) active link that provides services at the same time. Of course, it can also be a link as the main link (or called the main dedicated line), and when the main link fails, it switches to the backup link (or called the backup dedicated line). The embodiments of the present application are not limited to this.

[0078] Regardless of the type of redundant design, it needs to be used in conjunction with a switching solution. The conventional switching solution includes three steps: perception, decision-making, and execution. The timeliness from the occurrence of a fault to stopping the loss ultimately depends on the sum of the durations of the above three stages.

[0079] However, the use of the above-mentioned high-availability business architecture will require a long time for link switching because it is necessary to detect whether the backup link is available when an abnormality occurs in the main link. For example, due to the limitation of the client's bandwidth, only one link can be used at the same time. Therefore, multiple links between the client and the server are mutually primary and backup. When the main link has problems or fails, it is necessary to manually resend the request to determine whether the backup link is normal, which makes the failure time longer and the impact greater.

[0080] In addition, the existing link switching method relies on changes in network dedicated line configuration (i.e., link configuration information). Cloud vendors usually do not open link configuration permissions to users, which results in the link being in active-standby mode. The affected client service needs to contact the cloud vendor to perform a stop-loss operation. Therefore, the process has many nodes and is very time-consuming, which is far from meeting the needs of business stop-loss scenarios. In addition, in the scenario of active-active high availability, the two links are deployed in two computer rooms respectively, and the availability of business requests is used as a means of judging whether the link is damaged. When the business generates an alarm, it first identifies whether it has the characteristics of the computer room. If it has the characteristics of the computer room, it will switch the traffic at the business traffic entrance and dispatch the traffic of the faulty computer room to the normal computer room. Since the judgment is based on business indicators at this time, the entire process of discovery, switching, and stop-loss also takes a long time.

[0081] In other words, the efficiency of link switching is low when the above-mentioned link switching method is adopted. In view of this, in order to solve or improve the aforementioned problems, an embodiment of the present application provides a link switching method, which may specifically include: in response to a link detection request of the first device, based on a preset link detection strategy, link detection is performed on the main link and the backup link between the proxy server and the first device, and a first link detection result of the main link and a second link detection result of the backup link are obtained; when it is determined based on the first link detection result that the main link is in an abnormal state, and based on the second link detection result that the backup link is in a normal state, the communication link between the proxy server and the first device is switched from the main link to the backup link.

[0082] Based on the above method, the proxy server can actively detect the main link and the backup link between the first device and the proxy server according to the link detection request of the first device and the preset link detection strategy, thereby obtaining the first link detection result of the main link and the second link detection result of the backup link. Therefore, there is no need to detect whether the backup link is in a normal state when it is determined that the main link is in an abnormal state, which reduces the time required for link switching, and link switching can be realized without requesting permission for link configuration, that is, link switching at the application layer is realized. Therefore, the efficiency of link switching is improved.

[0083] In particular, the preferred embodiments of the present application are described below in conjunction with the drawings in the specification. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present application, and are not used to limit the present application, and the embodiments of the present application and the features in the embodiments may be combined with each other if there is no conflict.

[0084] See also Figure 1 As shown, it is a schematic diagram of an optional system architecture applicable to an embodiment of the present application, and the system architecture may include: a first device 101, a proxy server 102, and a second device 103. The proxy server 102 may exchange information with the first device 101 and the second device 103 through a communication network. Among them, the communication mode adopted by the aforementioned communication network may include: a wireless communication mode and a wired communication mode.

[0085] Exemplarily, the proxy server 102 can access the network through cellular mobile communication technology to communicate with the first device 101 and the second device 103. The cellular mobile communication technology, for example, includes the fifth generation mobile communication (5th generation mobile networks, 5G) technology or the next generation mobile communication technology. Optionally, the proxy server 102 can access the network through short-range wireless communication mode to communicate with the first device 101 and the second device 103. The short-range wireless communication mode, for example, includes wireless fidelity (wireless fidelity, Wi-Fi) technology.

[0086] The embodiment of the present application does not impose any restriction on the number of communication devices involved in the above system architecture. For example, the above system architecture may include more first devices or second devices, or may also include other network devices. Figure 1 As shown, only the first device 101, the proxy server 102 and the second device 103 are described as examples, and the above communication devices and their respective functions are briefly introduced below.

[0087] The first device 101 may be a terminal device, that is, may be a device that can provide voice and / or data connectivity to a user, and may be a device that supports wired and / or wireless connection modes.

[0088] Exemplarily, the first device 101 may include, but is not limited to: mobile phones, tablet computers, laptop computers, PDAs, mobile internet devices (MIDs), wearable devices, virtual reality (VR) devices, augmented reality (AR) devices, wireless terminal devices in industrial control, wireless terminal devices in unmanned driving, wireless terminal devices in smart grids, wireless terminal devices in transportation safety, wireless terminal devices in smart cities, or wireless terminal devices in smart homes, etc.

[0089] In addition, a related client may be installed on the first device 101, and the client may be software, for example, an application (APP), a browser, a short video software, etc., or a web page, a mini-program, etc.; it should be noted that the first device 101 in the embodiment of the present application may enable the above-mentioned client related to link switching to send a link detection request to the proxy server 102, so as to perform subsequent method steps such as link switching.

[0090] The proxy server 102 can provide a special network service that allows a network terminal (such as the first device 101 or the client) to establish an indirect connection with another network terminal (such as the second device 103 or the server), thereby protecting the privacy or security of the network terminal and preventing the network terminal from being attacked.

[0091] The proxy server 102 usually has forward proxy capability and / or reverse proxy capability. Among them, there are the following differences between forward proxy and directional proxy: 1. Functionally: forward proxy is a solution when the client cannot or is inconvenient to directly access the server; while reverse proxy is a solution for multiple servers to provide services to the outside in a unified manner. 2. From the perspective of target customers: the client of the forward proxy is the client, that is, the proxy server 102 provides services to the client at this time; and the client of the reverse proxy is the server, that is, the proxy server 102 provides services to the server at this time. 3. From the perspective of visibility: the forward proxy is visible to the client, which is the result of the client's active selection (that is, the server can only choose passively), and the client can choose to access directly or through the proxy; while the reverse proxy is invisible to the client, which is the result of the client's passive selection (that is, the result of the server's active selection), and the client does not know whether the service currently accessed uses a reverse proxy.

[0092] It is worth noting that the proxy server 102 in the embodiment of the present application can respond to the link detection request of the first device 101, and perform link detection on the main link and the backup link between the proxy server 102 and the first device 101 based on a preset link detection strategy, and obtain a first link detection result of the main link and a second link detection result of the backup link, so that when it is determined based on the first link detection result that the main link is in an abnormal state, and based on the second link detection result that the backup link is in a normal state, the communication link between the proxy server 102 and the first device 101 is switched from the main link to the backup link.

[0093] The second device 103 can be a server, that is, it can be an independent physical server, or it can be a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as big data and artificial intelligence platforms.

[0094] For example, the second device 103 in the embodiment of the present application may have the capability to initiate a business processing request to the first device 101 for a target business (eg, credit data acquisition) in a target business scenario (eg, a single computer room credit query scenario).

[0095] The link switching method provided by the exemplary embodiment of the present application is described below in combination with the above-mentioned system architecture and with reference to the accompanying drawings. It should be noted that the above-mentioned system architecture is only shown to facilitate understanding of the spirit and principles of the present application, and the implementation of the present application is not limited in this respect.

[0096] See also Figure 2 As shown, it is a schematic diagram of an implementation process of a link switching method provided in an embodiment of the present application. The execution subject takes a proxy server as an example. The specific implementation process of the method is as follows:

[0097] S201: In response to a link detection request of the first device, based on a preset link detection strategy, link detection is performed on a primary link and a backup link between the proxy server and the first device to obtain a first link detection result of the primary link and a second link detection result of the backup link.

[0098] Taking the first device as a client (e.g., XX Bank) and the proxy server as a reverse proxy server (e.g., Nignx) as an example, the link detection request of the first device can be an active detection request for the primary link and the backup link continuously sent by the client to the server (or reverse proxy server). Figure 3As shown, the second device (i.e., the server) can initiate a business data acquisition request to the client (e.g., XX Bank) for the target business (e.g., business service 1 or business service 2) through the reverse proxy (e.g., reverse proxy 1 or reverse proxy 2) deployed by the reverse proxy server Nignx, as well as line A and line B. Assuming that the aforementioned target business is a credit investigation business, the aforementioned business data acquisition request can be a request for obtaining credit investigation data.

[0099] like Figure 3 As shown, the configuration association between the business service in the server (eg, an Internet data center (IDC)) and the reverse proxy in the reverse proxy server and the client can be many-to-one.

[0100] For example, reverse proxy 1 and reverse proxy 2 deployed on the reverse proxy server can both use line A (such as China Unicom line) as the main link between the reverse proxy server and the client, and use line B (such as China Telecom line) as the backup link between the reverse proxy server and the client.

[0101] It is understandable that when a client accesses the reverse proxy deployed in the reverse proxy server, the client's access request will be sent to the reverse proxy server through the main link by default. Usually, the client's access request will be sent to the reverse proxy server through the backup link only when the main link fails or the communication link is actively switched from the main link to the backup link.

[0102] It should also be noted that the number of reverse proxies deployed in the reverse proxy server can be consistent with the number of dedicated lines (i.e., the number of links). Figure 3 As shown, there are two communication links (i.e., a main link and a backup link) between the client and the reverse proxy server. Then, two reverse proxies (i.e., reverse proxy 1 and reverse proxy 2) are deployed in the reverse proxy server.

[0103] The above-mentioned preset link detection strategy can be an upstream configuration file set in the reverse proxy layer (or each reverse proxy in the reverse proxy server). Specifically, the above-mentioned preset link detection strategy may include: the link detection period (e.g., 5 seconds) of the reverse proxy for the communication link (i.e., the main link and the backup link) between the first device (e.g., the client) and the proxy server (e.g., the reverse proxy), and the specific detection content (e.g., signal-to-noise ratio) of the reverse proxy for the communication link between the first device and the proxy server. The embodiments of the present application do not make specific limitations on this.

[0104] Optionally, the above-mentioned preset link detection strategy may also include: a judgment strategy for judging whether the communication link is in a normal state or an abnormal state according to the link detection result of the communication link.

[0105] Since the link status code can accurately reflect whether the communication link is in a normal state or an abnormal state, in an optional implementation, when executing step S201, the proxy server can perform link status detection on the primary link and the backup link respectively according to the link detection period (e.g., 5 seconds) included in the preset link detection strategy, and obtain multiple first link status codes and multiple second link status codes, thereby using the multiple first link status codes as the first link detection results, and using the multiple second link status codes as the second link status results.

[0106] Each first link status code may indicate whether the primary link is in a normal state at the corresponding link detection time, and each second link status code may indicate whether the backup link is in a normal state at the corresponding link detection time.

[0107] Based on the above method, by identifying multiple first link status codes included in the first link detection result and the second link status code included in the second link detection result, it is possible to quickly determine whether the main link between the first device and the proxy server is in an abnormal state and whether the backup link between the first device and the proxy server is in a normal state.

[0108] Optionally, the first link status result and the second link status result may also include information such as relevant abnormal data when the corresponding link is in an abnormal state, and this information may be used to analyze the abnormal cause of the subsequent link. Of course, the first link status result and the second link status result may also include other information, which is not limited in the embodiments of the present application.

[0109] S202: When it is determined based on the first link detection result that the primary link is in an abnormal state, and when it is determined based on the second link detection result that the backup link is in a normal state, the communication link between the proxy server and the first device is switched from the primary link to the backup link.

[0110] In an optional implementation, when executing step S202, the proxy server can obtain a first set number of first link status codes from the first link detection result; if the first set number of first link status codes includes a second set number of non-target link status codes, it can be determined that the main link is in an abnormal state. Among them, the non-target link status code can represent: the corresponding link does not have the ability to support the first device to respond to the service processing request initiated by the second device for the target service. Exemplarily, the aforementioned non-target link status code can be a non-200 status code (for example, status code 400 or status code 403, etc.), and the embodiment of the present application does not limit the specific type of the non-target link status code.

[0111] Optionally, the proxy server may obtain a first set number of first link status codes of a continuous link detection time from the first link detection result. Of course, the proxy server may also randomly obtain a first set number of first link status codes from the first link detection result, which is not specifically limited in the embodiment of the present application.

[0112] See also Figure 4 As shown, it is a schematic diagram of a specific scenario of link status determination of a main link provided by an embodiment of the present application. Assuming that the above-mentioned first set number is 3 and the above-mentioned second set number is 2, the proxy server can obtain 3 first link status codes from the first link detection result of the main link. If the 3 first link status codes include 2 non-target link status codes, the proxy server can determine that the main link is in an abnormal state. It should be understood that if the 3 first link status codes include 3 non-target link status codes, the proxy server can still determine that the main link is in an abnormal state.

[0113] On the contrary, if the three first link status codes include only one non-target link status code or do not include a non-target status code, the proxy server may determine that the primary link is in a normal state.

[0114] In other words, if the number of non-target link status codes in the first set number of first link status codes is greater than or equal to the second set number, it can be determined that the main link is in an abnormal state. Conversely, if the number of non-target link status codes in the first set number of first link status codes is less than the second set number, it can be determined that the main link is in a normal state.

[0115] In an optional implementation, when executing step S202, if the multiple second link status codes included in the second link detection result are all target link status codes, the proxy server can determine that the backup link is in a normal state. Among them, the target link status code can represent: the corresponding link has the ability to support the first device to respond to the service processing request initiated by the second device for the target service. Exemplarily, the aforementioned target link status code can be status code 200.

[0116] See also Figure 5 As shown, it is a schematic diagram of a specific scenario of link status determination of a backup link provided by an embodiment of the present application. Assume that the second link detection result includes 5 second link status codes. If the 5 second link status codes are all target link status codes (e.g., status code 200), the proxy server can determine that the backup link is in a normal state, that is, when the main link is in an abnormal state, the communication link between the proxy server and the first device can be switched from the main link to the backup link.

[0117] Based on the above approach, when the primary link is in an abnormal state, if the backup link is in a normal state, the communication line between the proxy server and the first device can be switched from the primary link to the backup link to reduce the impact of the link abnormality.

[0118] Optionally, if the multiple second link status codes include a non-target link status code, the proxy server can determine that the backup link is in an abnormal state and generate a warning message. The warning message can be used to remind the user that the communication link between the first device and the proxy server cannot be switched. That is, the warning message can indicate that both the main link and the backup link are in an abnormal state. In response to the situation where the loss cannot be stopped in time through link switching, the user is notified in time to reduce the impact of the link abnormality.

[0119] Still Figure 5 As shown, if the five second link status codes include one non-target link status code (e.g., status code 401), the proxy server can determine that the backup link is in an abnormal state. At this time, it can be determined that both lines (i.e., the main link and the backup link) are faulty (i.e., in an abnormal state), and the impact of the link abnormality cannot be reduced by link switching.

[0120] Furthermore, when the proxy server determines that the main link is in an abnormal state based on the first link detection result and determines that the backup link is in a normal state based on the second link detection result, the proxy server can switch the communication link between the proxy server and the first device from the main link to the backup link. Optionally, the proxy server can obtain a link switching strategy associated with the backup link, thereby switching the communication link from the main link to the backup link according to the link switching strategy. The aforementioned link switching strategy may include: a variety of emergency processing methods when the main link is in an abnormal state.

[0121] Exemplarily, the above-mentioned link switching strategy can also be called a plan. Of course, it can also have other names, which are not specifically limited in the embodiments of the present application. The above-mentioned multiple emergency processing methods may include: temporary data storage method and communication link interruption method when the main link is abnormal, etc., which are not specifically limited in the embodiments of the present application.

[0122] It can be seen that in the case where the loss can be stopped by link switching, once the proxy server determines that the main link is abnormal and the backup link is abnormal, it can call the link switching policy set for the backup link to achieve the communication link between the proxy server and the first device. It is quickly and accurately switched from the main link to the backup link to reduce the impact of the main link abnormality.

[0123] Based on the method steps described in S201 to S202 above, refer to Figure 6As shown, the proxy server may include: a fault perception module, a fault decision module and a fault execution module. Among them, the fault perception module can be used to detect or collect the link status of the main link in real time, obtain the first link detection result, and send the first link detection result to the fault decision module when it is determined that the main link is in an abnormal state (or fails). Optionally, the fault perception module can not only alarm when a fault occurs, but also give an early warning, for example, predict the time when the main link fails.

[0124] After receiving the first link detection result, the fault decision module can determine whether the loss can be stopped by link switching (i.e. switching from the main link to the backup link) based on the first link detection result and the second link detection result of the backup link, thereby making a stop loss decision. The stop loss decision corresponds to the two situations of link switching being possible and link switching being impossible.

[0125] The fault execution module can be used to call the link switching strategy associated with the backup link to stop the loss when the loss can be stopped by link switching, and to generate a warning message that can be used to remind the user that the communication link between the first device and the proxy server cannot be switched when the loss cannot be stopped by link switching.

[0126] It can be seen that the current problems of low efficiency and long time consumption in link abnormality discovery, positioning and loss control are solved. The embodiment of the present application realizes automatic discovery, positioning and loss control of dual-active link abnormalities through automatic link loss control based on reverse proxy detection, improves fault handling efficiency, reduces fault duration, reduces the impact of link abnormalities on business availability and system use, and improves overall system availability. Among them, a reverse proxy is added to the physical layer, and active detection is continuously used before the fault occurs to ensure that abnormalities can be discovered in time when the link fails. Decouple the complex network dedicated line configuration change operation and permission control (i.e. link configuration permission), without relying on network dedicated line configuration changes and without manual intervention, automatic switching through the application layer plan effectively improves the loss control efficiency of the entire credit link failure.

[0127] It should be noted that the three modules (i.e., fault perception module, fault decision module, and fault execution module) included in the proxy server may also have other names. For example, the above-mentioned fault perception module may also be referred to as an information collection module, which is not specifically limited in the embodiments of the present application.

[0128] In an optional implementation, after the proxy server switches the communication link between the proxy server and the first device from the main link to the backup link, the proxy server can also perform link status detection on the main link according to the link detection cycle included in the link detection strategy to obtain a third link detection result of the main link. If the third link detection result indicates that the main link has recovered from an abnormal state to a normal state, the proxy server can switch the communication link from the backup link to the main link. In this way, after executing the stop-loss operation of the link switching, the proxy server can continue to actively detect the main link (or actively detect live), identify whether the main link has returned to normal, and actively switch back the link when the main link returns to normal.

[0129] On the contrary, if the third link detection result indicates that the main link has not recovered from the abnormal state to the normal state (ie, the main link is still in the abnormal state), it can be determined that the communication link between the proxy server and the first device is still using the backup link.

[0130] In summary, in the link switching method provided in the embodiment of the present application, the proxy server can actively detect the main link and the backup link between the first device and the proxy server according to the link detection request of the first device and the preset link detection strategy, thereby obtaining the first link detection result of the main link and the second link detection result of the backup link. Therefore, there is no need to detect whether the backup link is in a normal state when it is determined that the main link is in an abnormal state, which reduces the time required for link switching, and link switching can be realized without requesting permission for link configuration, that is, link switching at the application layer is realized. Therefore, the link switching efficiency between the main link and the backup link is improved.

[0131] Further, based on the same technical concept, the embodiment of the present application provides a link switching device, which is used to implement the above method flow of the embodiment of the present application. Figure 7 As shown, the link switching device 700 may include: a link detection module 701 and a link switching module 702, wherein:

[0132] The link detection module 701 is used to respond to the link detection request of the first device and perform link detection on the primary link and the backup link between the proxy server and the first device based on a preset link detection strategy to obtain a first link detection result of the primary link and a second link detection result of the backup link;

[0133] The link switching module 702 is used to switch the communication link between the proxy server and the first device from the main link to the backup link when it is determined based on the first link detection result that the main link is in an abnormal state and based on the second link detection result that the backup link is in a normal state.

[0134] In an optional embodiment, when link detection is performed on the primary link and the backup link between the proxy server and the first device based on a preset link detection strategy to obtain a first link detection result of the primary link and a second link detection result of the backup link, the link detection module 701 is specifically used to:

[0135] According to the link detection cycle included in the link detection strategy, link status detection is performed on the main link and the backup link respectively to obtain multiple first link status codes and multiple second link status codes; wherein each first link status code indicates whether the main link is in a normal state at the corresponding link detection time, and each second link status code indicates whether the backup link is in a normal state at the corresponding link detection time;

[0136] The plurality of first link status codes are used as first link detection results, and the plurality of second link status codes are used as second link status results.

[0137] In an optional embodiment, when it is determined based on the first link detection result that the primary link is in an abnormal state, the link switching module 702 is specifically configured to:

[0138] Obtaining a first set number of first link status codes from the first link detection result;

[0139] If the first set number of first link status codes includes a second set number of non-target link status codes, it is determined that the main link is in an abnormal state; wherein the non-target link status code indicates that the corresponding link does not have the ability to support the first device to respond to a service processing request initiated by the second device for the target service.

[0140] In an optional embodiment, when it is determined based on the second link detection result that the standby link is in a normal state, the link switching module 702 is specifically configured to:

[0141] If the multiple second link status codes included in the second link detection result are all target link status codes, it is determined that the standby link is in a normal state; wherein the target link status code indicates that the corresponding link has the ability to support the first device to respond to a service processing request initiated by the second device for the target service.

[0142] In an optional embodiment, the link switching module 702 is further configured to:

[0143] If the plurality of second link status codes include a non-target link status code, a warning message is generated; the warning message is used to remind the user that the communication link between the first device and the proxy server cannot be switched.

[0144] In an optional embodiment, when the communication link between the proxy server and the first device is switched from a primary link to a backup link, the link switching module 702 is specifically configured to:

[0145] Obtaining the link switching strategy associated with the backup link; the link switching strategy includes: multiple emergency processing methods when the main link is in an abnormal state;

[0146] According to the link switching strategy, the communication link is switched from the primary link to the backup link.

[0147] In an optional embodiment, after the communication link between the proxy server and the first device is switched from the primary link to the backup link, the link switching module 702 is further configured to:

[0148] Performing link state detection on the main link according to the link detection period included in the link detection strategy to obtain a third link detection result of the main link;

[0149] If the third link detection result indicates that the main link recovers from the abnormal state to the normal state, the communication link is switched from the backup link to the main link.

[0150] Based on the description of the above method embodiment and device embodiment, the exemplary embodiment of the present invention further provides an electronic device, including: at least one processor; and a memory connected to the at least one processor in communication. The memory stores a computer program that can be executed by the at least one processor, and the computer program is used to enable the electronic device to perform the method according to the embodiment of the present invention when executed by the at least one processor.

[0151] An embodiment of the present application also provides a non-transitory computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to execute a method according to an embodiment of the present application.

[0152] An embodiment of the present application also provides a computer program product, including a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to execute a method according to an embodiment of the present application.

[0153] See also Figure 8 As shown, the structured block diagram of the electronic device 800 that can be used as the server or client of the present application will now be described, which is an example of the hardware device that can be applied to various aspects of the present application. The electronic device is intended to represent the computer device of various forms of digital electronics, such as, laptop computers, desktop computers, workbenches, 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 only used as examples, and are not intended to limit the implementation of the present application described herein and / or required.

[0154] like Figure 8 As shown, the electronic 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.

[0155] A plurality of components in the electronic device 800 are connected to the I / O interface 805, including: an input unit 806, an output unit 807, a storage unit 808, and a communication unit 809. The input unit 806 may be any type of device capable of inputting information to the electronic device 800, and the input unit 806 may receive input digital or character information, and generate key signal inputs related to user settings and / or function control of the electronic device. The output unit 807 may be any type of device capable of presenting information, and may include but is not limited to a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 808 may include but is not limited to a disk, an optical disk. The communication unit 809 allows the electronic device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and may include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth device, a WiFi device, a worldwide interoperability for microwave access (WiMax) device, a cellular communication device, and / or the like.

[0156] 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 CPU, a graphics processing unit (GPU), various artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 801 performs the various methods and processes described above. For example, in some embodiments, the link switching method described above may be implemented as a computer software program, which is tangibly included 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 electronic device 800 via the ROM 802 and / or the communication unit 809. In some embodiments, the computing unit 801 may be configured to perform the link switching method described above in any other appropriate manner (e.g., by means of firmware).

[0157] The program code for implementing the method of the present application can be written in any combination of one or more programming languages. These program codes can 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, implements the functions / operations specified in the flow chart and / or block diagram. The program code can 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.

[0158] In the context of the present application, 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 equipment, 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 RAM, a ROM, an erasable programmable read-only memory (EPROM) or a flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0159] As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and / or device (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.

[0160] 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 cathode ray tub (CRT) or a liquid crystal display (LCD) 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).

[0161] The systems and techniques described herein can 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 can 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.

[0162] A computer system may include clients and servers. Clients and servers 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 to each other.

[0163] Furthermore, it should be understood that what is disclosed above is only a preferred embodiment of the present application, and certainly cannot be used to limit the scope of rights of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope covered by the present application.

Claims

1. A link switching method, characterized in that: Applicable to proxy servers, including: In response to a link detection request of the first device, based on a preset link detection strategy, link detection is performed on a primary link and a backup link between the proxy server and the first device to obtain a first link detection result of the primary link and a second link detection result of the backup link; When it is determined based on the first link detection result that the primary link is in an abnormal state, and when it is determined based on the second link detection result that the backup link is in a normal state, the communication link between the proxy server and the first device is switched from the primary link to the backup link.

2. The method according to claim 1, characterized in that The performing link detection on the primary link and the backup link between the proxy server and the first device based on the preset link detection strategy to obtain a first link detection result of the primary link and a second link detection result of the backup link includes: According to the link detection period included in the link detection strategy, link status detection is performed on the main link and the backup link respectively to obtain multiple first link status codes and multiple second link status codes; wherein each first link status code indicates whether the main link is in the normal state at the corresponding link detection time, and each second link status code indicates whether the backup link is in the normal state at the corresponding link detection time; The multiple first link status codes are used as the first link detection results, and the multiple second link status codes are used as the second link status results.

3. The method according to claim 1, characterized in that The determining, based on the first link detection result, that the primary link is in an abnormal state includes: Acquire a first set number of first link status codes from the first link detection result; If the first set number of first link status codes includes a second set number of non-target link status codes, it is determined that the main link is in the abnormal state; wherein the non-target link status code indicates that the corresponding link does not have the ability to support the first device to respond to the service processing request initiated by the second device for the target service.

4. The method according to any one of claims 1 to 3, characterized in that The determining, based on the second link detection result, that the standby link is in a normal state includes: If the multiple second link status codes included in the second link detection result are all target link status codes, it is determined that the backup link is in the normal state; wherein, the target link status code indicates that the corresponding link has the ability to support the first device to respond to the service processing request initiated by the second device for the target service.

5. The method according to claim 4, characterized in that The method further comprises: If the plurality of second link status codes include a non-target link status code, a warning message is generated; the warning message is used to remind the user that the communication link between the first device and the proxy server cannot be switched.

6. The method according to any one of claims 1 to 3, characterized in that The switching of the communication link between the proxy server and the first device from the primary link to the backup link includes: Acquire a link switching strategy associated with the backup link; the link switching strategy includes: multiple emergency processing methods when the main link is in the abnormal state; According to the link switching strategy, the communication link is switched from the primary link to the backup link.

7. The method according to any one of claims 1 to 3, characterized in that After the communication link between the proxy server and the first device is switched from the primary link to the backup link, the method further includes: Performing link state detection on the main link according to the link detection period included in the link detection strategy to obtain a third link detection result of the main link; If the third link detection result indicates that the main link has recovered from the abnormal state to the normal state, the communication link is switched from the backup link to the main link.

8. A link switching device, characterized in that: Applicable to proxy servers, including: a link detection module, configured to respond to a link detection request of the first device and, based on a preset link detection strategy, perform link detection on a primary link and a backup link between the proxy server and the first device, and obtain a first link detection result of the primary link and a second link detection result of the backup link; A link switching module is used to switch the communication link between the proxy server and the first device from the main link to the backup link when it is determined that the main link is in an abnormal state based on the first link detection result and the backup link is in a normal state based on the second link detection result.

9. An electronic device, comprising: processor; as well as Memory for storing programs, The program includes instructions, which, when executed by the processor, cause the processor to perform the method according to any one of claims 1 to 7.

10. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 7.