Software system switching method and device
By running the active and standby systems at the same time during software system switching, comparing execution results and switching, the problem of business interruption caused by downtime in the existing technology is solved, system switching without downtime is achieved, and system stability is improved.
Patent Information
- Application Number
- CN202310354965.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-31
- Publication Date
- 2024-10-01
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing software system switching methods usually require downtime, causing business interruption and affecting enterprise operations.
By running two software systems at the same time, one as the main system and the other as the backup system, the two systems compare the execution results of business requests. When the results are consistent, the main and backup switches are performed to avoid downtime.
This eliminates the need for downtime during software system switching, avoids business interruption, and improves system stability and reliability.
Smart Images

Figure CN118733208A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a method and device for switching a software system. Background Art
[0002] With the continuous development of software technology, the performance, cost-effectiveness and other aspects of the old software system may be inferior to the new software system. In this case, there will be a need to use other software systems to replace the current software system.
[0003] If an enterprise currently uses the software system of manufacturer A, because the performance and cost-effectiveness of the software system of manufacturer A are not as good as the software system of manufacturer B, then the enterprise needs to switch from the software system of manufacturer B to the software system of manufacturer A. At present, when implementing a software system, a one-time switching method is usually adopted, that is, the new software system is verified offline, and then a time point is selected to shut down and switch to the old software system at one time.
[0004] The above switching methods require downtime, which causes users to be unable to use the software system normally during the downtime, resulting in business interruption, which may have a significant impact on the business. Summary of the invention
[0005] The present disclosure provides a method and device for software system switching, which can avoid the problem of service interruption caused by downtime when switching to a new software system. The corresponding technical solution is as follows:
[0006] In a first aspect, a method for software system switching is provided, the method comprising: after obtaining a first service request, sending the first service request to both a first software system and a second software system, wherein the first software system is the current main software system and the second software system is the current backup software system. The first software system returns a first execution result of the first service request, and the second software system returns a second execution result of the first service request. The first execution result and the second execution result are compared, and when the comparison result meets the software system switching condition, the second software system is switched to the main software system, and the first software system is switched to the backup software system.
[0007] In the solution provided by the present disclosure, both software systems will run, one as the main software system and the other as the backup software system. When the comparison result of the execution results of the two software systems meets the software system switching condition, the main and backup switching will be directly performed, and the previous backup software system will be switched to the main software system, and the previous main software system will be switched to the backup software system. In this way, the backup software system can be switched to the main software system without stopping the whole process, avoiding business interruption caused by downtime.
[0008] In one possible implementation, the first service request obtained may carry a first user identifier, a first interface identifier, and a first session identifier. In this case, if the second service request obtained also carries the first user identifier, the first interface identifier, and the first session identifier, the first service request and the second service request are sent concurrently to the second software system.
[0009] In the solution provided by the present disclosure, multiple service requests carrying the same user identifier, interface identifier and session identifier can be sent to the second software system concurrently, thereby improving the efficiency of sending the service requests.
[0010] In one possible implementation, the number of consistent execution results of the first software system and the second software system for business requests, as well as the total number of business requests executed by both the first software system and the second software system can be counted, and whether the software system switching conditions are met can be determined based on the number of consistent execution results and the total number.
[0011] In the solution provided by the present disclosure, when it is determined that the comparison result is that the execution result is consistent, the number of consistent execution results is increased by 1, and the total number of business requests executed by both the first software system and the second software system is determined, and the proportion of the current number of consistent execution results in the total number is calculated. When the number of consistent execution results is greater than the first threshold and the proportion is greater than the second threshold, it is determined that the software system switching condition is met, and the second software system is switched to the main software system, and the first software system is switched to the backup software system. In this way, the contingency of the consistent comparison result can be avoided, so that when the second software system is switched to the main system, the second software system is relatively stable.
[0012] In a possible implementation, in the solution provided by the present disclosure, the first software system corresponds to a first database, the second software system corresponds to a second database, and the database primary key identifier generation mechanisms of the first database and the second database may be different. In this case, if the database primary key identifier of the first database is used as a query condition to query data in the second database, the query may fail. In order to solve this problem, in the solution provided by the present disclosure, a primary key mapping table can also be established. Accordingly, when it is determined that there is first newly added data in the first database corresponding to the first software system, the first business primary key identifier corresponding to the first newly added data and the first database primary key identifier corresponding to the first database are determined, and the corresponding relationship between the first database primary key identifier and the first business primary key identifier is added to the primary key identifier mapping table.
[0013] When it is determined that there is second new data in the second database corresponding to the second software system, determine the second business primary key identifier corresponding to the second new data and the corresponding second database primary key identifier in the second database, and add the correspondence between the second database primary key identifier and the second business primary key identifier in the primary key identifier mapping table.
[0014] In a possible implementation, on the basis of establishing a primary key identifier mapping table, the target database primary key identifier is carried in the first business request, and when the first execution result is execution failure, in the scheme provided by the present disclosure, the target business primary key identifier corresponding to the target database primary key identifier can be determined in the primary key identifier mapping table, and the database primary key identifier corresponding to the target business primary key identifier in the second database can be determined. Then, the target database primary key identifier in the first business request can be replaced with the database primary key identifier corresponding to the target business primary key identifier in the second database, and the replaced first business request can be sent to the first software system.
[0015] In a possible implementation, considering that the second software system is a new software system and will be used for a long time in the future, if the primary key identifier mapping is required every time the primary key identifier of the first database is used to access the second database, a lot of computing resources will be wasted. In order to solve this problem, in the solution provided by the present disclosure, before switching the second software system to the main software system, the first database primary key newly added in the first database during the period when the first software system was the main software system can be used to replace the corresponding second database primary key identifier in the second database. In this way, the first database primary key identifier can be used to access the second database.
[0016] In a second aspect, a device for switching a software system is provided, the device comprising:
[0017] An acquisition module, used to acquire a first service request;
[0018] a sending module, configured to send the first service request to a first software system, and obtain a first execution result of the first service request by the first software system, wherein the first software system is a current primary software system; and send the first service request to a second software system, and obtain a second execution result of the first service request by the second software system, wherein the second software system is a current backup software system;
[0019] The switching module is used to determine the comparison result of the first execution result and the second execution result, and when the comparison result meets the software system switching condition, the second software system is switched to the main software system and the first software system is switched to the backup software system.
[0020] In a possible implementation manner, the first service request carries a first user identifier, a first interface identifier, and a first session identifier, and the acquisition module is further used to:
[0021] Obtaining a second service request;
[0022] The sending module is further used to send the second service request to the first software system, wherein the second service request carries the first user identifier, the first interface identifier and the first session identifier;
[0023] The sending module is used for:
[0024] If it is determined that the user identifier, interface identifier, and session identifier carried in the first service request and the second service request are the same, the first service request and the second service request are sent to the second software system concurrently.
[0025] In a possible implementation, the switching module is used to:
[0026] Determine that the comparison result is consistent with the execution result, and increase the number of consistent execution results by 1;
[0027] determining a total number of service requests executed by both the first software system and the second software system;
[0028] Determine the proportion of the current number of consistent execution results in the total number;
[0029] When the number of consistent execution results is greater than a first threshold and the proportion is greater than a second threshold, it is determined that the software system switching condition is met, the second software system is switched to the main software system, and the first software system is switched to the backup software system.
[0030] In a possible implementation manner, the device further includes a mapping module, configured to:
[0031] Determine first newly added data in a first database corresponding to the first software system;
[0032] Determine a first business primary key identifier corresponding to the first newly added data and a first database primary key identifier corresponding to the first database;
[0033] In the primary key identifier mapping table, a correspondence between the first database primary key identifier and the first business primary key identifier is added.
[0034] In a possible implementation, the mapping module is further configured to:
[0035] Determine second newly added data in a second database corresponding to the second software system;
[0036] Determine a second business primary key identifier corresponding to the second newly added data and a second database primary key identifier corresponding to the second database;
[0037] In the primary key identifier mapping table, a correspondence between the second database primary key identifier and the second business primary key identifier is added.
[0038] In a possible implementation, the first service request carries a primary key identifier of a target database, the first execution result is execution failure, and the mapping module is further configured to:
[0039] In the primary key identifier mapping table, determine the target business primary key identifier corresponding to the target database primary key identifier, and determine the database primary key identifier corresponding to the target business primary key identifier in the second database;
[0040] The target database primary key identifier in the first service request is replaced with a database primary key identifier corresponding to the target service primary key identifier in the second database, and the replaced first service request is sent to the first software system.
[0041] In a possible implementation manner, the device further includes a replacement module, configured to:
[0042] During the determination that the first software system is the primary business system, the third database primary key identifiers and the third business primary key identifiers corresponding to each newly added data in the first database respectively;
[0043] For each third business primary key identifier, the database primary key identifier corresponding to the third business primary key and the database primary key identifier corresponding to the third business primary key identifier in the second database are replaced with the third database primary key identifier corresponding to the third business primary key identifier.
[0044] In a third aspect, a computing device cluster is provided, which includes at least one computing device, each computing device including a processor and a memory, wherein the processor of at least one computing device is used to execute instructions stored in the memory of at least one computing device, so that the computing device cluster performs the method as described in the first aspect or in any achievable manner of the first aspect.
[0045] In a fourth aspect, a computer program product comprising instructions is provided. When the instructions are executed by a computing device cluster, the computing device cluster executes the method as described in the first aspect or in any implementable manner of the first aspect.
[0046] In a fifth aspect, a computer-readable storage medium is provided, comprising computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster can execute the method as described in the first aspect or in any achievable manner of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 is a schematic diagram of an implementation scenario provided by an embodiment of the present disclosure;
[0048] Figure 2 is a schematic diagram of an implementation scenario provided by an embodiment of the present disclosure;
[0049] Figure 3 is a flow chart of a method for switching a software system provided by an embodiment of the present disclosure;
[0050] Figure 4 It is a schematic diagram of a device structure for switching a software system provided by an embodiment of the present disclosure;
[0051] Figure 5 is a schematic diagram of a computer device provided by an embodiment of the present disclosure;
[0052] Figure 6 is a schematic diagram of a computer device cluster provided by an embodiment of the present disclosure;
[0053] Figure 7 It is a schematic diagram of a computer device cluster provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0054] In order to make the objectives, technical solutions and advantages of the present disclosure more clear, the embodiments of the present disclosure will be further described in detail below with reference to the accompanying drawings.
[0055] The embodiment of the present disclosure provides a method for software system switching, in which each received service request is forwarded to both the first software system (i.e., the old software system) and the second software system (i.e., the new software system), and the execution results returned by the old software system and the new software system are obtained, and then the execution results of the two software systems are compared, and when the software system switching conditions are met, the new software system is switched to the main software system and the old software system is switched to the backup software system. It can be seen that in the method for software system switching provided by the present disclosure, there is no need to perform shutdown processing, and the new and old software systems run at the same time to execute the same service request. After the execution result of the new software system meets the requirements, the new software system can be directly used as the main software system.
[0056] See also Figure 1, shows an implementation scenario of the present disclosure, in which the user side, the business middle platform and the software system are included. Among them, software system A is the old software system currently in use and in operation. Software system A can also be called business background A or background system A. Software system B is a new software system that is used to replace the old software system and has not yet been run. Software system B can also be called business background B or background system B. The software system can be various types of enterprise-oriented (2B, to business) software systems, such as operator operation support systems, enterprise product data management (PDM, Product Data Management) systems, customer relationship management (CRM, Customer Relationship Management) systems, etc. In addition, the deployment method of the software system can be local deployment or software as a service (SaaS, Software as a Service) mode deployment.
[0057] See also Figure 2 ,exist Figure 1 On the basis of the implementation scenario shown, the embodiment of the present disclosure introduces a software system switching device between the business middle station and the software system, and in the embodiment of the present disclosure, software system A and software system B can be in operation at the same time. The software system switching device can be used to implement the method of software system switching provided by the present disclosure. The software system switching device can be a computing device such as a computer device, a computer device cluster, etc. In one possible implementation, the software system switching device can also reuse deployed devices, such as reusing devices that deploy the business middle station.
[0058] The following is a description of the software system switching method provided by the present disclosure in conjunction with the accompanying drawings. The method can be performed by the above Figure 2 The software system switching device implementation shown in , see Figure 3 , the processing of this method may include the following steps.
[0059] Step 301: Get a service request.
[0060] In implementation, when a user has a business need, the user triggers the business middle station to send a first business request to the software system switching device through the user terminal. Correspondingly, the software system switching device receives the first business request from the business middle station. Exemplarily, the first business request can be an update request, a creation request, a query request, etc. for business data.
[0061] Step 302: Send the service request to the first software system.
[0062] Among them, the first software system is the current main software system, that is, the old software system, such as Figure 1 or Figure 2 Software system A in .
[0063] In implementation, the software system switching device can record which software system is the main software system and which software system is the backup software system. Exemplarily, a main and backup status record table can be used for recording, and the main and backup status record table can be shown in Table 1 below.
[0064] Table 1
[0065] Main software system Backup software system First software system Second software system
[0066] After receiving the service request, the software system switching device determines that the primary software system is the first software system by querying the primary and secondary status record table, and then forwards the first service request to the first software system to call the first software system to execute the service request.
[0067] In a possible implementation, the software system switching device can record each service request received, and when recording, a service request identifier can be assigned to the service request, and different service requests correspond to different service request identifiers. Exemplarily, a service request record table can be used for recording, and the service request record table can be shown in Table 2 below.
[0068] Table 2
[0069]
[0070] Among them, API id is used to identify the interface that needs to be called to execute the business request, header is the header of the business request, body is the main body of the business request, and API id, header and body are all carried in the business request.
[0071] The following uses an example to illustrate recording a service request.
[0072] After receiving the first business request, the software system switching device creates a business request record row corresponding to the first business request in the business request record table, adds a business request identifier 3 in the business request identifier column of the business request record row, adds the interface identifier RSXXX1 carried in the first business request in the interface identifier column, adds the request header H2 of the first business request in the request header column, and adds the request body B3 of the first business request in the request body column.
[0073] Step 303: Obtain a first execution result of the first software system on the business request.
[0074] In implementation, after the first software system executes the service request, it can call back the bidirectional gateway service interface and return the first execution result to the software system switching device, where the first execution result can be execution success (success) or execution failure (fail).
[0075] In a possible implementation, the software system switching device may record the execution result of the main software system on the service request. Exemplarily, an execution result record table may be used for recording, and the execution result record table may be shown in Table 3 below.
[0076] Table 3
[0077]
[0078] Among them, each id corresponds to a business request, and the id in Table 3 can be the same as the call id in Table 2. The creation time in Table 3 refers to the recording time of the execution result of the corresponding business request. The update time of the execution result of the main software system in Table 3 refers to the update time of the execution result of the corresponding business request by the main software system.
[0079] The following uses an example to illustrate recording the execution result of the main software system on the business request. In the following example, the first software system is the current main software system.
[0080] After forwarding the first business request to the first software system, the software system switching device can create an execution result record row with id 3 in the execution result record table as the execution result record row corresponding to the first business request. Then, in the execution result record row with id 3, the execution result of the first software system is initialized to start, and the creation time is recorded as T3, and the update time is also T3. After receiving the execution result of the first business request returned by the first software system, it is determined that the execution result is success. Then, the execution result record row with id 3 in the above Table 3 is updated. Specifically, the execution result of the first software system can be updated to success in the execution result record row with id 3, and the update time of the execution result of the first software system can be updated to T13. After the update is completed, the above Table 3 can be updated to the following Table 4.
[0081] Table 4
[0082] id create time Execution results of the main software system master update time 1 T1 success T11 2 T2 fail T12 3 T3 success T13 …… …… …… ……
[0083] Step 304: Send the service request to the second software system.
[0084] Among them, the second software system is the current backup software system, that is, the new software system, such as Figure 1 or Figure 2 Software system B in.
[0085] In implementation, the software system switching device may forward the first service request to the second software system.
[0086] In a possible implementation, in order to save processing resources of the second software system, the software system switching device may forward the service request to the second software system only when the execution result of the service request by the first software system is successful.
[0087] Specifically, after receiving the execution result of the first business request returned by the first software system, if the execution result is determined to be successful, the software system switching device adds the business request task of the first business request to the task queue. If there is a business request task in the task queue, the software system switching device can forward the business request corresponding to the business request task to the second software system and delete the business request task in the task queue.
[0088] In another possible implementation, in order to improve the second software system's processing of service request messages, service requests carrying the same user identifier, the same session identifier and the same interface identifier are treated as service requests of the same batch and can be sent concurrently to the second software system.
[0089] Specifically, the software system switching device can record the user ID, session ID and batch ID. Among them, the user ID and session ID are carried in the service request. After receiving the service request, the software system switching device can obtain the user ID and session ID carried in the service request. As for the batch ID, it can be allocated by the software system switching device, and the service requests carrying the same user ID, session ID and interface ID are allocated the same batch ID. Exemplarily, this information can be recorded through an extended service request record table, and the extended service request record table can be shown in Table 5 below.
[0090] Table 5
[0091] call id user id session id batch id API id header body 1 user1 session1 batch1 RSXXX1 H1 B1 2 user1 session1 batch1 RSXXX1 H2 B2 3 user1 session2 batch2 RSXXX2 H3 B3 …… …… …… …… …… …… ……
[0092] The following uses an example to illustrate how to record business requests using the expanded business request record table.
[0093] For example, the user identifier carried in the first business request is user1, the session identifier is session2, the interface identifier is RSXXX2, the request header is H3, and the request body is B3. After receiving the first business request, the software system switching device creates a business request record row corresponding to the first business request in the business request record table, adds the business request identifier 3 in the business request identifier column of the business request record row, adds the user identifier user1 in the user identifier column of the business request record row, adds the session identifier session2 in the session identifier column of the business request record row, adds the interface identifier RSXXX2 in the interface identifier column of the business request record row, adds the request header H3 of the first business request in the request header column of the business request record row, and adds the request body B3 of the first business request in the request body column of the business request record row. In addition, if it is determined that there are no other business requests with the same user identifier, session identifier, and interface identifier as those carried in the first business request recorded in the business request record table, a new batch identifier batch2 is allocated to the first business request, and the batch identifier batch2 is added to the batch identifier column of the business request record row.
[0094] For another example, the user identifier carried in the second business request is user1, the session identifier is session1, the interface identifier is RSXXX1, the request header is H2, and the request body is B2. After receiving the second business request, the software system switching device creates a business request record row corresponding to the second business request in the business request record table, adds the business request identifier 3 to the business request identifier column of the business request record row, adds the user identifier user1 to the user identifier column of the business request record row, adds the session identifier session2 to the session identifier column of the business request record row, adds the interface identifier RSXXX2 to the interface identifier column of the business request record row, adds the request header H2 of the first business request to the request header column of the business request record row, and adds the request body B2 of the first business request to the request body column of the business request record row. In addition, it is determined that other business requests with the same user identifier, session identifier, and interface identifier as those carried in the second business request are recorded in the business request record table, and the batch identifier corresponding to the other business request is batch1, then the batch identifier batch1 is added to the batch identifier column of the business request record row.
[0095] In the case of assigning batch identifiers to business requests, the software system switching device can periodically obtain business request tasks in the task queue and determine the business requests corresponding to the obtained business request tasks. Then, the above-mentioned business request record table is queried. If there are multiple business requests corresponding to the same batch identifier in the determined business requests, the multiple business requests are forwarded to the second software system concurrently. Among them, the cycle of obtaining business request tasks can be configured according to actual needs. For example, the cycle is 1 second, 2 seconds, etc.
[0096] Step 305: Obtain a second execution result of the second software system on the business request.
[0097] In implementation, after the second software system executes the service request, it can call back the software system switching device service interface and return the second execution result to the software system switching device, wherein the second execution result can be execution success or execution failure.
[0098] In a possible implementation, the software system switching device can record the execution result of the standby software system on the service request. The execution result of the standby software system on the service request can be recorded separately or together with the execution result of the main software system on the service request. Figure 4 The execution result recording table shown is expanded to record the execution results of the main software system and the backup software system. The expanded execution result recording table can be shown in Table 6 below.
[0099] Table 6
[0100]
[0101] The following uses an example to illustrate recording the execution result of the second software system on the service request.
[0102] After forwarding the first service request to the second software system, the software system switching device can initialize the execution result of the standby software system to start in the execution result record row corresponding to the first service request, and record the update time T4 of the execution result of the standby software system. After receiving the execution result of the second service request returned by the second software system, it is determined that the execution result is success. Then, the execution result record row with id 3 in the above Table 6 is updated. Specifically, the execution result of the standby software system can be updated to success in the execution result record row with id 3, and the update time of the execution result of the second software system can be updated to T23. After the update is completed, the above Table 6 can be updated to the following Table 7.
[0103] Table 7
[0104]
[0105] In addition, in the case where the second software system fails to execute the service request, the software system switching device can allow the second software system to retry the service request N times. If the N retries fail, an alarm can be sent to the management device so that relevant personnel can be informed of the failure of the second software system to execute the service request and optimize the second software system. Each retry means that the software system switching device resends the service request to the second software system. The above N can be configured according to actual needs. For example, N takes a value of 3, 5, etc. If the second software system successfully retries the service request, the software system switching device can update the execution result of the standby software system on the service request to success in the execution result record table.
[0106] The above management device may be a terminal device, such as a computer device, a mobile phone, etc.
[0107] Step 306: Determine a comparison result between the first execution result and the second execution result. If the comparison result satisfies the software system switching condition, switch the second software system to the main software system and switch the first software system to the backup software system.
[0108] In implementation, after obtaining the first execution result of the first software system for the business request and the second execution result of the second software system for the business request, the software system switching device compares the first execution result and the second execution result. If the first execution result and the second execution result are the same and both are successful, the number of consistent execution results is increased by 1. In addition, the software system switching device can also record the total number of business requests executed by both the first software system and the second software system, and when the calculation conditions are met, calculate the proportion of the current number of consistent execution results in the current total number. Furthermore, the software system switching device can determine whether to switch the second software system to the main software system and the first software system to the backup software system based on the proportion.
[0109] For example, the calculation condition may be a change in the number of consistent execution results, a change in the total number, or any condition in the calculation cycle. The calculation cycle may be configured according to actual needs, for example, the calculation cycle may be configured to 30 minutes, 1 hour, etc.
[0110] The following describes how to determine whether to switch the second software system to the main software system and the first software system to the standby software system. There are many methods for determining whether to switch the second software system to the main software system and the first software system to the standby software system. The following lists several methods by way of example.
[0111] Method 1:
[0112] The software system switching device can send the current number of consistent execution results, the current total number, and the proportion of the current number of consistent execution results in the current total number to the management device. Furthermore, the management device can notify the relevant personnel of these three values, and the relevant personnel can judge whether the second software system can be switched to the main software system and the first software system can be switched to the backup software system based on these three values. In the case where it is judged that the switch can be made, the relevant personnel can send a main-backup switching instruction to the software system switching device through the management device. After receiving the main-backup switching instruction, the software system switching device switches the first software system to the backup software system and switches the second software system to the main software system.
[0113] Exemplarily, the management device may notify the relevant personnel of the above three values by displaying them on a display screen, or by sending emails, instant messaging messages, text messages, and other methods to the terminal devices of the relevant personnel.
[0114] In method 1, the software system switching device can report the above three values periodically, or report the above three values when the proportion changes. In the case of periodic reporting, the reporting period can be configured according to actual needs. For example, the reporting period can be 1 hour, 30 minutes, etc.
[0115] Method 2:
[0116] When the software system switching device determines that the number of the current consistent execution results is greater than the first threshold, and the proportion of the current consistent execution results in the current total number is greater than the second threshold, it determines that the software system switching condition is met, switches the first software system to the backup software system, and switches the second software system to the main software system. The first threshold and the second threshold can be configured according to actual needs. For example, the first threshold is 500, 1000, etc., and the second threshold is 99%, 99.9%, etc.
[0117] When the master-slave status record table is used, when the first software system is switched to the backup software system and the second software system is switched to the master software system, the master-slave status record table can be updated. For example, the master-slave status record table shown in Table 1 can be updated to the master-slave status record table shown in Table 8 below.
[0118] Table 8
[0119] Main software system Backup software system Second software system First software system
[0120] In one possible implementation, the first software system corresponds to a first database, and the second software system corresponds to a second database. The database primary key identifier (id) generation mechanism of the first database and the second database may be different. In this case, if the database primary key id of the first database is used as a query condition to query data in the second database, the query may fail. Based on this, in the embodiment of the present disclosure, primary key id mapping can also be implemented. Specifically, the software system switching device can establish a correspondence between the database primary key id of the first database, the database primary key id of the second database, and the business primary key id to implement primary key id mapping. The corresponding processing can be as follows:
[0121] The software system switching device can monitor the addition and deletion changes of data in the first database and the second database. If new data is detected in the first database, the business primary key id corresponding to the new data and the first database primary key id in the first database are obtained, and the obtained business primary key id and first database primary key id are recorded in the primary key id mapping table accordingly.
[0122] Similarly, if new data is detected in the second database, the business primary key id corresponding to the new data and the second database primary key id in the first database are obtained, and the obtained business primary key id and second database primary key id are recorded in the primary key id mapping table.
[0123] Exemplarily, the primary key id mapping table may be as shown in Table 9 below.
[0124] Table 9
[0125]
[0126] The establishment of the first database primary key ID, the second database primary key ID and the business primary key ID is described below with reference to an example.
[0127] When the software system switching device monitors that the first software system is the main software system and there is new data in the first database, it determines that the business primary key id corresponding to the new data is A3, and determines that the first database primary key id of the new data in the first database is old3. Furthermore, in the primary key id mapping table, the business primary key id is A3, the first software system is the main software system, and the first database primary key id is old3.
[0128] When the software system switching device monitors that the second software system is a standby software system and there is new data in the second database, it determines that the business primary key id corresponding to the new data is A3, and determines that the second database primary key id of the new data in the second database is new3. Furthermore, in the row of the business primary key id A3 in the primary key id mapping table, it is recorded that the second software system is a standby software system and the second database primary key id is new3.
[0129] The following takes the second software system receiving a service request as an example to illustrate the use of the primary key id mapping table to perform primary key id mapping.
[0130] After receiving the service request, the second software system obtains the target database primary key ID carried in the service request, and uses the target database primary key ID to query the second database for data. If the second database successfully queries the data, it returns the queried data to the second software system. If the second database fails to query the data, it returns empty.
[0131] When the second software system determines that the second database is returned as empty, the second software system sends a primary key id mapping query request to the software system switching device. Accordingly, the software system switching device can determine that the execution result of the second software system for the business request is an execution failure. Then, the software system switching device determines that the primary key id mapping query request is sent by the second software system, and it can be determined that the target database primary key id is not the second database primary key id of the second database, but the first database primary key id of the first database. Furthermore, when the software system switching device queries the primary key id of the first database for the primary key id of the target database in the primary key id mapping table, the corresponding second database primary key id.
[0132] Then, the software system switching device replaces the target database primary key ID in the service request with the queried second database primary key ID, and resends the replaced service request to the second software system.
[0133] The following describes the primary key id mapping in conjunction with Table 9 above.
[0134] After receiving the service request, the second software system determines that the target database primary key id carried in the service request is old3, and uses the target database primary key id to query data in the second database. If the second database successfully queries the data, it returns the queried data to the second software system. If the second database fails to query the data, it returns a query failure message to the second software system.
[0135] After receiving the query failure message returned by the second database, the second software system forwards the query failure message to the software system switching device. The software system switching device determines that the query failure message is sent by the second software system, and can determine that old3 is not the second database primary key id of the second database, but the first database primary key id of the first database. Furthermore, when the software system switching device queries the primary key id of the first database in the primary key id mapping table and finds that the primary key id of the first database is old3, the corresponding primary key id of the second database is new3.
[0136] Then, the software system switching device replaces the target database primary key id in the service request with new3, and resends the replaced service request to the second software system.
[0137] In another possible implementation, since the second software system is a new software system and will be used for a long time in the future, if the primary key id mapping is required every time the primary key id of the first database is used to access the second database, a lot of computing resources will be wasted. Therefore, before switching the second software system to the main software system, the first database primary key newly added in the first database during the period when the first software system is the main software system can be used to replace the corresponding second database primary key id in the second database. Specifically, the replacement process can be as follows:
[0138] The software system switching device determines the business primary key id corresponding to the first database primary key id, and replaces the second database primary key id corresponding to the business primary key id with the first database primary key id corresponding to the business primary key id in the second database.
[0139] The replacement process is described below using an example.
[0140] Assume that the primary key id of the first database is old3, determine that the business primary key id corresponding to old3 is A3, and in the second database determine that the business primary key id is A3 and the corresponding second database primary key id is new3, replace new3 with old3.
[0141] The above replacement process occurs before the second software system switches to the main software system. Specifically, when the software system switching device determines that the software system switching conditions are met, it can first perform the above replacement process, then switch the second software system to the main software system, and switch the first software system to the backup software system.
[0142] In another possible situation, considering that the second software system may be affected by performance, stability, etc., the second software system may be switched back to the backup software system and the first software system may be switched back to the main software system. After a period of time, if the second software system is optimized, the second software system will be switched back to the main software system and the first software system will be switched back to the backup software system. When the management personnel believe that the performance, stability, etc. of the second software system meet the requirements, the operation of the first software system can be terminated through the management device and only the second software system can be used.
[0143] In this case, the above replacement process may be performed not only before the second software system is switched to the main software system for the first time, but also before the second software system is switched to the main software system each time thereafter.
[0144] In addition, when the second software system is just deployed, it serves as a backup software system. Since the second software system has not been run at this time, no business data is stored in its corresponding second database. In this case, the business data in the first database can be written into the second database. When writing, the first database primary key ID in the first database will also be written into the second database along with the business data.
[0145] In one possible implementation, the various processes performed by the software system switching device can be implemented by the same software service or by different software services, and the present disclosure does not limit this. Exemplarily, the primary key id mapping performed by the above-mentioned software system switching device can be implemented by the primary key id mapping service deployed by it, the primary key id replacement can be implemented by the primary key id synchronization service deployed by it, and the remaining processes performed by it can be implemented by the dual-write gateway service. Of course, the software system switching device can be a computer device cluster, and accordingly, different software services can be deployed on different computer devices in the computer device cluster, or on the same computer device, and the present disclosure does not limit this either.
[0146] Based on the same technical concept, the present disclosure also provides a device for switching a software system, which is applied to a software system switching device, such as Figure 4 As shown, the device comprises:
[0147] An acquisition module 410 is used to acquire a first service request;
[0148] The sending module 420 is configured to send the first service request to a first software system to obtain a first execution result of the first service request by the first software system, wherein the first software system is a current primary software system; send the first service request to a second software system to obtain a second execution result of the first service request by the second software system, wherein the second software system is a current backup software system;
[0149] The switching module 430 is used to determine the comparison result of the first execution result and the second execution result, and when the comparison result meets the software system switching condition, the second software system is switched to the main software system and the first software system is switched to the backup software system.
[0150] In a possible implementation, the first service request carries a first user identifier, a first interface identifier, and a first session identifier, and the acquisition module 410 is further configured to:
[0151] Obtaining a second service request;
[0152] The sending module 420 is further configured to send the second service request to the first software system, wherein the second service request carries the first user identifier, the first interface identifier, and the first session identifier;
[0153] The sending module 420 is used to:
[0154] If it is determined that the user identifier, interface identifier, and session identifier carried in the first service request and the second service request are the same, the first service request and the second service request are sent to the second software system concurrently.
[0155] In a possible implementation, the switching module 430 is used to:
[0156] Determine that the comparison result is consistent with the execution result, and increase the number of consistent execution results by 1;
[0157] determining a total number of service requests executed by both the first software system and the second software system;
[0158] Determine the proportion of the current number of consistent execution results in the total number;
[0159] When the number of consistent execution results is greater than a first threshold and the proportion is greater than a second threshold, it is determined that the software system switching condition is met, the second software system is switched to the main software system, and the first software system is switched to the backup software system.
[0160] In a possible implementation manner, the device further includes a mapping module, configured to:
[0161] Determine first newly added data in a first database corresponding to the first software system;
[0162] Determine a first business primary key identifier corresponding to the first newly added data and a first database primary key identifier corresponding to the first database;
[0163] In the primary key identifier mapping table, a correspondence between the first database primary key identifier and the first business primary key identifier is added.
[0164] In a possible implementation, the mapping module is further configured to:
[0165] Determine second newly added data in a second database corresponding to the second software system;
[0166] Determine a second business primary key identifier corresponding to the second newly added data and a second database primary key identifier corresponding to the second database;
[0167] In the primary key identifier mapping table, a correspondence between the second database primary key identifier and the second business primary key identifier is added.
[0168] In a possible implementation, the first service request carries a primary key identifier of a target database, the first execution result is execution failure, and the mapping module is further configured to:
[0169] In the primary key identifier mapping table, determine the target business primary key identifier corresponding to the target database primary key identifier, and determine the database primary key identifier corresponding to the target business primary key identifier in the second database;
[0170] The target database primary key identifier in the first service request is replaced with a database primary key identifier corresponding to the target service primary key identifier in the second database, and the replaced first service request is sent to the first software system.
[0171] In a possible implementation manner, the device further includes a replacement module, configured to:
[0172] During the determination that the first software system is the primary business system, the third database primary key identifiers and the third business primary key identifiers corresponding to each newly added data in the first database respectively;
[0173] For each third business primary key identifier, the database primary key identifier corresponding to the third business primary key and the database primary key identifier corresponding to the third business primary key identifier in the second database are replaced with the third database primary key identifier corresponding to the third business primary key identifier.
[0174] Among them, the acquisition module 410, the sending module 420 and the switching module 430 can all be implemented by software, or can be implemented by hardware. Exemplarily, the following takes the acquisition module 410 as an example to introduce the implementation of the acquisition module 410. Similarly, the implementation of the sending module 420 and the switching module 430 can refer to the implementation of the acquisition module 410.
[0175] As an example of a software functional unit, the acquisition module 410 may include code running on a computing instance. Among them, the computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the above-mentioned computing instance may be one or more. For example, the acquisition module 410 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region (region) or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including a data center or multiple data centers with close geographical locations. Among them, usually a region may include multiple AZs.
[0176] Similarly, multiple hosts / virtual machines / containers used to run the code can be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Usually, a VPC is set up in a region. For cross-region communication between two VPCs in the same region and between VPCs in different regions, a communication gateway needs to be set up in each VPC to achieve interconnection between VPCs through the communication gateway.
[0177] As an example of a hardware functional unit, the acquisition module 410 may include at least one computing device, such as a server, etc. Alternatively, the acquisition module 410 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.
[0178] The multiple computing devices included in the acquisition module 410 can be distributed in the same region or in different regions. The multiple computing devices included in the acquisition module 410 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the acquisition module 410 can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.
[0179] In other embodiments, the acquisition module 410 can be used to execute any step in the method of software system switching, the sending module 420 can be used to execute any step in the method of software system switching, and the switching module 430 can be used to execute any step in the method of software system switching. The steps that the acquisition module 410, the sending module 420 and the switching module 430 are responsible for implementing can be specified as needed. The full functions of the device for software system switching are realized by respectively implementing different steps in the method of software system switching by the acquisition module 410, the sending module 420 and the switching module 430.
[0180] The software system switching device provided in the above embodiment only uses the division of the above functional modules as an example when processing cloud resources. In actual applications, the above functional distribution can be completed by different functional modules as needed, that is, the internal structure of the software system switching device is divided into different functional modules to complete all or part of the functions described above. In addition, the software system switching device provided in the above embodiment and the method embodiment of software system switching belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0181] The present disclosure also provides a computing device 100. The computing device 100 may be the software system switching device. Figure 5 As shown, the computing device 100 includes: a bus 102, a processor 104, a memory 106, and a communication interface 108. The processor 104, the memory 106, and the communication interface 108 communicate with each other through the bus 102. The computing device 100 can be a server or a terminal device. It should be understood that the present disclosure does not limit the number of processors and memories in the computing device 100.
[0182] The bus 102 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 The bus 104 is represented by only one line, but does not mean that there is only one bus or one type of bus. The bus 104 may include a path for transmitting information between various components of the computing device 100 (eg, the memory 106, the processor 104, and the communication interface 108).
[0183] The processor 104 may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0184] The memory 106 may include a volatile memory, such as a random access memory (RAM). The processor 104 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).
[0185] The memory 106 stores executable program codes, and the memory 106 executes the executable program codes to respectively implement the functions of the acquisition module 410, the sending module 420 and the switching module 430, thereby implementing the method for switching the software system. That is, the memory 106 stores instructions for executing the method for switching the software system.
[0186] Alternatively, the memory 106 stores executable codes, and the processor 104 executes the executable codes to respectively implement the functions of the aforementioned software system switching device, thereby implementing the software system switching method. That is, the memory 106 stores instructions for executing the software system switching method.
[0187] The communication interface 103 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 100 and other devices or a communication network.
[0188] The present disclosure also provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device may be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device may also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.
[0189] like Figure 6 As shown, the computing device cluster includes at least one computing device 100. The memory 106 in one or more computing devices 100 in the computing device cluster may store the same instructions for executing the method for software system switching.
[0190] In some possible implementations, the memory 106 of one or more computing devices 100 in the computing device cluster may also store partial instructions for executing the method for software system switching. In other words, the combination of one or more computing devices 100 may jointly execute the instructions for executing the method for software system switching.
[0191] It should be noted that the memory 106 in different computing devices 100 in the computing device cluster may store different instructions, which are respectively used to execute part of the functions of the device for switching the software system. That is, the instructions stored in the memory 106 in different computing devices 100 may implement the functions of one or more modules among the acquisition module 410, the sending module 420 and the switching module 430.
[0192] In some possible implementations, one or more computing devices in the computing device cluster may be connected via a network, which may be a wide area network or a local area network. Figure 7 A possible implementation is shown. Figure 7 As shown, two computing devices 100A and 100B are connected via a network. Specifically, the network is connected via a communication interface in each computing device. In this type of possible implementation, the memory 106 in the computing device 100A stores instructions for executing the functions of the switching module 430. At the same time, the memory 106 in the computing device 100B stores instructions for executing the functions of the acquisition module 410 and the sending module 420.
[0193] Figure 7 The connection method between the computing device clusters shown may be that considering that the method for software system switching provided by the present disclosure requires a large amount of computing resources, it is considered to hand over the functions implemented by the determination module 420 to the computing device 100A for execution.
[0194] It should be understood that Figure 7 The functions of the computing device 100A shown in FIG. 1 may also be completed by multiple computing devices 100. Similarly, the functions of the computing device 100B may also be completed by multiple computing devices 100.
[0195] The present disclosure also provides another computing device cluster. The connection relationship between the computing devices in the computing device cluster can be similar to that of Figure 6 and Figure 7The connection mode of the computing device cluster is different in that the memory 106 in one or more computing devices 100 in the computing device cluster may store the same instructions for executing the method for switching the software system.
[0196] In some possible implementations, the memory 106 of one or more computing devices 100 in the computing device cluster may also store partial instructions for executing the method for software system switching. In other words, the combination of one or more computing devices 100 may jointly execute the instructions for executing the method for software system switching.
[0197] The present disclosure also provides a computer program product including instructions. The computer program product may be software or a program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the method enables the at least one computing device to perform software system switching.
[0198] The embodiment of the present disclosure also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk). The computer-readable storage medium includes instructions that instruct the computing device to execute a method for switching a software system.
[0199] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for switching a software system, characterized in that: The method comprises: Obtaining a first service request; Sending the first service request to a first software system, and obtaining a first execution result of the first software system on the first service request, wherein the first software system is a current main software system; Sending the first service request to a second software system, and obtaining a second execution result of the first service request by the second software system, where the second software system is a current standby software system; Determine a comparison result between the first execution result and the second execution result, and if the comparison result meets a software system switching condition, switch the second software system to a main software system and switch the first software system to a backup software system.
2. The method according to claim 1, characterized in that The first service request carries a first user identifier, a first interface identifier, and a first session identifier, and the method further includes: Obtaining a second service request; Sending the second service request to the first software system, wherein the second service request carries the first user identifier, the first interface identifier, and the first session identifier; The sending the first service request to the second software system includes: If it is determined that the user identifier, interface identifier, and session identifier carried in the first service request and the second service request are the same, the first service request and the second service request are sent to the second software system concurrently.
3. The method according to claim 1 or 2, characterized in that: When the comparison result satisfies the software system switching condition, switching the second software system to the main software system and switching the first software system to the backup software system comprises: Determine that the comparison result is consistent with the execution result, and increase the number of consistent execution results by 1; determining a total number of service requests executed by both the first software system and the second software system; Determine the proportion of the current number of consistent execution results in the total number; When the number of consistent execution results is greater than a first threshold and the proportion is greater than a second threshold, it is determined that the software system switching condition is met, the second software system is switched to the main software system, and the first software system is switched to the backup software system.
4. The method according to any one of claims 1 to 3, characterized in that The method further comprises: Determine first newly added data in a first database corresponding to the first software system; Determine a first business primary key identifier corresponding to the first newly added data and a first database primary key identifier corresponding to the first database; In the primary key identifier mapping table, a correspondence between the first database primary key identifier and the first business primary key identifier is added.
5. The method according to claim 4, characterized in that The method further comprises: Determine second newly added data in a second database corresponding to the second software system; Determine a second business primary key identifier corresponding to the second newly added data and a second database primary key identifier corresponding to the second database; In the primary key identifier mapping table, a correspondence between the second database primary key identifier and the second business primary key identifier is added.
6. The method according to claim 5, characterized in that The first service request carries a primary key identifier of a target database, the first execution result is execution failure, and the method further includes: In the primary key identifier mapping table, determine the target business primary key identifier corresponding to the target database primary key identifier, and determine the database primary key identifier corresponding to the target business primary key identifier in the second database; The target database primary key identifier in the first service request is replaced with a database primary key identifier corresponding to the target service primary key identifier in the second database, and the replaced first service request is sent to the first software system.
7. The method according to any one of claims 4 to 6, characterized in that: Before switching the second software system to the main software system and switching the first software system to the backup software system, the method further includes: During the determination that the first software system is the primary business system, the third database primary key identifiers and the third business primary key identifiers corresponding to each newly added data in the first database respectively; For each third business primary key identifier, the database primary key identifier corresponding to the third business primary key and the database primary key identifier corresponding to the third business primary key identifier in the second database are replaced with the third database primary key identifier corresponding to the third business primary key identifier.
8. A device for switching software system, characterized in that: The device comprises: An acquisition module, used to acquire a first service request; a sending module, configured to send the first service request to a first software system, and obtain a first execution result of the first service request by the first software system, wherein the first software system is a current primary software system; and send the first service request to a second software system, and obtain a second execution result of the first service request by the second software system, wherein the second software system is a current backup software system; The switching module is used to determine the comparison result of the first execution result and the second execution result, and when the comparison result meets the software system switching condition, the second software system is switched to the main software system and the first software system is switched to the backup software system.
9. A computing device cluster, characterized in that: comprising at least one computing device, each computing device comprising a processor and a memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method according to any one of claims 1 to 7.
10. A computer program product comprising instructions, characterized in that When the instructions are executed by a computing device cluster, the computing device cluster executes the method according to any one of claims 1 to 7.
11. A computer-readable storage medium, characterized in that: The method comprises computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster performs the method according to any one of claims 1 to 7.
