Application service cluster switching method and apparatus, computer device, readable storage medium and program product
By diverting application service traffic to a two-stage service cluster for processing and gradually switching components when there are no anomalies in the response process of each stage, the stability problem during service cluster switching is solved, and a smooth service cluster switching is achieved.
Patent Information
- Application Number
- CN202411380296.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2044-09-30
AI Technical Summary
When switching service clusters, anomalies in the new service cluster can easily lead to application service crashes and poor system stability.
A two-stage gradual switching method is adopted, which divides the application service traffic into two parts. One part is processed through the first service cluster, and the other part is processed through the second service cluster. Components are gradually switched when there are no abnormalities in the response process at each stage, until the switch is completely completed to the second service cluster.
Even if the application service response process encounters an anomaly in the second service cluster, it will not cause the entire application service to crash, thus improving system stability during service cluster switching.
Smart Images

Figure CN119420814B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to an application service cluster switching method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Technology
[0002] With the development of data processing technology, service cluster switching is usually required when updating services.
[0003] In traditional technology, a new service cluster is usually prepared first. After the new service cluster goes online, the traffic of the old service cluster is diverted to the new service cluster to complete the service cluster switch.
[0004] However, during service cluster switching, if the new service cluster encounters an anomaly, it can easily lead to the collapse of application services. Therefore, the system stability during service cluster switching is currently poor. Summary of the Invention
[0005] Therefore, it is necessary to provide an application service cluster switching method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can improve system stability during service cluster switching, in order to address the above-mentioned technical problems.
[0006] Firstly, this application provides an application service cluster switching method that gradually switches application service traffic from a first service cluster to a second service cluster in two stages. Compared to directly switching all traffic from the first service cluster to the second service cluster, even if the application service process encounters an anomaly, it will not cause the entire application service to crash, thus improving system stability during application service cluster switching. The method includes:
[0007] Traffic splitting steps: Switch the online component from the first service component to the intermediate component; obtain application service traffic through the online component, and divide the application service traffic into a first part of traffic and a second part of traffic; split the first part of traffic to the first service cluster and the second part of traffic to the second service cluster through the intermediate component, and execute the application service response process corresponding to the application service traffic;
[0008] If the application service response process executes without error, the online application service cluster is switched from the first service cluster to the second service cluster by switching the online component from the intermediate component to the second service component.
[0009] In one embodiment, the application service response process includes a first-phase response process and a second-phase response process; the intermediate component includes a first intermediate component and a second intermediate component; the traffic splitting step includes:
[0010] Switch the online component from the first service component to the first intermediate component;
[0011] The application service traffic obtained by the first intermediate component is divided into a first part of traffic and a second part of traffic. The first part of traffic is diverted to the first service cluster and the second part of traffic is diverted to the second service cluster through the first intermediate component, and the first phase response process of the application service traffic is executed.
[0012] If the first phase response process executes without error, the online component is switched from the first intermediate component to the second intermediate component, and the application service traffic obtained by the second intermediate component is divided into a third part of traffic and a fourth part of traffic.
[0013] The second intermediate component diverts the third portion of traffic to the first service cluster and the fourth portion of traffic to the second service cluster, thereby executing the second phase response process for the application service traffic.
[0014] In one embodiment, the fourth portion of traffic accounts for a greater proportion of the application service traffic than the second portion of traffic accounts for a greater proportion of the application service traffic; the third portion of traffic accounts for a smaller proportion of the application service traffic than the first portion of traffic accounts for a smaller proportion of the application service traffic.
[0015] In one embodiment, the method further includes:
[0016] If the first phase response process fails, the second service cluster registered with the first intermediate component will be suspended or deregistered.
[0017] If the second-stage response process fails, the online component will be switched from the second intermediate component to the first service component.
[0018] In one embodiment, the application service response process includes multiple phased response processes, and the intermediate component includes multiple phased intermediate components; the traffic splitting step includes:
[0019] Component switching steps: Switch the online component to a stage intermediate component;
[0020] Phased traffic splitting steps: According to the preset traffic weight information corresponding to the phase intermediate component, the application service traffic obtained by the phase intermediate component is divided into a first part of traffic and a second part of traffic, and the first part of traffic is split to the first service cluster, and the second part of traffic is split to the second service cluster, and the phased response process of the application service traffic is executed.
[0021] If the phase response process executes without error, then return to the component switching step until all phase response processes have been completed or any of the phase response processes execute abnormally.
[0022] Wherein, the proportion of the second part of traffic in the application service traffic during the Nth execution of the stage traffic splitting step is greater than the proportion of the second part of traffic in the application service traffic during the (N-1)th execution of the stage traffic splitting step; during the first execution of the stage traffic splitting step, the online component is switched from the first service component to the stage intermediate component; during the second to Nth executions of the stage traffic splitting step, the online component switches between each stage intermediate component, where N is a positive integer greater than 1.
[0023] In one embodiment, the step of dividing the application service traffic into a first part of traffic and a second part of traffic includes:
[0024] Obtain the first server address of the first service cluster and the second server address of the second service cluster;
[0025] According to preset traffic weighting information, the first server address and the second server address are allocated to the application service traffic;
[0026] The application service traffic assigned to the first server address is defined as the first part of the traffic, and the application service traffic assigned to the second server address is defined as the second part of the traffic.
[0027] Secondly, this application also provides an application service cluster switching device, applied to an application service system, the application service system including a first service component, an intermediate component, a second service component, a first service cluster, and a second service cluster, wherein the first service component is used to register the cluster server of the first service cluster, the intermediate component is used to register the cluster server of the first service cluster and the cluster server of the second service cluster, and the second service component is used to register the cluster server of the second service cluster; the device includes:
[0028] The traffic splitting module is used to perform the following traffic splitting steps: switching the online component from the first service component to the intermediate component; obtaining application service traffic through the online component and splitting the application service traffic into a first part of traffic and a second part of traffic; splitting the first part of traffic to the first service cluster and the second part of traffic to the second service cluster through the intermediate component, and executing the application service response process corresponding to the application service traffic.
[0029] The switching module is used to switch the online application service cluster from the first service cluster to the second service cluster if the application service response process executes without any abnormalities, by switching the online component from the intermediate component to the second service component.
[0030] In one embodiment, the application service response process includes a first-phase response process and a second-phase response process; the intermediate component includes a first intermediate component and a second intermediate component; the traffic splitting module is further configured to:
[0031] Switch the online component from the first service component to the first intermediate component;
[0032] The application service traffic obtained by the first intermediate component is divided into a first part of traffic and a second part of traffic. The first part of traffic is diverted to the first service cluster and the second part of traffic is diverted to the second service cluster through the first intermediate component, and the first phase response process of the application service traffic is executed.
[0033] If the first phase response process executes without error, the online component is switched from the first intermediate component to the second intermediate component, and the application service traffic obtained by the second intermediate component is divided into a third part of traffic and a fourth part of traffic.
[0034] The second intermediate component diverts the third portion of traffic to the first service cluster and the fourth portion of traffic to the second service cluster, thereby executing the second phase response process for the application service traffic.
[0035] In one embodiment, the fourth portion of traffic accounts for a greater proportion of the application service traffic than the second portion of traffic accounts for a greater proportion of the application service traffic; the third portion of traffic accounts for a smaller proportion of the application service traffic than the first portion of traffic accounts for a smaller proportion of the application service traffic.
[0036] In one embodiment, the device further includes:
[0037] The service exception execution module is used to suspend or deregister the cluster server of the second service cluster registered in the first intermediate component if the first phase response process fails to execute; and to switch the online component from the second intermediate component to the first service component if the second phase response process fails to execute.
[0038] In one embodiment, the application service response process includes multiple phased response processes, and the intermediate component includes multiple phased intermediate components; the traffic splitting module is further configured to:
[0039] Component switching steps: Switch the online component to a stage intermediate component;
[0040] Phased traffic splitting steps: According to the preset traffic weight information corresponding to the phase intermediate component, the application service traffic obtained by the phase intermediate component is divided into a first part of traffic and a second part of traffic, and the first part of traffic is split to the first service cluster, and the second part of traffic is split to the second service cluster, and the phased response process of the application service traffic is executed.
[0041] If the phase response process executes without error, then return to the component switching step until all phase response processes have been completed or any of the phase response processes execute abnormally.
[0042] Wherein, the proportion of the second part of traffic in the application service traffic during the Nth execution of the stage traffic splitting step is greater than the proportion of the second part of traffic in the application service traffic during the (N-1)th execution of the stage traffic splitting step; during the first execution of the stage traffic splitting step, the online component is switched from the first service component to the stage intermediate component; during the second to Nth executions of the stage traffic splitting step, the online component switches between each stage intermediate component, where N is a positive integer greater than 1.
[0043] In one embodiment, the traffic splitting module is further configured to:
[0044] Obtain the first server address of the first service cluster and the second server address of the second service cluster;
[0045] According to preset traffic weighting information, the first server address and the second server address are allocated to the application service traffic;
[0046] The application service traffic assigned to the first server address is defined as the first part of the traffic, and the application service traffic assigned to the second server address is defined as the second part of the traffic.
[0047] Thirdly, this application also provides a computer device applied to an application service system. The application service system includes a first service component, an intermediate component, a second service component, a first service cluster, and a second service cluster. The first service component is used to register the cluster server of the first service cluster. The intermediate component is used to register the cluster server of the first service cluster and the cluster server of the second service cluster. The second service component is used to register the cluster server of the second service cluster. The computer device includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the following steps:
[0048] Traffic splitting steps: Switch the online component from the first service component to the intermediate component; obtain application service traffic through the online component and divide the application service traffic into a first part of traffic and a second part of traffic; split the first part of traffic to the first service cluster and the second part of traffic to the second service cluster through the intermediate component, and execute the application service response process corresponding to the application service traffic; if the application service response process executes without error, switch the online component from the intermediate component to the second service component and switch the online application service cluster from the first service cluster to the second service cluster.
[0049] Fourthly, this application also provides a computer-readable storage medium for use in an application service system. The application service system includes a first service component, an intermediate component, a second service component, a first service cluster, and a second service cluster. The first service component is used to register the cluster servers of the first service cluster. The intermediate component is used to register the cluster servers of the first service cluster and the second service cluster. The second service component is used to register the cluster servers of the second service cluster. The computer-readable storage medium stores a computer program, which, when executed by a processor, performs the following steps:
[0050] Traffic splitting steps: Switch the online component from the first service component to the intermediate component; obtain application service traffic through the online component and divide the application service traffic into a first part of traffic and a second part of traffic; split the first part of traffic to the first service cluster and the second part of traffic to the second service cluster through the intermediate component, and execute the application service response process corresponding to the application service traffic; if the application service response process executes without error, switch the online component from the intermediate component to the second service component and switch the online application service cluster from the first service cluster to the second service cluster.
[0051] Fifthly, this application also provides a computer program product applied to an application service system, the application service system including a first service component, an intermediate component, a second service component, a first service cluster, and a second service cluster, wherein the first service component is used to register the cluster server of the first service cluster, the intermediate component is used to register the cluster server of the first service cluster and the cluster server of the second service cluster, the second service component is used to register the cluster server of the second service cluster, and the computer program product includes a computer program that, when executed by a processor, performs the following steps:
[0052] Traffic splitting steps: Switch the online component from the first service component to the intermediate component; obtain application service traffic through the online component and divide the application service traffic into a first part of traffic and a second part of traffic; split the first part of traffic to the first service cluster and the second part of traffic to the second service cluster through the intermediate component, and execute the application service response process corresponding to the application service traffic; if the application service response process executes without error, switch the online component from the intermediate component to the second service component and switch the online application service cluster from the first service cluster to the second service cluster.
[0053] The aforementioned application service cluster switching method, apparatus, computer equipment, computer-readable storage medium, and computer program product are applied to an application service system. This application service system comprises a first service component, an intermediate component, a second service component, a first service cluster, and a second service cluster. The first service component registers the cluster servers of the first service cluster, the intermediate component registers the cluster servers of the first and second service clusters, and the second service component registers the cluster servers of the second service cluster. Thus, when switching application services in the application service system, the online component is first switched from the first service component to the intermediate component. After obtaining application service traffic, the intermediate component then switches the application service traffic... Traffic is divided into a first part and a second part. The first part of traffic is diverted to the first service cluster, and the second part of traffic is diverted to the second service cluster to execute the application service process corresponding to the application service traffic. In this way, even if the application service response process fails to execute in the second service cluster, the first part of traffic still exists in the first service cluster, which will not cause the entire application service to crash. When the application service response process executes without failure, the online component is switched from the intermediate component to the second service component, and the online application service cluster is switched from the first service cluster to the second service cluster. This can smoothly complete the service cluster switch, thus improving the system stability during the service cluster switch. Attached Figure Description
[0054] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0055] Figure 1 This is a flowchart illustrating an application service cluster switching method in one embodiment of this application;
[0056] Figure 2 This is a flowchart illustrating the traffic splitting steps in one embodiment of this application;
[0057] Figure 3 This is a flowchart illustrating the traffic splitting step in another embodiment of this application;
[0058] Figure 4 This is a structural block diagram of an application service cluster switching device in one embodiment;
[0059] Figure 5 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0060] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0061] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with relevant regulations. The acquisition, storage, use and processing of data in the technical solution of this application all comply with the relevant provisions of national laws and regulations.
[0062] The application service cluster switching method of this application is applied to an application service system, which includes a first service component, an intermediate component, a second service component, a first service cluster, and a second service cluster. The first service component is used to register the cluster server of the first service cluster, the intermediate component is used to register the cluster server of the first service cluster and the cluster server of the second service cluster, and the second service component is used to register the cluster server of the second service cluster.
[0063] Based on this, it can be seen that when the first service component is an online component, since the cluster server of the first service cluster is registered on the first service component, all application service traffic obtained by the online component will be directed to the cluster server of the first service cluster; when the intermediate component is an online component, since the cluster server of the first service cluster and the cluster server of the second service cluster are registered on the intermediate component, the application service traffic obtained by the online component will be directed to the cluster server of the first service cluster and the cluster server of the second service cluster; when the second service component is an online component, since the cluster server of the second service cluster is registered on the second service component, the application service traffic obtained by the online component will be directed to the cluster server of the second service cluster.
[0064] In one exemplary embodiment, such as Figure 1 As shown, an application service cluster switching method is provided, which includes the following steps 202 to 204. Wherein:
[0065] Step 202, Traffic Splitting Step: Switch the online component from the first service component to the intermediate component; obtain application service traffic through the online component and split the application service traffic into a first part of traffic and a second part of traffic; split the first part of traffic to the first service cluster and the second part of traffic to the second service cluster through the intermediate component, and execute the application service response process corresponding to the application service traffic.
[0066] The first service component, the intermediate component, and the second service component can all be set in the service directory. In the service directory, the online component can be switched between the first service component, the intermediate component, and the second service component. The first service component registers the server addresses of each cluster server in the first service cluster, the intermediate component registers the server addresses of each cluster server in the first service cluster and the server addresses of each cluster server in the second service cluster, and the second service component registers the server addresses of each cluster server in the second service cluster.
[0067] As an example, the number of first service components and second service components can be one, and the number of intermediate components can be one or more.
[0068] As an example, step 202 includes: switching the online component from a first service component to an intermediate component in the service catalog; obtaining application service traffic through the intermediate component; and dividing the application service traffic into a first part of traffic and a second part of traffic according to a preset traffic ratio; diverting the first part of traffic to the first service cluster through the server address of the cluster server of the first service cluster registered on the intermediate component, and diverting the second part of traffic to the second service cluster through the server address of the cluster server of the second service cluster registered on the intermediate component; executing the application service response process corresponding to the first part of traffic through the first service cluster, and executing the application service response process corresponding to the second part of traffic through the second service cluster.
[0069] It should be noted that the application service response process is used to process application service traffic and output corresponding response results. For example, assuming that the application service traffic is user profile information, the response result can be the user classification result based on the user profile information.
[0070] In some embodiments, the proportion of the second part of the traffic in the application service traffic is less than a preset traffic proportion threshold. This ensures that the intermediate component will first divert a small amount of application service traffic to the second service cluster to execute the application service response process. Since the application service traffic diverted to the second service cluster is small, but the application service traffic diverted to the first service cluster is large, even if the application service response process of the second service cluster fails, it will not have a significant impact on the entire application service, thus preventing the overall application service from crashing.
[0071] Step 204: If the application service response process executes without any abnormalities, the online application service cluster is switched from the first service cluster to the second service cluster by switching the online component from the intermediate component to the second service component.
[0072] As an example, step 204 includes: if the application service response processes of both the first service cluster and the second service cluster execute without error, then the online component is switched from the intermediate component to the second service component. In this way, the second service component will obtain the application service traffic and distribute all the obtained application service traffic to the second service cluster according to the server address of the cluster server of the registered second service cluster, thereby realizing the switching of the online application service cluster from the first service cluster to the second service cluster.
[0073] It should be noted that the intermediate component can register all cluster servers in the first service cluster, as well as all cluster servers in the second service cluster; the intermediate component can also register all cluster servers in the first service cluster, as well as some cluster servers in the second service cluster. The specific settings can be flexibly configured according to actual needs.
[0074] In some embodiments, application service traffic is segmented into a first part of traffic and a second part of traffic, including:
[0075] Obtain the first server address of the first service cluster and the second server address of the second service cluster; allocate the first server address and the second server address to the application service traffic according to the preset traffic weight information; determine the application service traffic allocated with the first server address as the first part of the traffic, and determine the application service traffic allocated with the second server address as the second part of the traffic.
[0076] The preset traffic weight information is used to determine the proportion of traffic diverted to the first service cluster and the second service cluster. For example, if the preset traffic weight information is 0.1, it means that 10% of the application service traffic is diverted to the first service cluster and the remaining 90% of the application service traffic is diverted to the second service cluster.
[0077] Specifically, the system obtains the first server address of the cluster server in the first service cluster and the second server address of the cluster server in the second service cluster. Based on preset traffic weighting information, it assigns the first server address to a portion of the application service traffic, resulting in the first portion of traffic, and assigns the second server address to another portion of the application service traffic, resulting in the second portion of traffic. Thus, the first portion of traffic will automatically be routed to the first server cluster based on the first server address, and the second portion of traffic will automatically be routed to the second server cluster based on the second server address, resulting in the second portion of traffic being automatically routed to the second service cluster.
[0078] In the above application service cluster switching method, the application service system is configured with a first service component, an intermediate component, a second service component, a first service cluster, and a second service cluster. The first service component is used to register the cluster servers of the first service cluster, the intermediate component is used to register the cluster servers of the first and second service clusters, and the second service component is used to register the cluster servers of the second service cluster. When switching application services in the application service system, the online component is first switched from the first service component to the intermediate component. After obtaining application service traffic, the intermediate component divides the traffic into a first part and a second part, diverting the first part to the first service cluster and the second part to the second service cluster to execute the corresponding application service process. Even if the application service response process fails in the second service cluster, the first part of the traffic still exists in the first service cluster, preventing the entire application service from crashing. When the application service response process executes without error, switching the online component from the intermediate component to the second service component and the online application service cluster from the first to the second service cluster smoothly completes the service cluster switch, thus improving system stability during service cluster switching.
[0079] In one exemplary embodiment, such as Figure 3 As shown, the application service response process includes a first-phase response process and a second-phase response process; the intermediate components include a first intermediate component and a second intermediate component; the traffic offloading steps include:
[0080] Step 302: Switch the online component from the first service component to the first intermediate component.
[0081] Among them, online components refer to components of the application service system that are currently running. These online components can acquire application service traffic and distribute it to cluster servers.
[0082] Step 304: The application service traffic obtained by the first intermediate component is divided into a first part of traffic and a second part of traffic. The first part of traffic is diverted to the first service cluster and the second part of traffic is diverted to the second service cluster through the first intermediate component, and the first phase response process of the application service traffic is executed.
[0083] The intermediate components may include a first intermediate component and a second intermediate component, and the application service response process may include a first-stage response process and a second-stage response process.
[0084] As an example, step 304 includes: according to a first preset traffic splitting ratio, dividing the acquired application service traffic into a first part of traffic and a second part of traffic through a first intermediate component, and splitting the first part of traffic to a first service cluster and the second part of traffic to a second service cluster; executing the first phase response process corresponding to the first part of traffic through the first service cluster, and executing the first phase response process corresponding to the second part of traffic through the second service cluster.
[0085] Step 306: If the first phase response process executes without any abnormalities, the online component is switched from the first intermediate component to the second intermediate component, and the application service traffic is divided into the third part traffic and the fourth part traffic through the second intermediate component.
[0086] Step 308: The third part of the traffic is diverted to the first service cluster through the second intermediate component, and the fourth part of the traffic is diverted to the second service cluster, thus executing the second phase response process for the application service traffic.
[0087] As an example, steps 306 to 308 include: if the first-stage response process executes without error, the online component is switched from the first intermediate component to the second intermediate component, and the acquired application service traffic is divided into a third part of traffic and a fourth part of traffic according to the second preset traffic diversion ratio; the third part of traffic is diverted to the first service cluster, and the fourth part of traffic is diverted to the second service cluster; the second-stage response process corresponding to the third part of traffic is executed through the first service cluster, and the second-stage response process corresponding to the fourth part of traffic is executed through the second service cluster.
[0088] Furthermore, if the second-phase response process executes without any abnormalities, the online component will be switched from the second intermediate component to the second service component.
[0089] It should be noted that the fourth part of the traffic accounts for a larger proportion of the application service traffic than the second part; the third part of the traffic accounts for a smaller proportion of the application service traffic than the first part.
[0090] In some embodiments, the above application service cluster switching method further includes:
[0091] If the first phase response process fails, the second service cluster registered with the first intermediate component's cluster server will be suspended or deregistered; if the second phase response process fails, the online component will be switched from the second intermediate component to the first service component.
[0092] Specifically, during the execution of the first phase response process, the proportion of the second part of the application service traffic diverted to the second service cluster is less than the first preset traffic proportion; during the execution of the second phase response process, the proportion of the fourth part of the application service traffic diverted to the second service cluster is greater than the second preset traffic proportion, and the second preset traffic proportion is greater than the first preset traffic proportion.
[0093] Specifically, in the event of an abnormal execution of the first-stage response process, the second service cluster registered with the first intermediate component can be suspended or deregistered. Since the proportion of the second part of the application service traffic diverted to the second service cluster is less than the first preset traffic proportion, suspending or deregistering the second service cluster registered with the first intermediate component will not significantly affect the operation of the entire application service, and can also quickly resolve the problem of abnormal execution of the application service response process.
[0094] In the event of an anomaly in the second-phase response process, the online component can be switched from the second intermediate component to the first service component to achieve a rollback of the application service system version update. Specifically, since the proportion of the fourth part of the application service traffic diverted to the second service cluster is greater than the second preset traffic proportion, there is a large amount of traffic diverted to the second service cluster. In order to ensure the stability and security of the entire application service, all application service traffic needs to be diverted back to the first service cluster to achieve a rollback of the application service update version.
[0095] In this embodiment, a first intermediate component and a second intermediate component are provided. The first intermediate component can divide the acquired application service traffic into a first part of traffic and a second part of traffic, and divert the first part of traffic to the first service cluster and the second part of traffic to the second service cluster. The second intermediate component can switch the acquired application service traffic into a third part of traffic and a fourth part of traffic, and divert the third part of traffic to the first service cluster and the fourth part of traffic to the second service cluster. Since the proportion of the fourth part of traffic in the application service traffic is greater than that of the second part of traffic, and the proportion of the third part of traffic is less than that of the first part of traffic, the application service traffic is switched from the first service cluster to the second service cluster in two stages. Compared with the method of directly switching all traffic from the first service cluster to the second service cluster, even if the application service process execution is abnormal, it will not cause the entire application service to crash. Therefore, the system stability during the application service cluster switching can be improved.
[0096] In some embodiments, refer to Figure 3The application service response process includes multiple stages, and the intermediate components include multiple stages of intermediate components; the traffic offloading steps include:
[0097] Step 402, Component switching step: Switch the online component to the intermediate stage component.
[0098] Step 404, Stage Traffic Splitting Step: According to the preset traffic weight information corresponding to the stage intermediate component, the application service traffic obtained by the stage intermediate component is divided into a first part of traffic and a second part of traffic. The first part of traffic is split to the first service cluster, and the second part of traffic is split to the second service cluster. The stage response process of application service traffic is executed.
[0099] Step 406: If the phase response process executes without error, return to the execution component switching step until all phase response processes have been completed or any phase response process executes abnormally.
[0100] The intermediate components may include multiple stage intermediate components, and each stage intermediate component will simultaneously divert the acquired application service traffic to the first service cluster and the second service cluster to execute the corresponding stage response process.
[0101] As an example, steps 402 to 406 include: a component switching step: switching the online component to a stage intermediate component; a stage traffic diversion step: according to the preset traffic weight information corresponding to the stage intermediate component, dividing the application service traffic obtained by the stage intermediate component into a first part of traffic and a second part of traffic, diverting the first part of traffic to the first service cluster, and diverting the second part of traffic to the second service cluster, executing the stage response process corresponding to the first part of traffic through the first service cluster, and executing the stage response process corresponding to the second part of traffic through the second service cluster; if the stage response process executes without error, returning to the above component switching step, until all stage response processes are completed or any stage response process executes abnormally.
[0102] It should be noted that if any stage of the response process fails, the online component will be switched to the first service component to perform a version rollback of the application service and ensure the stability of the application service.
[0103] During the Nth execution phase traffic splitting step, the proportion of the second part of the traffic in the application service traffic is greater than the proportion of the second part of the traffic in the application service traffic during the (N-1)th execution phase traffic splitting step; during the 1st execution phase traffic splitting step, the online component switches from the first service component to the phase intermediate component, and during the 2nd to Nth execution phase traffic splitting steps, the online component switches between the phase intermediate components, where N is a positive integer greater than 1.
[0104] In this embodiment, multiple intermediate components are set between the first service component and the second service component. Starting from the first service component, the online component is gradually switched between the intermediate components, so that the proportion of traffic diverted to the second service cluster gradually increases. Each intermediate component checks whether the corresponding stage response process is executing without anomalies when diverting traffic to the first and second service clusters. This achieves a multi-stage gradual switching of the application service cluster, gradually migrating traffic from the first service cluster to the second service cluster, and finally completing the application service cluster switch. Compared with the method of directly switching all traffic from the first service cluster to the second service cluster, even if the application service process execution is abnormal, it will not cause the entire application service to crash. Therefore, the system stability during the application service cluster switch can be improved.
[0105] In one complete embodiment, the application service system includes a first service component, an intermediate component, a second service component, a first service cluster, and a second service cluster. The first service component is used to register the cluster server of the first service cluster, the intermediate component is used to register the cluster server of the first service cluster and the cluster server of the second service cluster, and the second service component is used to register the cluster server of the second service cluster.
[0106] Based on the aforementioned application service system, the application service response process includes a first-stage response process and a second-stage response process; the intermediate components include a first intermediate component and a second intermediate component; the application service system first switches the online component from the first service component to the first intermediate component; according to a first preset traffic splitting ratio, the first intermediate component divides the acquired application service traffic into a first part of traffic and a second part of traffic, and splits the first part of traffic to the first service cluster and the second part of traffic to the second service cluster; the first service cluster executes the first-stage response process corresponding to the first part of traffic, and the second service cluster executes the first-stage response process corresponding to the second part of traffic; if the first-stage response process executes without error, the online component is switched from the first intermediate component to the second intermediate component, and according to the second preset traffic splitting ratio, the acquired application service traffic is divided into a third part of traffic and a fourth part of traffic; the third part of traffic is split to the first service cluster, and the fourth part of traffic is split to the second service cluster; the first service cluster executes the second-stage response process corresponding to the third part of traffic, and the second service cluster executes the second-stage response process corresponding to the fourth part of traffic.
[0107] Among them, the fourth part of the traffic accounts for a larger proportion of the application service traffic than the second part; the third part of the traffic accounts for a smaller proportion of the application service traffic than the first part.
[0108] Furthermore, if the second-stage response process executes without any abnormalities, the online component will be switched from the intermediate component to the second service component. In this way, the second service component will obtain application service traffic and distribute all the obtained application service traffic to the second service cluster according to the server address of the cluster server of the registered second service cluster, thereby realizing the switch of the online application service cluster from the first service cluster to the second service cluster.
[0109] Furthermore, in the event of an anomaly in the first-stage response process, the second service cluster registered with the first intermediate component can be suspended or deregistered. Since the proportion of the second part of the application service traffic diverted to the second service cluster is less than the first preset traffic proportion, suspending or deregistering the second service cluster registered with the first intermediate component will not significantly affect the operation of the entire application service and can quickly resolve the issue of an anomaly in the application service response process.
[0110] In this embodiment, the application service traffic is switched from the first service cluster to the second service cluster in two stages. Compared with the method of directly switching all traffic from the first service cluster to the second service cluster, even if the application service process execution is abnormal, it will not cause the entire application service to crash. Therefore, the system stability during the application service cluster switching can be improved.
[0111] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0112] Based on the same inventive concept, this application also provides an application service cluster switching device for implementing the application service cluster switching method described above. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations in one or more application service cluster switching device embodiments provided below can be found in the limitations of the application service cluster switching method described above, and will not be repeated here.
[0113] In one exemplary embodiment, such as Figure 4As shown, an application service cluster switching device is provided, applied to an application service system. The application service system includes a first service component, an intermediate component, a second service component, a first service cluster, and a second service cluster. The first service component is used to register the cluster servers of the first service cluster. The intermediate component is used to register the cluster servers of the first service cluster and the cluster servers of the second service cluster. The second service component is used to register the cluster servers of the second service cluster. The device includes a traffic splitting module 502 and a switching module 504, wherein:
[0114] Traffic splitting module 502 is used to perform the following traffic splitting steps: switching the online component from the first service component to the intermediate component; obtaining application service traffic through the online component and splitting the application service traffic into a first part of traffic and a second part of traffic; splitting the first part of traffic to the first service cluster and the second part of traffic to the second service cluster through the intermediate component, and executing the application service response process corresponding to the application service traffic.
[0115] The switching module 504 is used to switch the online application service cluster from the first service cluster to the second service cluster if the application service response process executes without any abnormalities, by switching the online component from the intermediate component to the second service component.
[0116] In one embodiment, the application service response process includes a first-phase response process and a second-phase response process; the intermediate component includes a first intermediate component and a second intermediate component; the traffic splitting module is further configured to:
[0117] Switch the online component from the first service component to the first intermediate component;
[0118] The application service traffic obtained by the first intermediate component is divided into a first part of traffic and a second part of traffic. The first part of traffic is diverted to the first service cluster and the second part of traffic is diverted to the second service cluster through the first intermediate component, and the first phase response process of the application service traffic is executed.
[0119] If the first phase response process executes without error, the online component is switched from the first intermediate component to the second intermediate component, and the application service traffic obtained by the second intermediate component is divided into a third part of traffic and a fourth part of traffic.
[0120] The second intermediate component diverts the third portion of traffic to the first service cluster and the fourth portion of traffic to the second service cluster, thereby executing the second phase response process for the application service traffic.
[0121] In one embodiment, the fourth portion of traffic accounts for a greater proportion of the application service traffic than the second portion of traffic accounts for a greater proportion of the application service traffic; the third portion of traffic accounts for a smaller proportion of the application service traffic than the first portion of traffic accounts for a smaller proportion of the application service traffic.
[0122] In one embodiment, the device further includes:
[0123] The service exception execution module is used to suspend or deregister the cluster server of the second service cluster registered in the first intermediate component if the first phase response process fails to execute; and to switch the online component from the second intermediate component to the first service component if the second phase response process fails to execute.
[0124] In one embodiment, the application service response process includes multiple phased response processes, and the intermediate component includes multiple phased intermediate components; the traffic splitting module is further configured to:
[0125] Component switching steps: Switch the online component to a stage intermediate component;
[0126] Phased traffic splitting steps: According to the preset traffic weight information corresponding to the phase intermediate component, the application service traffic obtained by the phase intermediate component is divided into a first part of traffic and a second part of traffic, and the first part of traffic is split to the first service cluster, and the second part of traffic is split to the second service cluster, and the phased response process of the application service traffic is executed.
[0127] If the phase response process executes without error, then return to the component switching step until all phase response processes have been completed or any of the phase response processes execute abnormally.
[0128] Wherein, the proportion of the second part of traffic in the application service traffic during the Nth execution of the stage traffic splitting step is greater than the proportion of the second part of traffic in the application service traffic during the (N-1)th execution of the stage traffic splitting step; during the first execution of the stage traffic splitting step, the online component is switched from the first service component to the stage intermediate component; during the second to Nth executions of the stage traffic splitting step, the online component switches between each stage intermediate component, where N is a positive integer greater than 1.
[0129] In one embodiment, the traffic splitting module is further configured to:
[0130] Obtain the first server address of the first service cluster and the second server address of the second service cluster;
[0131] According to preset traffic weighting information, the first server address and the second server address are allocated to the application service traffic;
[0132] The application service traffic assigned to the first server address is defined as the first part of the traffic, and the application service traffic assigned to the second server address is defined as the second part of the traffic.
[0133] Each module in the aforementioned application service cluster switching device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0134] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 5 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores application service traffic data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements an application service cluster switching method.
[0135] Those skilled in the art will understand that Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0136] In an exemplary embodiment, a computer device is provided for an application service system. The application service system includes a first service component, an intermediate component, a second service component, a first service cluster, and a second service cluster. The first service component is used to register cluster servers of the first service cluster. The intermediate component is used to register cluster servers of both the first and second service clusters. The second service component is used to register cluster servers of the second service cluster. The computer device includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the following steps:
[0137] Traffic splitting steps: Switch the online component from the first service component to the intermediate component; obtain application service traffic through the online component, and divide the application service traffic into a first part of traffic and a second part of traffic; split the first part of traffic to the first service cluster and the second part of traffic to the second service cluster through the intermediate component, and execute the application service response process corresponding to the application service traffic;
[0138] If the application service response process executes without error, the online application service cluster is switched from the first service cluster to the second service cluster by switching the online component from the intermediate component to the second service component.
[0139] In one embodiment, the application service response process includes a first-phase response process and a second-phase response process; the intermediate component includes a first intermediate component and a second intermediate component; the processor, when executing the computer program, also implements the following steps:
[0140] Switch the online component from the first service component to the first intermediate component;
[0141] The application service traffic obtained by the first intermediate component is divided into a first part of traffic and a second part of traffic. The first part of traffic is diverted to the first service cluster and the second part of traffic is diverted to the second service cluster through the first intermediate component, and the first phase response process of the application service traffic is executed.
[0142] If the first phase response process executes without error, the online component is switched from the first intermediate component to the second intermediate component, and the application service traffic obtained by the second intermediate component is divided into a third part of traffic and a fourth part of traffic.
[0143] The second intermediate component diverts the third portion of traffic to the first service cluster and the fourth portion of traffic to the second service cluster, thereby executing the second phase response process for the application service traffic.
[0144] In one embodiment, the fourth portion of traffic accounts for a greater proportion of the total traffic in the application service traffic than the second portion of traffic accounts for a greater proportion of the total traffic in the application service traffic; the third portion of traffic accounts for a smaller proportion of the total traffic in the application service traffic than the first portion of traffic accounts for a smaller proportion of the total traffic in the application service traffic.
[0145] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0146] If the first phase response process fails, the second service cluster registered with the first intermediate component will be suspended or deregistered.
[0147] If the second-stage response process fails, the online component will be switched from the second intermediate component to the first service component.
[0148] In one embodiment, the application service response process includes multiple phased response processes, and the intermediate component includes multiple phased intermediate components; the processor also performs the following steps when executing the computer program:
[0149] Component switching steps: Switch the online component to a stage intermediate component;
[0150] Phased traffic splitting steps: According to the preset traffic weight information corresponding to the phase intermediate component, the application service traffic obtained by the phase intermediate component is divided into a first part of traffic and a second part of traffic, and the first part of traffic is split to the first service cluster, and the second part of traffic is split to the second service cluster, and the phased response process of the application service traffic is executed.
[0151] If the phase response process executes without error, then return to the component switching step until all phase response processes have been completed or any of the phase response processes execute abnormally.
[0152] Wherein, the proportion of the second part of traffic in the application service traffic during the Nth execution of the stage traffic splitting step is greater than the proportion of the second part of traffic in the application service traffic during the (N-1)th execution of the stage traffic splitting step; during the first execution of the stage traffic splitting step, the online component is switched from the first service component to the stage intermediate component; during the second to Nth executions of the stage traffic splitting step, the online component switches between each stage intermediate component, where N is a positive integer greater than 1.
[0153] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0154] Obtain the first server address of the first service cluster and the second server address of the second service cluster;
[0155] According to preset traffic weighting information, the first server address and the second server address are allocated to the application service traffic;
[0156] The application service traffic assigned to the first server address is defined as the first part of the traffic, and the application service traffic assigned to the second server address is defined as the second part of the traffic.
[0157] In one embodiment, a computer-readable storage medium is provided for use in an application service system. The application service system includes a first service component, an intermediate component, a second service component, a first service cluster, and a second service cluster. The first service component is used to register the cluster servers of the first service cluster. The intermediate component is used to register the cluster servers of the first service cluster and the cluster servers of the second service cluster. The second service component is used to register the cluster servers of the second service cluster. A computer program is stored on the computer-readable storage medium, and when executed by a processor, the computer program performs the following steps:
[0158] Traffic splitting steps: Switch the online component from the first service component to the intermediate component; obtain application service traffic through the online component, and divide the application service traffic into a first part of traffic and a second part of traffic; split the first part of traffic to the first service cluster and the second part of traffic to the second service cluster through the intermediate component, and execute the application service response process corresponding to the application service traffic;
[0159] If the application service response process executes without error, the online application service cluster is switched from the first service cluster to the second service cluster by switching the online component from the intermediate component to the second service component.
[0160] In one embodiment, the application service response process includes a first-phase response process and a second-phase response process; the intermediate component includes a first intermediate component and a second intermediate component; the computer program, when executed by a processor, further implements the following steps:
[0161] Switch the online component from the first service component to the first intermediate component;
[0162] The application service traffic obtained by the first intermediate component is divided into a first part of traffic and a second part of traffic. The first part of traffic is diverted to the first service cluster and the second part of traffic is diverted to the second service cluster through the first intermediate component, and the first phase response process of the application service traffic is executed.
[0163] If the first phase response process executes without error, the online component is switched from the first intermediate component to the second intermediate component, and the application service traffic obtained by the second intermediate component is divided into a third part of traffic and a fourth part of traffic.
[0164] The second intermediate component diverts the third portion of traffic to the first service cluster and the fourth portion of traffic to the second service cluster, thereby executing the second phase response process for the application service traffic.
[0165] In one embodiment, the fourth portion of traffic accounts for a greater proportion of the total traffic in the application service traffic than the second portion of traffic accounts for a greater proportion of the total traffic in the application service traffic; the third portion of traffic accounts for a smaller proportion of the total traffic in the application service traffic than the first portion of traffic accounts for a smaller proportion of the total traffic in the application service traffic.
[0166] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0167] If the first phase response process fails, the second service cluster registered with the first intermediate component will be suspended or deregistered.
[0168] If the second-stage response process fails, the online component will be switched from the second intermediate component to the first service component.
[0169] In one embodiment, the application service response process includes multiple phased response processes, and the intermediate component includes multiple phased intermediate components; the computer program, when executed by a processor, also implements the following steps:
[0170] Component switching steps: Switch the online component to a stage intermediate component;
[0171] Phased traffic splitting steps: According to the preset traffic weight information corresponding to the phase intermediate component, the application service traffic obtained by the phase intermediate component is divided into a first part of traffic and a second part of traffic, and the first part of traffic is split to the first service cluster, and the second part of traffic is split to the second service cluster, and the phased response process of the application service traffic is executed.
[0172] If the phase response process executes without error, then return to the component switching step until all phase response processes have been completed or any of the phase response processes execute abnormally.
[0173] Wherein, the proportion of the second part of traffic in the application service traffic during the Nth execution of the stage traffic splitting step is greater than the proportion of the second part of traffic in the application service traffic during the (N-1)th execution of the stage traffic splitting step; during the first execution of the stage traffic splitting step, the online component is switched from the first service component to the stage intermediate component; during the second to Nth executions of the stage traffic splitting step, the online component switches between each stage intermediate component, where N is a positive integer greater than 1.
[0174] In one embodiment, the first server address of the first service cluster and the second server address of the second service cluster are obtained;
[0175] According to preset traffic weighting information, the first server address and the second server address are allocated to the application service traffic;
[0176] The application service traffic assigned to the first server address is defined as the first part of the traffic, and the application service traffic assigned to the second server address is defined as the second part of the traffic.
[0177] In one embodiment, a computer program product is provided, applied to an application service system. The application service system includes a first service component, an intermediate component, a second service component, a first service cluster, and a second service cluster. The first service component is used to register the cluster servers of the first service cluster. The intermediate component is used to register the cluster servers of the first service cluster and the cluster servers of the second service cluster. The second service component is used to register the cluster servers of the second service cluster. The computer program product includes a computer program that, when executed by a processor, performs the following steps:
[0178] Traffic splitting steps: Switch the online component from the first service component to the intermediate component; obtain application service traffic through the online component, and divide the application service traffic into a first part of traffic and a second part of traffic; split the first part of traffic to the first service cluster and the second part of traffic to the second service cluster through the intermediate component, and execute the application service response process corresponding to the application service traffic;
[0179] If the application service response process executes without error, the online application service cluster is switched from the first service cluster to the second service cluster by switching the online component from the intermediate component to the second service component.
[0180] In one embodiment, the application service response process includes a first-phase response process and a second-phase response process; the intermediate component includes a first intermediate component and a second intermediate component; the computer program, when executed by a processor, further implements the following steps:
[0181] Switch the online component from the first service component to the first intermediate component;
[0182] The application service traffic obtained by the first intermediate component is divided into a first part of traffic and a second part of traffic. The first part of traffic is diverted to the first service cluster and the second part of traffic is diverted to the second service cluster through the first intermediate component, and the first phase response process of the application service traffic is executed.
[0183] If the first phase response process executes without error, the online component is switched from the first intermediate component to the second intermediate component, and the application service traffic obtained by the second intermediate component is divided into a third part of traffic and a fourth part of traffic.
[0184] The second intermediate component diverts the third portion of traffic to the first service cluster and the fourth portion of traffic to the second service cluster, thereby executing the second phase response process for the application service traffic.
[0185] In one embodiment, the fourth portion of traffic accounts for a greater proportion of the total traffic in the application service traffic than the second portion of traffic accounts for a greater proportion of the total traffic in the application service traffic; the third portion of traffic accounts for a smaller proportion of the total traffic in the application service traffic than the first portion of traffic accounts for a smaller proportion of the total traffic in the application service traffic.
[0186] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0187] If the first phase response process fails, the second service cluster registered with the first intermediate component will be suspended or deregistered.
[0188] If the second-stage response process fails, the online component will be switched from the second intermediate component to the first service component.
[0189] In one embodiment, the application service response process includes multiple phased response processes, and the intermediate component includes multiple phased intermediate components; the computer program, when executed by a processor, also implements the following steps:
[0190] Component switching steps: Switch the online component to a stage intermediate component;
[0191] Phased traffic splitting steps: According to the preset traffic weight information corresponding to the phase intermediate component, the application service traffic obtained by the phase intermediate component is divided into a first part of traffic and a second part of traffic, and the first part of traffic is split to the first service cluster, and the second part of traffic is split to the second service cluster, and the phased response process of the application service traffic is executed.
[0192] If the phase response process executes without error, then return to the component switching step until all phase response processes have been completed or any of the phase response processes execute abnormally.
[0193] Wherein, the proportion of the second part of traffic in the application service traffic during the Nth execution of the stage traffic splitting step is greater than the proportion of the second part of traffic in the application service traffic during the (N-1)th execution of the stage traffic splitting step; during the first execution of the stage traffic splitting step, the online component is switched from the first service component to the stage intermediate component; during the second to Nth executions of the stage traffic splitting step, the online component switches between each stage intermediate component, where N is a positive integer greater than 1.
[0194] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0195] Obtain the first server address of the first service cluster and the second server address of the second service cluster;
[0196] According to preset traffic weighting information, the first server address and the second server address are allocated to the application service traffic;
[0197] The application service traffic assigned to the first server address is defined as the first part of the traffic, and the application service traffic assigned to the second server address is defined as the second part of the traffic.
[0198] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0199] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0200] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for switching application service clusters, characterized in that, The system is applied to an application service system, which includes a first service component, an intermediate component, a second service component, a first service cluster, and a second service cluster. The first service component is used to register the cluster server of the first service cluster, the intermediate component is used to register the cluster server of the first service cluster and the cluster server of the second service cluster, and the second service component is used to register the cluster server of the second service cluster. The method includes: Traffic splitting steps: Switch the online component from the first service component to the intermediate component; obtain application service traffic through the online component, and divide the application service traffic into a first part of traffic and a second part of traffic; split the first part of traffic to the first service cluster and the second part of traffic to the second service cluster through the intermediate component, and execute the application service response process corresponding to the application service traffic; If the application service response process executes without error, the online application service cluster is switched from the first service cluster to the second service cluster by switching the online component from the intermediate component to the second service component. The application service response process includes a first-stage response process and a second-stage response process; the intermediate component includes a first intermediate component and a second intermediate component; the traffic splitting step includes: Switch the online component from the first service component to the first intermediate component; The application service traffic obtained by the first intermediate component is divided into a first part of traffic and a second part of traffic. The first part of traffic is diverted to the first service cluster and the second part of traffic is diverted to the second service cluster through the first intermediate component, and the first phase response process of the application service traffic is executed. If the first phase response process executes without error, the online component is switched from the first intermediate component to the second intermediate component, and the application service traffic obtained by the second intermediate component is divided into a third part of traffic and a fourth part of traffic. The third portion of traffic is diverted to the first service cluster via the second intermediate component, and the fourth portion of traffic is diverted to the second service cluster, thereby executing the second phase response process of the application service traffic; The fourth part of the traffic accounts for a larger proportion of the total traffic in the application service traffic than the second part of the traffic in the application service traffic; the third part of the traffic accounts for a smaller proportion of the total traffic in the application service traffic than the first part of the traffic in the application service traffic.
2. The method according to claim 1, characterized in that, The method further includes: If the first phase response process fails, the second service cluster registered with the first intermediate component will be suspended or deregistered. If the second-stage response process fails, the online component will be switched from the second intermediate component to the first service component.
3. The method according to claim 1, characterized in that, The application service response process includes multiple phased response processes, and the intermediate component includes multiple phased intermediate components. The traffic splitting step includes: Component switching steps: Switch the online component to a stage intermediate component; Phased traffic splitting steps: According to the preset traffic weight information corresponding to the phase intermediate component, the application service traffic obtained by the phase intermediate component is divided into a first part of traffic and a second part of traffic, and the first part of traffic is split to the first service cluster, and the second part of traffic is split to the second service cluster, and the phased response process of the application service traffic is executed. If the phase response process executes without error, then return to the component switching step until all phase response processes have been completed or any of the phase response processes execute abnormally. Wherein, the proportion of the second part of traffic in the application service traffic during the Nth execution of the stage traffic splitting step is greater than the proportion of the second part of traffic in the application service traffic during the (N-1)th execution of the stage traffic splitting step; during the first execution of the stage traffic splitting step, the online component is switched from the first service component to the stage intermediate component; during the second to Nth executions of the stage traffic splitting step, the online component switches between each stage intermediate component, where N is a positive integer greater than 1.
4. The method according to claim 1, characterized in that, The step of dividing the application service traffic into a first part of traffic and a second part of traffic includes: Obtain the first server address of the first service cluster and the second server address of the second service cluster; According to preset traffic weighting information, the first server address and the second server address are allocated to the application service traffic; The application service traffic assigned to the first server address is defined as the first part of the traffic, and the application service traffic assigned to the second server address is defined as the second part of the traffic.
5. An application service cluster switching device, characterized in that, The system is applied to an application service system, which includes a first service component, an intermediate component, a second service component, a first service cluster, and a second service cluster. The first service component is used to register the cluster server of the first service cluster, the intermediate component is used to register the cluster server of the first service cluster and the cluster server of the second service cluster, and the second service component is used to register the cluster server of the second service cluster. The device includes: The traffic splitting module is used to perform the following traffic splitting steps: switching the online component from the first service component to the intermediate component; obtaining application service traffic through the online component and splitting the application service traffic into a first part of traffic and a second part of traffic; splitting the first part of traffic to the first service cluster and the second part of traffic to the second service cluster through the intermediate component, and executing the application service response process corresponding to the application service traffic. The switching module is used to switch the online application service cluster from the first service cluster to the second service cluster if the application service response process executes without any abnormalities; The application service response process includes a first-stage response process and a second-stage response process; the intermediate component includes a first intermediate component and a second intermediate component; the traffic splitting module is further used for: Switch the online component from the first service component to the first intermediate component; The application service traffic obtained by the first intermediate component is divided into a first part of traffic and a second part of traffic. The first part of traffic is diverted to the first service cluster and the second part of traffic is diverted to the second service cluster through the first intermediate component, and the first phase response process of the application service traffic is executed. If the first phase response process executes without error, the online component is switched from the first intermediate component to the second intermediate component, and the application service traffic obtained by the second intermediate component is divided into a third part of traffic and a fourth part of traffic. The third portion of traffic is diverted to the first service cluster via the second intermediate component, and the fourth portion of traffic is diverted to the second service cluster, thereby executing the second phase response process of the application service traffic; The fourth part of the traffic accounts for a larger proportion of the total traffic in the application service traffic than the second part of the traffic in the application service traffic; the third part of the traffic accounts for a smaller proportion of the total traffic in the application service traffic than the first part of the traffic in the application service traffic.
6. The apparatus according to claim 5, characterized in that, The device further includes: The service exception execution module is used to suspend or deregister the cluster server of the second service cluster registered in the first intermediate component if the first phase response process fails to execute; and to switch the online component from the second intermediate component to the first service component if the second phase response process fails to execute.
7. The apparatus according to claim 5, characterized in that, The application service response process includes multiple phased response processes, and the intermediate component includes multiple phased intermediate components; the traffic splitting module is also used for: Component switching steps: Switch the online component to a stage intermediate component; Phased traffic splitting steps: According to the preset traffic weight information corresponding to the phase intermediate component, the application service traffic obtained by the phase intermediate component is divided into a first part of traffic and a second part of traffic, and the first part of traffic is split to the first service cluster, and the second part of traffic is split to the second service cluster, and the phased response process of the application service traffic is executed. If the phase response process executes without error, then return to the component switching step until all phase response processes have been completed or any of the phase response processes execute abnormally. Wherein, the proportion of the second part of traffic in the application service traffic when the stage traffic splitting step is executed for the Nth time is greater than the proportion of the second part of traffic in the application service traffic when the stage traffic splitting step is executed for the N-1th time; When the stage traffic splitting step is executed for the first time, the online component is switched from the first service component to the stage intermediate component. When the stage traffic splitting step is executed for the second to Nth time, the online component is switched between the stage intermediate components, where N is a positive integer greater than 1.
8. The apparatus according to claim 5, characterized in that, The traffic splitting module is also used for: Obtain the first server address of the first service cluster and the second server address of the second service cluster; According to preset traffic weighting information, the first server address and the second server address are allocated to the application service traffic; The application service traffic assigned to the first server address is defined as the first part of the traffic, and the application service traffic assigned to the second server address is defined as the second part of the traffic.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 4.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.
11. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Database main and standby cluster switching method and device, computer equipment and storage medium
CN114238495A
Service switching method, system and device, equipment, storage medium and program product
CN114416366A