Traffic switching method, device and computer readable storage medium
By updating metadata to an immutable state before traffic switching, the target version service loads metadata and switches service traffic, solving the problem of user operation interruption in existing technologies and achieving metadata consistency and reduced user perception.
Patent Information
- Application Number
- CN202111551918.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-17
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2041-12-17
AI Technical Summary
Existing traffic switching methods can significantly impact the user's ongoing operations during traffic switching, potentially causing interruptions.
Obtain the metadata of the original version service and the target version service, update it to an unmodifiable state, control the target version service to load the metadata and generate a traffic switching message, and switch the service traffic to the target version service.
This reduces the user's awareness of the operation during traffic switching, maintains metadata consistency, and avoids inconsistencies caused by changes in metadata.
Smart Images

Figure CN114371880B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a flow switching method, device and computer-readable storage medium. Background Art
[0002] In the related technology, there is a grayscale release method to update the client app version. The grayscale release method can be considered as a traffic switching method, that is, allowing some clients to continue to use the original version service, and some clients to load the target version service, so that part of the user traffic is transferred to the target version service. If the user has no problem using the target version service, then gradually expand the scope, and eventually let the user traffic be transferred to the target version service. However, this traffic switching method has a greater impact on the operations being performed by the user when switching traffic. Summary of the invention
[0003] The present invention aims to solve one of the technical problems in the related art at least to a certain extent. To this end, the present invention provides a flow switching method, device and computer-readable storage medium, which can reduce the impact on the operation being performed by the user during the flow switching.
[0004] In a first aspect, an embodiment of the present invention provides a traffic switching method, the method comprising:
[0005] Get the original version service and the target version service;
[0006] Obtaining the first request being executed from the original version service, and obtaining the second request being executed from the target version service;
[0007] Acquire corresponding first metadata from the original version service according to the first request, and acquire corresponding second metadata from the target version service according to the second request;
[0008] Updating the data status of the first metadata and the second metadata to an unmodifiable state;
[0009] Controlling the target version service to load the first metadata according to the unmodifiable state, and generating a traffic switching message according to the loading state;
[0010] The traffic switching message is sent to a gateway, so that the gateway switches the service traffic of the original version service to the target version service according to the traffic switching message.
[0011] The technical solution of the first aspect of the present invention has at least one of the following advantages or beneficial effects: first, the original version service and the target version service are obtained, and then the first request being executed in the original version service and the second request being executed in the target version service are obtained, and the corresponding first metadata is obtained according to the first request, and the corresponding second metadata is obtained according to the second request. After that, the data status of the first metadata and the second metadata is updated to an unmodifiable state, and then the target version service is controlled to load the first metadata, and a traffic switching message is generated according to the loading state of the first metadata loaded by the target version service, and the traffic switching message is sent to the gateway, so that the gateway switches the service traffic of the original version service to the target version service after receiving the traffic switching message. The present application realizes the update of the original version service by switching the service traffic from the original version service to the target version service after updating the data status of the first metadata and the second metadata to an unmodifiable state, and the first request being executed on the original version service can continue to be executed during the traffic switching, which weakens the user's perception of the traffic switching process, thereby effectively reducing the impact on the user's operations being performed during the traffic switching. Secondly, after updating the data status of the first metadata and the second metadata to an unmodifiable state, the present application controls the target version service to load the first metadata, thereby avoiding the inconsistency of the metadata between the target version service and the original version service due to subsequent changes in the first metadata, that is, it can maintain the consistency of the metadata before and after the traffic switching, that is, it can maintain the consistency of the metadata before and after the version update.
[0012] In some embodiments of the present invention, the original version service includes multiple service partitions; the obtaining of the original version service and the target version service includes:
[0013] Acquire the partition code of each service partition, the first service name of the original version service, and the second service name of the target version service from the registration center;
[0014] Acquire the original version service according to the partition code and the first service name;
[0015] The target version service is acquired according to the second service name.
[0016] In some embodiments of the present invention, after sending the traffic switching message to the gateway so that the gateway switches the service traffic of the original version service to the target version service according to the traffic switching message, the method further includes:
[0017] updating the data status of the first metadata and the second metadata to a modifiable status;
[0018] The original version service is uninstalled according to the modifiable state.
[0019] In some embodiments of the present invention, after controlling the target version service to load the first metadata according to the unmodifiable state, the method further includes:
[0020] Acquire the loading status; wherein the loading status includes a loading failure status;
[0021] A first rollback operation is performed according to the loading failure status; wherein the first rollback operation includes: updating the data status of the first metadata and the second metadata to a modifiable status.
[0022] In some embodiments of the present invention, after controlling the target version service to load the first metadata according to the unmodifiable state, the method further includes:
[0023] Get the preset system account;
[0024] Connecting to the target version service according to the system account to obtain a connection status, wherein the connection status includes a connection failure status;
[0025] A second rollback operation is performed according to the connection failure state; wherein the second rollback operation includes: updating the data state of the first metadata and the second metadata to a modifiable state, and controlling the target version service to uninstall the first metadata.
[0026] In some embodiments of the present invention, after obtaining the preset system account, the method further includes:
[0027] Connecting to the target version service according to the system account to obtain a connection status; wherein the connection status includes a connection success status;
[0028] Acquire the target version data corresponding to the target version service according to the connection success status;
[0029] Synchronizing the first version data corresponding to each of the service partitions to the target version data;
[0030] The second version data corresponding to the registration center is synchronized to the target version data.
[0031] In some embodiments of the present invention, after synchronizing the second version data corresponding to the registration center as the target version data, the method further includes:
[0032] Verifying the second version data to obtain a verification result;
[0033] generating the flow switching message according to the verification result;
[0034] The traffic switching message is synchronized to the gateway.
[0035] In a second aspect, an embodiment of the present invention further provides a flow switching device, the device comprising:
[0036] The first acquisition module: used to acquire the original version service and the target version service;
[0037] A second acquisition module: used to acquire the first request being executed from the original version service, and acquire the second request being executed from the target version service;
[0038] A third acquisition module: configured to acquire corresponding first metadata from the original version service according to the first request, and acquire corresponding second metadata from the target version service according to the second request;
[0039] A state modification module: used for updating the data state of the first metadata and the second metadata to an unmodifiable state;
[0040] A loading module: used for controlling the target version service to load the first metadata according to the unmodifiable state, and generating a traffic switching message according to the loading state;
[0041] Switching module: used to send the traffic switching message to the gateway, so that the gateway switches the service traffic of the original version service to the target version service according to the traffic switching message.
[0042] The technical solution of the second aspect of the present invention has at least one of the following advantages or beneficial effects: the traffic switching device includes a first acquisition module, a second acquisition module, a third acquisition module, a state modification module, a loading module, and a switching module. After the first acquisition module acquires the original version service and the target version service, the second acquisition module acquires the first request being executed in the original version service and the second request being executed in the target version service. The third acquisition module then acquires the corresponding first metadata according to the first request, and acquires the corresponding second metadata according to the second request. After that, the state modification module is used to update the data status of the first metadata and the second metadata to an unmodifiable state, and then the loading module is used to control the target version service to load the first metadata, and a traffic switching message is generated according to the loading status of the first metadata loaded by the target version service. The switching module then sends the traffic switching message to the gateway, so that the gateway switches the service traffic of the original version service to the target version service after receiving the traffic switching message. After the state modification module updates the data state of the first metadata and the second metadata to an unmodifiable state, the present application uses the switching module to switch the service traffic from the original version service to the target version service, thereby realizing the update of the original version service, and the first request being executed obtained from the original version service by the second acquisition module can continue to be executed during the traffic switching period. Therefore, the probability of the first request being forced to be interrupted due to the traffic switching, resulting in execution failure, can be reduced, while weakening the user's perception of the traffic switching process, thereby effectively reducing the impact on the user's operations being performed during the traffic switching period. Secondly, after the state modification module updates the data state of the first metadata and the second metadata to an unmodifiable state, the present application uses the loading module to control the target version service to load the first metadata, which can avoid the subsequent changes in the first metadata causing the metadata of the target version service and the original version service to be inconsistent, that is, it can maintain the consistency of the metadata before and after the traffic switching, that is, it can maintain the consistency of the metadata before and after the version update.
[0043] In the third aspect, an embodiment of the present invention further provides a flow switching device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, it implements a flow switching method as in any one of the embodiments of the first aspect.
[0044] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute a traffic switching method as in any one of the embodiments of the first aspect.
[0045] Other features and advantages of the present invention will be set forth in the description which follows, and in part will be apparent from the description, or may be learned by practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The accompanying drawings are used to provide a further understanding of the technical solution of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the technical solution of the present invention and do not constitute a limitation on the technical solution of the present invention.
[0047] Figure 1 is a first flow chart of a flow switching method provided by some embodiments of the present invention;
[0048] Figure 2 yes Figure 1 Flow chart of step S110;
[0049] Figure 3 is a second flow chart of a flow switching method provided by some embodiments of the present invention;
[0050] Figure 4 is a third flow chart of a flow switching method provided by some embodiments of the present invention;
[0051] Figure 5 is a fourth flow chart of a flow switching method provided by some embodiments of the present invention;
[0052] Figure 6 is a fifth flow chart of a flow switching method provided by some embodiments of the present invention;
[0053] Figure 7 is a sixth flow chart of a flow switching method provided by some embodiments of the present invention;
[0054] Figure 8 is a practical application flow chart of the flow switching method provided by some embodiments of the present invention;
[0055] Fig. 9 It is a block diagram of the module structure of the flow switching device provided in some embodiments of the present invention. DETAILED DESCRIPTION
[0056] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.
[0057] In the description of the present invention, "several" means more than one, "many" means more than two, "greater than", "less than", "exceed", etc. are understood to exclude the number itself, and "above", "below", "within", etc. are understood to include the number itself. If there is a description of "first" or "second", it is only used for the purpose of distinguishing the technical features, and cannot be understood as indicating or implying the relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.
[0058] In the description of the present invention, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0059] In the related technology, there is a grayscale release method to update the client app version. The grayscale release method can be considered as a traffic switching method, that is, allowing some clients to continue to use the original version service, and some clients to load the target version service, so that part of the user traffic is transferred to the target version service. If the user has no problem using the target version service, the scope is gradually expanded, and finally all user traffic is transferred to the target version service. However, this traffic switching method does not take into account the operations being performed by the user when switching traffic. During the traffic switching process, the operations being performed by the user may be forced to be interrupted, which has a greater impact on the operations being performed by the user.
[0060] Based on this, the present invention provides a traffic switching method, device and computer-readable storage medium. The method is as follows: first, an original version service and a target version service are obtained, and then a first request being executed in the original version service and a second request being executed in the target version service are obtained, and the corresponding first metadata is obtained according to the first request, and the corresponding second metadata is obtained according to the second request. After that, the data status of the first metadata and the second metadata is updated to an unmodifiable state, and then the target version service is controlled to load the first metadata, and a traffic switching message is generated according to the loading state of the first metadata loaded by the target version service, and the traffic switching message is sent to the gateway, so that the gateway switches the service traffic of the original version service to the target version service after receiving the traffic switching message. The present application implements the update of the original version service by switching the service traffic from the original version service to the target version service after updating the data status of the first metadata and the second metadata to an unmodifiable state, and the first request being executed on the original version service can continue to be executed during the traffic switching period, and the user's perception of the traffic switching process will be weakened, that is, for the user, the request issued is still being executed normally, and basically no perception of the traffic switching operation is also being executed at the same time, which effectively reduces the impact on the user's operations being executed during the traffic switching period. Secondly, after updating the data status of the first metadata and the second metadata to an unmodifiable state, the present application controls the target version service to load the first metadata, thereby avoiding the inconsistency of the metadata between the target version service and the original version service due to subsequent changes in the first metadata, that is, it can maintain the consistency of the metadata before and after the traffic switching, that is, it can maintain the consistency of the metadata before and after the version update.
[0061] The embodiments of the present invention are further described below with reference to the accompanying drawings.
[0062] refer to Figure 1 Some embodiments of the present invention provide a traffic switching method, which includes but is not limited to step S110, step S120, step S130, step S140, step S150, and step S160.
[0063] Step S110, obtaining the original version service and the target version service.
[0064] In some embodiments, the original version service and the target version service are first obtained. The original version service is the version service that is ready to be updated and is also the version service that the user is currently using. The target version service is the version service that is ready to be updated after the original version service is completed and is also the version service that the user uses after the original version service is updated. The original version service and the target version service are obtained to facilitate subsequent traffic switching.
[0065] Step S120, obtaining the first request being executed from the original version service, and obtaining the second request being executed from the target version service.
[0066] In some embodiments, the first request being executed in the original version service and the second request being executed in the target version service are obtained to facilitate subsequent operations.
[0067] Step S130: acquiring corresponding first metadata from the original version service according to the first request, and acquiring corresponding second metadata from the target version service according to the second request.
[0068] In some embodiments, corresponding first metadata is obtained from the original version service according to a first request, and corresponding second metadata is obtained from the target version service according to a second request, the first metadata includes metadata that the first request depends on in the original version service, such as user metadata, and the second metadata includes metadata that the second request depends on in the target version service, such as user metadata.
[0069] Step S140: Update the data status of the first metadata and the second metadata to an unmodifiable status.
[0070] In some embodiments, after the first metadata and the second metadata are acquired, the data status of the first metadata and the second metadata is updated to an unmodifiable state. In the unmodifiable state, the first metadata and the second metadata will refuse to be modified. It is understandable that the data status of the first metadata and the second metadata can be identified by setting a flag bit, and the value of the flag bit is used to indicate the unmodifiable state and the modifiable state mentioned later; some key fields of the first metadata and the second metadata can also be locked to indicate that the first metadata and the second metadata are in an unmodifiable state. It should be understood by those skilled in the art that the above method is only an example of updating the data status of the first metadata and the second metadata to an unmodifiable state, and cannot be understood as a limitation of the present invention, as long as the modifiable and unmodifiable states of the first metadata and the second metadata can be controlled.
[0071] Step S150, controlling the target version service to load the first metadata according to the unmodifiable state, and generating a traffic switching message according to the loading state.
[0072] In some embodiments, when the first metadata and the second metadata are in an unmodifiable state, the target version service is controlled to load the first metadata, and a traffic switching message is generated according to the loading state. The loading state includes a loading success state and a loading failure state. When the loading state is a loading success state, a traffic switching message is generated to facilitate subsequent traffic switching. Secondly, after the data states of the first metadata and the second metadata are updated to an unmodifiable state, the target version service is controlled to load the first metadata, which can avoid the subsequent inconsistency of the target version service and the original version service metadata due to changes in the first metadata, that is, the consistency of the metadata before and after the traffic switch can be maintained.
[0073] Step S160: Send a traffic switching message to the gateway, so that the gateway switches the service traffic of the original version service to the target version service according to the traffic switching message.
[0074] In some embodiments, the generated traffic switching message is sent to the gateway, so that the gateway switches the service traffic of the original version service to the target version service to complete the version update. The service traffic is the user traffic on the original version service. After the switch is completed, except for the first request being executed on the original version service, which continues to be executed on the original version service, the remaining subsequent requests will be executed on the target version service. This embodiment updates the original version service by updating the data status of the first metadata and the second metadata to an unmodifiable state, and then switching the service traffic from the original version service to the target version service. The first request being executed on the original version service can continue to be executed during the traffic switching, which weakens the user's perception of the traffic switching process, thereby effectively reducing the impact on the user's operations being performed during the traffic switching.
[0075] In some embodiments, Figure 2 As shown, Figure 2 It is a detailed step flow chart of step S110, where step S110 includes but is not limited to step S210, step S220, and step S230.
[0076] Step S210, obtaining the partition code of each service partition, the first service name of the original version service, and the second service name of the target version service from the registration center;
[0077] Step S220, obtaining the original version service according to the partition code and the first service name;
[0078] Step S230: Obtain the target version service according to the second service name.
[0079] Specifically, the original version service includes multiple service partitions. It can be understood that the service partition can also be regarded as a user partition, that is, each service partition contains a part of the user's clients. Subsequently, the original version is updated for a part of the clients, and then the scope is gradually expanded. To obtain the original version service and the target version service, first obtain the partition code of each service partition in the original version service, the first service name of the original version service, and the second service name of the target version service from the registration center, obtain the original version service according to the partition code and the first service name, and obtain the target version service according to the second service name.
[0080] In some embodiments, Figure 3 As shown, after the traffic switching message is sent to the gateway, a traffic switching method provided by the present invention further includes but is not limited to step S310 and step S320.
[0081] Step S310, updating the data status of the first metadata and the second metadata to a modifiable status;
[0082] Step S320: uninstall the original version service according to the modifiable state.
[0083] Specifically, after the traffic switch is completed, the data status of the first metadata and the second metadata is updated to a modifiable state, that is, the state in which the original version service and the target version service are operating normally at the beginning is restored, so that subsequent users can use the target version service normally. After the data status is updated to a modifiable state, the original version service can be uninstalled, and the user's subsequent operations will only be performed on the updated target version service. It can be understood that after the data status of the first metadata and the second metadata is updated to a modifiable state, if the user has no problem using the target version service, the traffic switching operation can continue to be performed on other service partitions according to the traffic switching method of the present application until all service traffic is switched to the target service version, and finally the original version service is uninstalled. Conversely, if the user has a problem using the target version, the traffic switching method of the present application can still be used to perform a rollback operation to switch the service traffic that has been switched to the target version service back to the original version service.
[0084] In some embodiments, Figure 4 As shown, after controlling the target version service to load the first metadata according to the unmodifiable state, a traffic switching method provided by the present invention further includes but is not limited to step S410 and step S420.
[0085] Step S410, obtaining loading status;
[0086] Step S420: Execute a first rollback operation according to the loading failure status.
[0087] Specifically, after controlling the target version service to load the first metadata according to the unmodifiable state, the loading status of the target version service loading the first metadata is obtained, and the loading status includes a loading failure status. When the obtained loading status is a loading failure status, that is, the target version service fails to load the first metadata, a first rollback operation will be executed. The first rollback operation includes: updating the data status of the first metadata and the second metadata to a modifiable state. At this time, the version update fails, and the traffic switching method of the present application can be re-executed subsequently to try to re-update the version.
[0088] In some embodiments, Figure 5 As shown, after controlling the target version service to load the first metadata according to the unmodifiable state, a traffic switching method provided by the present invention further includes but is not limited to step S510, step S520, and step S530.
[0089] Step S510, obtaining a preset system account;
[0090] Step S520, connecting to the target version service according to the system account to obtain the connection status;
[0091] Step S530: Execute a second rollback operation according to the connection failure status.
[0092] Specifically, after the target version service is controlled to load the first metadata, a preset system account is used to check whether the target version service can be used normally to prevent users from being unable to use the target version service normally after the traffic is switched. First, the preset system account is obtained, and then the target version service is connected according to the system account to obtain the connection status, which includes a connection failure status. When the connection status is a connection failure status, that is, the system account fails to connect to the target version service, a second rollback operation is performed, and the second rollback operation includes: updating the data status of the first metadata and the second metadata to a modifiable state, and controlling the target version service to unload the loaded first metadata.
[0093] In some embodiments, Figure 6 As shown, after obtaining the preset system account, a traffic switching method provided by the present invention also includes but is not limited to step S610, step S620, step S630, and step S640.
[0094] Step S610, connecting to the target version service according to the system account to obtain the connection status;
[0095] Step S620, obtaining target version data corresponding to the target version service according to the connection success status;
[0096] Step S630, synchronizing the first version data corresponding to each service partition to the target version data;
[0097] Step S640: synchronize the second version data corresponding to the registration center to the target version data.
[0098] Specifically, after obtaining the preset system account, the target version service is connected according to the system account to obtain the connection status, which includes a successful connection status. When the connection status is a successful connection status, that is, the system account is successfully connected to the target version service, the target version data corresponding to the target version service is obtained, and the first version data corresponding to each service partition loaded on the target version service is synchronized with the target version data, and the second version data corresponding to the registration center is synchronized with the target version data to realize the update of the version data.
[0099] In some embodiments, Figure 7 As shown, after synchronizing the second version data corresponding to the registration center to the target version data, a traffic switching method provided by the present invention further includes but is not limited to step S710, step S720, and step S730.
[0100] Step S710, verifying the second version data to obtain a verification result;
[0101] Step S720, generating a flow switching message according to the verification result;
[0102] Step S730, synchronizing the traffic switching message to the gateway.
[0103] Specifically, after the second version data corresponding to the registration center is synchronized with the target version data, the second version data is verified to obtain a verification result, which is used to confirm whether the second version data in the registration center has been updated. If the second version data in the registration center has been updated, a traffic switching message is generated and synchronized to the gateway, that is, the traffic switching message is sent to the gateway, so that the gateway switches the service traffic of the corresponding service partition on the original version service to the target version service after receiving the traffic switching message.
[0104] In some embodiments, Figure 8 As shown, Figure 8 It is a practical application flow chart of a traffic switching method provided by some embodiments of the present invention.
[0105] Specifically, firstly, the original version service and the target version service are obtained from the registration center. The original version service can be obtained according to the partition code of each service partition in the registration center and the name of the original version service. The target version service can be obtained according to the second service name of the target version service in the registration center. Then, the corresponding first metadata is obtained from the original version service according to the first request being executed in the original version service, and the corresponding second metadata is obtained from the target version service according to the second request being executed in the target version service. The data status of the first metadata and the second metadata is updated to an unmodifiable state, and then the target version service is controlled to load the first metadata according to the unmodifiable state. If the target version service fails to load the first metadata, a first rollback operation is performed, that is, the data status of the first metadata and the second metadata is updated to a modifiable state; if the target version service successfully loads the first metadata, a preset system account is obtained and the target version service is connected to the system account; if the preset system account fails to connect to the target version service, a second rollback operation is performed, that is, the data status of the first metadata and the second metadata is updated to a modifiable state, and the target version service is controlled to uninstall the loaded first metadata; if the preset system account successfully connects to the target version service, the target version data corresponding to the target version service is obtained, and the first version data corresponding to each service partition loaded on the target version service is changed to the target version data corresponding to the target version service. Version data, and the second version data corresponding to the registration center is changed to the target version data, the second version data is verified, and the verification result is obtained, which is used to confirm whether the second version data in the registration center has been updated. If the second version data in the registration center has been updated, a traffic switching message is generated, and the traffic switching message is synchronized to the gateway, that is, the traffic switching message is sent to the gateway, so that the gateway switches the service traffic of the corresponding service partition on the original version service to the target version service after receiving the traffic switching message. After the traffic switching is completed, the data status of the first metadata and the second metadata is updated to a modifiable state, and finally the original version service is uninstalled after the first request being executed on the original version service is completed. This application realizes the update of the original version service by updating the data status of the first metadata and the second metadata to an unmodifiable state, and then switching the service traffic from the original version service to the target version service, and the first request being executed on the original version service can continue to be executed during the traffic switching period, and the user's perception of the traffic switching process will be weakened, that is, for the user, the request issued is still executing normally, and basically no perception of the traffic switching operation is also being executed at the same time, which effectively reduces the impact on the user's operations being performed during the traffic switching period.Secondly, after updating the data status of the first metadata and the second metadata to an unmodifiable state, the present application controls the target version service to load the first metadata, thereby avoiding the inconsistency of the metadata between the target version service and the original version service due to subsequent changes in the first metadata, that is, it can maintain the consistency of the metadata before and after the traffic switching, that is, it can maintain the consistency of the metadata before and after the version update.
[0106] refer to Fig. 9 Some embodiments of the present invention further provide a traffic switching device, which includes a first acquisition module 910, a second acquisition module 920, a third acquisition module 930, a state modification module 940, a loading module 950, and a switching module 960. After the first acquisition module 910 acquires the original version service and the target version service, the second acquisition module 920 acquires the first request being executed in the original version service and the second request being executed in the target version service, and the third acquisition module 930 acquires the corresponding first metadata according to the first request, and acquires the corresponding second metadata according to the second request, and then uses the state modification module 940 to update the data status of the first metadata and the second metadata to an unmodifiable state, and then controls the target version service to load the first metadata through the loading module 950, and generates a traffic switching message according to the loading status of the first metadata loaded by the target version service, and the switching module 960 sends the traffic switching message to the gateway, so that the gateway switches the service traffic of the original version service to the target version service after receiving the traffic switching message. After the state modification module 940 updates the data state of the first metadata and the second metadata to an unmodifiable state, the present application uses the switching module 960 to switch the service traffic from the original version service to the target version service, thereby realizing the update of the original version service, and the first request being executed obtained from the original version service by the second acquisition module 920 can still continue to be executed during the traffic switching period, thereby reducing the probability of the first request being forced to be interrupted due to the traffic switching, resulting in execution failure, while weakening the user's perception of the traffic switching process, thereby effectively reducing the impact on the user's operations being performed during the traffic switching period. Secondly, after the state modification module 940 updates the data state of the first metadata and the second metadata to an unmodifiable state, the present application uses the loading module 950 to control the target version service to load the first metadata, thereby avoiding the subsequent change of the first metadata causing the metadata of the target version service and the original version service to be inconsistent, that is, it can maintain the consistency of the metadata before and after the traffic switching, that is, it can maintain the consistency of the metadata before and after the version update.
[0107] Some embodiments of the present invention further provide a flow switching device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, which can be used to execute the flow switching method in any of the above embodiments, for example, to execute the above described Figure 1 Steps S110 to S160 of the method, Figure 2 Steps S210 to S230 of the method, Figure 3 Steps S310 to S320 of the method, Figure 4 Steps S410 to S420 of the method, Figure 5 Steps S510 to S530 of the method, Figure 6 Steps S610 to S640 of the method, Figure 7 Method steps S710 to S730 in.
[0108] In addition, an embodiment of the present invention further provides a computer-readable storage medium, which stores computer-executable instructions, which are executed by one or more control processors, for example, by a processor in the above-mentioned device, so that the above-mentioned processor can execute the flow switching method in the above-mentioned embodiment, for example, execute the above-mentioned Figure 1 Steps S110 to S160 of the method, Figure 2 Steps S210 to S230 of the method, Figure 3 Steps S310 to S320 of the method, Figure 4 Steps S410 to S420 of the method, Figure 5 Steps S510 to S530 of the method, Figure 6 Steps S610 to S640 of the method, Figure 7 Method steps S710 to S730 in.
[0109] It will be appreciated by those skilled in the art that all or some of the steps and systems in the disclosed method above may be implemented as software, firmware, hardware and appropriate combinations thereof. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or a non-transitory medium) and a communication medium (or a temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that may be used to store desired information and may be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0110] The embodiments of the present invention are described in detail above in conjunction with the accompanying drawings, but the present invention is not limited to the above embodiments. Various changes can be made within the knowledge of ordinary technicians in the relevant technical field without departing from the purpose of the present invention. In addition, the embodiments of the present invention and the features in the embodiments can be combined with each other without conflict.
Claims
1. A flow switching method, characterized in that: include: Get the original version service and the target version service; Obtaining the first request being executed from the original version service, and obtaining the second request being executed from the target version service; Acquire corresponding first metadata from the original version service according to the first request, and acquire corresponding second metadata from the target version service according to the second request; Updating the data status of the first metadata and the second metadata to an unmodifiable state; Controlling the target version service to load the first metadata according to the unmodifiable state, and generating a traffic switching message according to the loading state; wherein the loading state refers to the loading state of the target version service loading the first metadata, and the loading state includes a loading success state and a loading failure state; when the loading state is the loading success state, generating the traffic switching message; The traffic switching message is sent to a gateway, so that the gateway switches the service traffic of the original version service to the target version service according to the traffic switching message.
2. The method according to claim 1, characterized in that The original version service includes multiple service partitions; the obtaining of the original version service and the target version service includes: Acquire the partition code of each service partition, the first service name of the original version service, and the second service name of the target version service from the registration center; Acquire the original version service according to the partition code and the first service name; The target version service is acquired according to the second service name.
3. The method according to claim 1, characterized in that: After sending the traffic switching message to the gateway so that the gateway switches the service traffic of the original version service to the target version service according to the traffic switching message, the method further includes: updating the data status of the first metadata and the second metadata to a modifiable status; The original version service is uninstalled according to the modifiable state.
4. The method according to any one of claims 1 to 3, characterized in that: After controlling the target version service to load the first metadata according to the unmodifiable state, the method further includes: Acquire the loading status; wherein the loading status includes a loading failure status; A first rollback operation is performed according to the loading failure status; wherein the first rollback operation includes: updating the data status of the first metadata and the second metadata to a modifiable status.
5. The method according to claim 2, characterized in that: After controlling the target version service to load the first metadata according to the unmodifiable state, the method further includes: Get the preset system account; Connecting to the target version service according to the system account to obtain a connection status, wherein the connection status includes a connection failure status; A second rollback operation is performed according to the connection failure state; wherein the second rollback operation includes: updating the data state of the first metadata and the second metadata to a modifiable state, and controlling the target version service to uninstall the first metadata.
6. The method according to claim 5, characterized in that After obtaining the preset system account, the method further includes: Connecting to the target version service according to the system account to obtain a connection status; wherein the connection status includes a connection success status; Acquire the target version data corresponding to the target version service according to the connection success status; Synchronizing the first version data corresponding to each of the service partitions to the target version data; The second version data corresponding to the registration center is synchronized to the target version data.
7. The method according to claim 6, characterized in that After synchronizing the second version data corresponding to the registration center to the target version data, the method further includes: Verifying the second version data to obtain a verification result; generating the flow switching message according to the verification result; The traffic switching message is synchronized to the gateway.
8. A flow switching device, characterized in that: include: The first acquisition module: used to acquire the original version service and the target version service; A second acquisition module: used to acquire the first request being executed from the original version service, and acquire the second request being executed from the target version service; A third acquisition module: configured to acquire corresponding first metadata from the original version service according to the first request, and acquire corresponding second metadata from the target version service according to the second request; A state modification module: used for updating the data state of the first metadata and the second metadata to an unmodifiable state; Loading module: used to control the target version service to load the first metadata according to the unmodifiable state, and generate a traffic switching message according to the loading state; wherein the loading state refers to the loading state of the target version service loading the first metadata, and the loading state includes a loading success state and a loading failure state; when the loading state is the loading success state, the traffic switching message is generated; Switching module: used to send the traffic switching message to the gateway, so that the gateway switches the service traffic of the original version service to the target version service according to the traffic switching message.
9. A flow switching device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the traffic switching method as described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the traffic switching method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Gray release upgrading method and device, computer system and readable storage medium
CN111736872A
Internet of Things equipment firmware remote updating method, device and system
CN112148326A