Transaction sharing method, cloud instance and database agent node

Controlling multiple cloud instances to generate database operations and obtain transaction status through one cloud instance, solving the problems of inefficient and difficult to ensure consistency of existing distributed transaction processing methods, and achieving efficient and consistent transaction processing.

CN120050323APending Publication Date: 2025-05-27SHENZHEN HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411993742.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-05-27

AI Technical Summary

Technical Problem

The existing distributed transaction processing methods have many interactive steps and are low in efficiency, making it difficult to ensure transaction consistency.

Method used

Control at least two cloud instances to generate database operations through one cloud instance, and obtain the current status of the transaction, reduce transaction processing steps, improve transaction processing speed, and ensure transaction consistency.

Benefits of technology

Significantly improve transaction processing speed, reduce the interaction steps between control nodes and cloud instances, and ensure transaction consistency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120050323A_ABST
    Figure CN120050323A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a transaction sharing method, a cloud instance and a database agent node, the method can control at least two cloud instances to generate database operation and obtain the current state of a transaction through one cloud instance, and the transaction is processed according to the current state of the transaction, so that the transaction processing steps can be reduced, and the transaction processing efficiency is improved. And the transaction processing speed is improved. The method comprises the following steps: a first cloud instance sends a first database operation of a transaction to a database agent node according to a first call request and sends a second call request to a second cloud instance, so that the second cloud instance sends a second database operation of the transaction to the database agent node according to the second call request, and then the first cloud instance receives a message sent by the database agent node, and sends a transaction processing instruction to the database agent node according to the message.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of cloud computing, and in particular, to a shared transaction method, a cloud instance, and a database proxy node. Background Art

[0002] A distributed transaction is a transaction that is coordinated by multiple services in a distributed system.

[0003] Currently, a distributed transaction processing method is roughly as follows: Multiple containers generate a transaction identifier and database operations according to a service request, send the database operations to the database, the control node sends a prepare message to the multiple containers according to the service request, after the multiple containers send a prepare success message to the control node, the control node sends a commit transaction operation to the multiple containers, and after each container sends a commit transaction instruction to the database, the database executes all database operations corresponding to the transaction.

[0004] However, the above method has many interaction steps and low efficiency. Summary of the Invention

[0005] This application provides a shared transaction method and apparatus, which can control at least two cloud instances to generate database operations and obtain the current state of a transaction through one cloud instance, and can perform corresponding processing on the transaction according to the current state of the transaction, which can reduce the transaction processing steps, thereby improving the transaction processing speed and ensuring the consistency of the transaction.

[0006] In a first aspect, a shared transaction method is provided. The method includes: After a first cloud instance receives a first call request, it sends a first database operation of the transaction to a database proxy node according to the first call request and sends a second call request to a second cloud instance, so that the second cloud instance sends a second database operation of the transaction to the database proxy node according to the second call request. When the first cloud instance receives a message sent by the database proxy node, it sends a transaction processing instruction to the database proxy node according to the message. Wherein, the first cloud instance and the second cloud instance both belong to a cloud service system and are both used to provide cloud services, and the number of second cloud instances can be one or more. The message is used to indicate the state of the database operation in the transaction.

[0007] Implemented in this way, when the transaction corresponding to the call request involves the first cloud instance and the second cloud instance, the first cloud instance can control the first cloud instance and the second cloud instance to generate database operations and obtain the current state of the transaction, and can perform corresponding processing on the transaction according to the current state of the transaction, so as to ensure that the database operations of at least two cloud instances can be processed in the same transaction, thereby ensuring the consistency of the transaction. Since this method does not need to set up a control node, the interaction steps between the control node and the cloud instance are reduced, and the transaction processing speed can be significantly improved.

[0008] In a possible implementation, the second call request includes a token, which is used to establish a shadow connection between the database proxy node and the second cloud instance. This can improve the security of the connection between the database proxy node and the second cloud instance, thereby enhancing the security of the transaction.

[0009] In another possible implementation, the message is used to indicate that both the first database operation and the second database operation of the transaction have been executed normally, and the transaction processing instruction is used to commit the transaction.

[0010] In another possible implementation, the message is used to indicate that at least one database operation in the transaction is in an abnormal state, and the transaction processing instruction is used to roll back the transaction.

[0011] In another possible implementation, the first cloud instance is used to provide general services in the cloud service, and the second cloud instance is used to provide extended services in the cloud service.

[0012] In another possible implementation, both the first cloud instance and the second cloud instance are used to provide extended services in the cloud service.

[0013] In another possible implementation, both the first cloud instance and the second cloud instance are containers.

[0014] In another possible implementation, both the first cloud instance and the second cloud instance are virtual machines.

[0015] In another possible implementation, both the first cloud instance and the second cloud instance are physical hosts.

[0016] In a second aspect, a shared transaction method is provided. The method includes: after the second cloud instance receives the second call request sent by the first cloud instance, generating a second database operation of the transaction according to the second call request, and sending the second database operation of the transaction to the database proxy node.

[0017] Implemented in this way, the first cloud instance controls the second cloud instance to generate the second database operation of the transaction through the second call request, which ensures that the second database operation and the first database operation are processed in the same transaction, thereby guaranteeing the consistency of the transaction.

[0018] In a possible implementation, the second cloud instance sending the second database operation to the database proxy node includes: when the second call request includes a token, the second cloud instance sends the token to the database proxy node according to the second call request, establishes a shadow connection between the second cloud instance and the database proxy node based on the token, and sends the second database operation to the database proxy node through the shadow connection. This can improve the security of the shadow connection, thereby enhancing the security of the transaction.

[0019] In another possible implementation, after the second cloud instance sends the second database operation to the database proxy node through the shadow connection, the shadow connection is shut down, which can save the network resources occupied by the shadow connection.

[0020] A third aspect provides a shared transaction method, which includes: the database proxy node sends the first database operation from the first cloud instance to the database through the database connection, sends the second database operation from the second cloud instance to the database through the above database connection, then sends the message from the database to the first cloud instance, and then sends the transaction processing instruction from the first cloud instance to the database. Among them, the message is used to indicate the status of the database operation in the transaction.

[0021] Implementing in this way, since the database proxy node has established a database connection with the database, the first database operation and the second database operation can be sent to the database through this database connection, so that the first database operation and the second database operation can be processed within the same transaction, thus ensuring the consistency of the transaction.

[0022] In a possible implementation, the database proxy node receiving the second database operation sent by the second cloud instance includes: the database proxy node receives the token sent by the second cloud instance, and when the token passes the verification, establishes a shadow connection between the second cloud instance and the database proxy node, and receives the second database operation sent by the second cloud instance through the shadow connection.

[0023] In another possible implementation, the message is used to indicate that both the first database operation of the transaction and the second database operation of the transaction have been executed normally, and the transaction processing instruction is used to commit the transaction.

[0024] In another possible implementation, the message is used to indicate that one or more database operations in the transaction are in an abnormal state, and the transaction processing instruction is used to roll back the transaction.

[0025] In another possible implementation, the database proxy node and the database are located on the same computing device.

[0026] In another possible implementation, the database proxy node and the database are located on different computing devices.

[0027] A fourth aspect provides a cloud instance, which is used as the first cloud instance. The cloud instance includes a receiving module, a processing module, and a sending module. The receiving module is used to receive the first call request; the sending module is used to send the first database operation of the transaction to the database proxy node according to the first call request, the sending module is also used to send the second call request to the second cloud instance, the receiving module is also used to receive the message sent by the database proxy node, and the sending module is also used to send the transaction processing command to the database proxy node according to the message.

[0028] In a possible implementation, the second call request further includes a token, which is used to establish a shadow connection between the database proxy node and the second cloud instance.

[0029] In another possible implementation, the message is used to indicate that both the first database operation and the second database operation of the transaction have been successfully executed, and the transaction processing instruction is used to commit the transaction.

[0030] In another possible implementation, the message is used to indicate that at least one database operation in the transaction is in an abnormal state, and the transaction processing instruction is used to roll back the transaction.

[0031] In another possible implementation, the first cloud instance is used to provide general services in the cloud service, and the second cloud instance is used to provide extended services in the cloud service.

[0032] In another possible implementation, both the first cloud instance and the second cloud instance are used to provide extended services in the cloud service.

[0033] For the glossary of terms, the steps performed by each module, and the beneficial effects in the fourth aspect, reference may be made to the corresponding descriptions in the first aspect.

[0034] The fifth aspect provides a cloud instance, which is used as the second cloud instance. The cloud instance includes a receiving module, a processing module, and a sending module. The receiving module is used to receive the second call request sent by the first cloud instance. The processing module is used to generate the second database operation of the transaction according to the second call request. The sending module is used to send the second database operation to the database proxy node.

[0035] In a possible implementation, when the second call request includes a token, the sending module is specifically used to send the token to the database proxy node, and the token is used to establish a shadow connection between the second cloud instance and the database proxy node. The second database operation is sent to the database proxy node through the shadow connection.

[0036] In another possible implementation, the processing module is further used to shut down the shadow connection.

[0037] For the glossary of terms, the steps performed by the module or process, and the beneficial effects in the fifth aspect, reference may be made to the corresponding descriptions in the second aspect.

[0038] The sixth aspect provides a database proxy node, which includes a receiving module and a sending module. The receiving module is used to receive a first database operation sent by a first cloud instance; the sending module is used to send the first database operation sent by the first cloud instance to the database through a database connection; the receiving module is further used to receive a second database operation sent by a second cloud instance; the sending module is further used to send the second database operation to the database through the database connection; the receiving module is further used to receive a message sent by the database, and the sending module is further used to send the message to the first cloud instance; the receiving module is further used to receive a transaction processing instruction sent by the first cloud instance, and the sending module is further used to send the transaction processing instruction to the database.

[0039] In a possible implementation, the receiving module is specifically used to receive a token sent by the second cloud instance; when the token passes verification, a shadow connection between the second cloud instance and the database proxy node is established, and the receiving module receives the second database operation sent by the second cloud instance through the shadow connection.

[0040] In another possible implementation, the database proxy node and the database are located on the same computing device.

[0041] In another possible implementation, the database proxy node and the database are located on different computing devices.

[0042] For the glossary of terms, the steps performed by each module, and the beneficial effects in the sixth aspect, reference may be made to the corresponding descriptions in the third aspect.

[0043] The seventh aspect provides a cloud service system, which includes the cloud instance of the fourth aspect, the cloud instance of the fifth aspect, and the database proxy node of the sixth aspect.

[0044] The eighth aspect provides a computing device cluster, which includes at least one computing device, and each computing device includes a processor and a memory; 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 executes the shared transaction method in the first aspect or any possible implementation of the first aspect, the shared transaction method in the second aspect or any possible implementation of the second aspect, or the shared transaction method in the third aspect or any possible implementation of the third aspect.

[0045] The ninth aspect provides a computer-readable storage medium, which includes computer program instructions. When the computer program instructions are executed by the computing device cluster, the computing device cluster executes the shared transaction method in the first aspect or any possible implementation of the first aspect, the shared transaction method in the second aspect or any possible implementation of the second aspect, or the shared transaction method in the third aspect or any possible implementation of the third aspect.

[0046] The tenth aspect provides a computer program product, which includes computer program instructions; when the computer program instructions are executed by a cluster of computing devices, the cluster of computing devices executes the shared transaction method in the first aspect or any possible implementation manner of the first aspect, such as the shared transaction method in the second aspect or any possible implementation manner of the second aspect, or the shared transaction method in the third aspect or any possible implementation manner of the third aspect. Description of the Drawings

[0047] Figure 1A It is a schematic diagram of a cloud service system in an embodiment of the present application;

[0048] Figure 1B It is a schematic diagram of a cloud service system in an embodiment of the present application;

[0049] Figure 2 It is a schematic diagram of a physical host including multiple containers in an embodiment of the present application;

[0050] Figure 3 It is a signaling interaction diagram of the shared transaction method in an embodiment of the present application;

[0051] Figure 4 It is another signaling interaction diagram of the shared transaction method in an embodiment of the present application;

[0052] Figure 5 It is a structural diagram of a cloud instance in an embodiment of the present application;

[0053] Figure 6 It is a structural diagram of a database proxy node in an embodiment of the present application;

[0054] Figure 7 It is a structural diagram of a computing device in an embodiment of the present application;

[0055] Figure 8 It is a structural diagram of a cluster of computing devices in an embodiment of the present application;

[0056] Figure 9 It is another structural diagram of a cluster of computing devices in an embodiment of the present application. Detailed Embodiments

[0057] The shared transaction method of the present application can be applied to a cloud instance or a database proxy node of a cloud service system. The cloud service system can be, but is not limited to, a software as a service (SaaS) system, a platform as a service (PaaS), or an infrastructure as a service (IaaS).

[0058] SaaS refers to providing application programs to users in the form of leased services, and the application programs can include business applications or management applications, etc. PaaS is a platform service that provides software operation to users, and PaaS includes data analysis services, artificial intelligence services, container engine services, etc. IaaS is a service that provides computing resources, network resources or storage resources to users through the network.

[0059] The following introduces a cloud service system of the present application. Please refer to Figure 1A , in one embodiment, the cloud service system includes cloud instance 1, cloud instance 2 and a database server. Cloud instance 1 is used to provide general services, and cloud instance 2 is used to provide extended services (i.e., customized services). The customized service is also called a personalized service, which refers to a dedicated service provided according to the needs of customers. The database server includes a database proxy node and a database. The database proxy node establishes a database connection with the database. The database of the present application can be, but is not limited to, a single database instance (i.e., a data source). The database proxy node establishes a primary connection with cloud instance 1 and a shadow connection with cloud instance 2.

[0060] Please refer to Figure 1B , in one embodiment, the cloud service system includes cloud instance 1, cloud instance 2, a database proxy node and a database server. Cloud instance 1 is used to provide general services, and cloud instance 2 is used to provide extended services (i.e., customized services). The database server includes a database. The database proxy node establishes a database connection with the database of the database server, and the database proxy node and the database server are independent of each other. The database proxy node establishes a primary connection with cloud instance 1 and a shadow connection with cloud instance 2. It should be understood that the primary connection, the shadow connection and the database connection can all include one or more of a network cable connection, a local area network connection or an Internet connection.

[0061] In the cloud service system, application programs are provided by cloud instances. Cloud instances can include at least one of a physical host, a virtual machine or a container. The following introduces the container in the physical host. Please refer to Figure 2 , in one embodiment, the physical host includes infrastructure, an operating system that supports namespaces and control groups (cgroups), a container engine, and containers 1 to 3.

[0062] The infrastructure can be the hardware of the server or a virtual machine on the cloud (i.e., containers can also be deployed in the virtual machine). The operating system can, but is not limited to, adopt the linux kernel and support namespaces and cgroups. Among them, namespaces are used to achieve isolation between processes, and cgroups are used to achieve the allocation of process resources. The process resources include vcpus and memory allocated to the process.

[0063] The container engine runs in the operating system and is used to manage containers.

[0064] Container 1 includes Application 1 and the dependency packages of Application 1. The dependency packages include, but are not limited to, bins files or libs files. Container 2 includes Application 2 and the dependency packages of Application 2. Container 3 includes Application 3 and the dependency packages of Application 3. It should be understood that the number of containers and the number of applications in the physical host are not limited to Figure 2 as shown. Multiple containers share the host operating system kernel. Therefore, the startup speed of containers is faster than that of virtual machines and is suitable for lightweight applications. Moreover, containers occupy very little computing and memory resources, and a physical host can run thousands of containers simultaneously.

[0065] The shared transaction involved in the present application is introduced below. A shared transaction (share transaction) refers to a transaction in which multiple services share the same database. A transaction refers to a series of operations performed in a database, and these operations either all succeed or all fail to ensure data consistency in the database. Consistency means that the database must be in a consistent state before and after the execution of the transaction. A consistent state means that all data in the database is the result after the completion of the transaction submission. That is to say, the execution of the transaction must transform the database from one consistent state to another consistent state.

[0066] Regarding the problem of slow transaction processing speed existing in distributed transactions, the present application provides a shared transaction method that does not require a control node to control the transaction execution process, can reduce the signaling interaction between the control node and the cloud instance, and improve the transaction processing efficiency. It is introduced below. Please refer to Figure 3 One embodiment of the shared transaction method of the present application includes the following steps:

[0067] S301. The first cloud instance receives a first call request from the terminal.

[0068] The first call request is used to call a cloud service and can come from, but is not limited to, consumers, developers, managers, or operation and maintenance personnel of the cloud service. In some embodiments, the user sends the first call request to the first cloud instance through the terminal. In other embodiments, the user sends the first call request to the first cloud instance through the server. The client device of the cloud service can be, but is not limited to, a terminal or a server.

[0069] S302. The first cloud instance establishes a primary connection with the database proxy node.

[0070] Specifically, the first cloud instance establishes a primary connection with the database proxy node according to the first call request to transmit messages between the first cloud instance and the database proxy node.

[0071] S303. The database proxy node establishes a database connection with the database.

[0072] Optionally, after the database proxy node establishes a database connection with the database, the database proxy node can establish a correspondence between the main connection and the database connection, so that database operations sent by the first cloud instance through the main connection are all sent to the database through this database connection.

[0073] S304. The first cloud instance sends a start transaction instruction to the database proxy node.

[0074] S305. The database proxy node sends a start transaction instruction to the database.

[0075] S306. The first cloud instance sends the first database operation of the transaction to the database proxy node.

[0076] In this embodiment, the transaction corresponding to the first call request is related to the first cloud instance, the second cloud instance, and the database. Therefore, this transaction includes the database operations of the first cloud instance and the database operations of the second cloud instance.

[0077] Specifically, the first cloud instance receives a first call request from the terminal, generates a first database operation according to the first call request, and sends the first database operation in the transaction to the database proxy node through the main connection. The first database operation is the database operation generated by the first cloud instance according to the first call request. The database operation can be, but is not limited to, a structured query language (SQL) operation, which includes, but is not limited to, addition, deletion, query, and modification.

[0078] S307. The database proxy node sends the first database operation to the database through the database connection.

[0079] S308. The first cloud instance sends the second call request to the second cloud instance.

[0080] S309. The second cloud instance establishes a shadow connection with the database proxy node.

[0081] Specifically, the second call request includes the address of the database proxy node and the database connection address. The second cloud instance establishes a shadow connection between the second cloud instance and the database proxy node according to the address of the database proxy node and the database connection address to transmit messages between the second cloud instance and the database proxy node. The database connection address can include, but is not limited to, a uniform resource locator (URL).

[0082] The second call request may be, but is not limited to, an invoke request. Optionally, the second call request includes a token, and the token includes a main connection identifier (i.e., the identifier of the main connection). The database proxy node compares the main connection identifier in the token with the main connection identifier corresponding to the database connection. When the two main connection identifiers are the same, the token passes the verification and a shadow connection is established. When the two main connection identifiers are different, the token authentication fails and no shadow connection is established.

[0083] Based on the main connection identifier of the token, the database proxy node can associate the main connection, the shadow connection, and the database connection, enabling database operations sent by the first cloud instance through the main connection and database operations sent by the second cloud instance through the shadow connection to be sent to the database through the same database connection, so that database operations of different cloud instances can be committed within the same transaction.

[0084] S310. The second cloud instance generates a second database operation according to the second call request.

[0085] After receiving the second call request sent by the first cloud instance, the second cloud instance generates a second database operation for the transaction. The second database operation is the database operation generated by the second cloud instance according to the second call request. It should be noted that the number of the first database operations can be one or more, and the number of the second database operations can also be one or more. The number of the first database operations, the number of the second database operations, and the order of the first database operations and the second database operations in the transaction can all be set according to the actual situation. In some embodiments, after starting the transaction, the first database operations and the second database operations are sent alternately.

[0086] S311. The second cloud instance sends the second database operation to the database proxy node.

[0087] Specifically, the second cloud instance sends the second database operation to the database proxy node through the shadow connection.

[0088] S312. The database proxy node sends the second database operation to the database through the database connection.

[0089] It should be noted that S306 and S307 are the processes of sending the first database operation, and S308 to S312 are the processes of sending the second database operation. There is no fixed order between the two processes. In some embodiments, S308 to S312 can be executed first, and then S306 and S307.

[0090] S313. The database proxy node receives the first message sent by the database.

[0091] S314. The database proxy node sends the first message to the first cloud instance.

[0092] S315. The first cloud instance sends a commit transaction instruction to the database proxy node.

[0093] Specifically, the first message is used to indicate that all database operations (including the first database operation and the second database operation) of the transaction have been normally executed. In response to the first message, the first cloud instance sends a commit transaction instruction to the database proxy node.

[0094] S316. The database proxy node sends a commit transaction instruction to the database.

[0095] S317. The database commits the transaction.

[0096] Specifically, the database commits the transaction according to the commit transaction instruction, and executes the first database operation and the second database operation in the database to achieve the persistence of the database operation result.

[0097] In this embodiment, when the transaction corresponding to the call request involves the first cloud instance and the second cloud instance, the first cloud instance can control the first cloud instance and the second cloud instance to generate database operations and obtain the current state of the transaction, and can perform corresponding processing on the transaction according to the current state of the transaction. In this way, it can be ensured that the database operations (such as the first database operation and the second database operation) of at least two cloud instances can be processed in the same transaction to ensure the consistency of the transaction.

[0098] Secondly, the database proxy node has a unique Internet protocol (IP address). The database proxy node establishing a connection with the database based on this IP address can meet the single IP address requirement of the database transaction and has good compatibility.

[0099] In an alternative embodiment, after S311, the shared transaction method of the present application further includes: the second cloud instance closes the shadow connection.

[0100] In this embodiment, after the second cloud instance sends the second database operation to the database proxy node through the shadow connection, closing the shadow connection can save the network resources occupied by the shadow connection. In some embodiments, after closing the shadow connection, a connection closing message is sent to the first cloud instance.

[0101] The method for committing a transaction is introduced above. Next, the method for rolling back a transaction will be introduced. Please refer to Figure 4 , another embodiment of the shared transaction method of the present application includes the following steps:

[0102] S401. The first cloud instance receives a first call request from the terminal.

[0103] S402. The first cloud instance establishes a primary connection with the database proxy node.

[0104] S403. The database proxy node establishes a database connection with the database.

[0105] S404. The first cloud instance sends a start transaction instruction to the database proxy node.

[0106] S405. The database proxy node sends a start transaction instruction to the database.

[0107] S406. The first cloud instance sends the first database operation of the transaction to the database proxy node.

[0108] S407. The database proxy node sends the first database operation to the database through the database connection.

[0109] S408. The first cloud instance sends a call request to the second cloud instance.

[0110] S409. The second cloud instance establishes a shadow connection with the database proxy node.

[0111] S410. The second cloud instance generates a second database operation according to the second call request.

[0112] S411. The second cloud instance sends the second database operation to the database proxy node.

[0113] S412. The database proxy node sends the second database operation to the database through the database connection.

[0114] S401 - S412 are similar to S301 - S312. For the specific execution process and beneficial effects, please refer to Figure 3 the corresponding descriptions in the embodiments shown.

[0115] S413. The database proxy node receives the second message sent by the database.

[0116] S414. The database proxy node sends the second message to the first cloud instance.

[0117] S415. The first cloud instance sends a rollback transaction instruction to the database proxy node.

[0118] Among them, the second message is used to indicate that one or more database operations in the transaction are in an abnormal state. In response to the second message, the first cloud instance sends a rollback transaction instruction to the database proxy node.

[0119] S416. The database proxy node sends a rollback transaction instruction to the database.

[0120] S417. The database rolls back the transaction.

[0121] In this embodiment, the database rolls back the transaction according to the rollback transaction instruction, cancels the execution of the first database operation and the second database operation, so as to ensure the success of the transaction rollback, thereby ensuring the consistency of the transaction.

[0122] The following introduces the hardware for implementing the shared transaction method in this application. The cloud instance of this application can implement the functions of the first cloud instance. Refer to Figure 5 , in one embodiment, the cloud instance 500 of this application includes a receiving module 501, a processing module 502, and a sending module 503. The receiving module 501 is used to receive the first call request; the sending module 503 is used to send the first database operation of the transaction to the database proxy node according to the first call request. The sending module 503 is also used to send the second call request to the second cloud instance. The receiving module 501 is also used to receive the message sent by the database proxy node. The sending module 503 is also used to send the transaction processing command to the database proxy node according to the message.

[0123] As an example of a software functional unit, the processing module 502 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 computing instances may be one or more. For example, the processing module 502 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers for running this code may be distributed in the same region, or may be distributed in different regions. Further, the multiple hosts / virtual machines / containers for running this code may be distributed in the same availability zone (AZ), or may be distributed in different AZs. Each AZ includes one data center or multiple geographically close data centers. Among them, usually one region may include multiple AZs.

[0124] Similarly, the multiple hosts / virtual machines / containers for running this code may be distributed in the same virtual private cloud (VPC), or may be distributed in multiple VPCs. Among them, usually one VPC is set within one region. For cross-region communication between two VPCs within the same region and between VPCs in different regions, a communication gateway needs to be set in each VPC, and the interconnection between VPCs is realized through the communication gateway.

[0125] As an example of a hardware functional unit, the processing module 502 may include at least one computing device, such as a server. Alternatively, the processing module 502 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). Among them, the above PLD may be implemented by a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0126] The multiple computing devices included in the processing module 502 may be distributed in the same region or in different regions. The multiple computing devices included in the processing module 502 may be distributed in the same availability zone (AZ) or in different AZs. Similarly, the multiple computing devices included in the processing module 502 may be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Among them, the multiple computing devices may be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.

[0127] In other embodiments, the processing module 502 may be used to execute Figures 3 to 4 any step executed by the first cloud instance in the shared transaction method shown, and the receiving module 501 may be used to execute Figures 3 to 4 any step executed by the first cloud instance in the shared transaction method shown. The sending module 503 may be used to execute Figures 3 to 4 any step executed by the first cloud instance in the shared transaction method shown. The steps to be implemented by the receiving module 501, the processing module 502, and the sending module 503 can be specified as needed, and all functions of the first cloud instance are implemented by separately implementing Figures 3 to 4 different steps in the shared transaction method shown.

[0128] In some other embodiments, the cloud instance 500 of the present application may also implement the functions of the second cloud instance. Specifically, the receiving module 501 is used to receive a second call request sent by the first cloud instance, and the processing module is used to generate a second database operation for the transaction according to the second call request; the sending module is used to send the second database operation to the database proxy node.

[0129] In another possible implementation, when the second call request includes a token, the sending module 503 is specifically configured to send the token to the database proxy node, where the token is used to establish a shadow connection between the second cloud instance and the database proxy node; and send the second database operation to the database proxy node through the shadow connection.

[0130] In another possible implementation, the processing module 502 is further configured to shut down the shadow connection.

[0131] Refer to Figure 6 , in one embodiment, the database proxy node 600 of the present application includes a receiving module 601 and a sending module 602. The receiving module 601 is configured to receive a first database operation sent by a first cloud instance; the sending module 602 is configured to send the first database operation to the database through a database connection; the receiving module 601 is further configured to receive a second database operation sent by a second cloud instance; the sending module 602 is further configured to send the second database operation to the database through the database connection; the receiving module 601 is further configured to receive a message sent by the database, and the sending module 602 is further configured to send the message to the first cloud instance; the receiving module 601 is further configured to receive a transaction processing instruction sent by the first cloud instance, and the sending module 602 is further configured to send the transaction processing instruction to the database.

[0132] As an example of a software functional unit, the receiving module 601 may include code running on a computing instance. Wherein, the computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the above computing instance may be one or more. For example, the receiving module 601 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers for running the code may be distributed in the same region, or may be distributed in different regions. Further, the multiple hosts / virtual machines / containers for running the code may be distributed in the same availability zone (AZ), or may be distributed in different AZs, and each AZ includes one data center or multiple geographically proximate data centers. Wherein, generally one region may include multiple AZs.

[0133] Similarly, the multiple hosts / virtual machines / containers for running the code may be distributed in the same virtual private cloud (VPC), or may be distributed in multiple VPCs. Wherein, generally one VPC is set within one region. For cross-region communication between two VPCs within the same region and between VPCs in different regions, a communication gateway needs to be set in each VPC, and the interconnection between VPCs is achieved through the communication gateway.

[0134] As an example of a hardware functional unit, the receiving module 601 may include at least one computing device, such as a server. Alternatively, the receiving module 601 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). Among them, the above PLD may be implemented by a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0135] The multiple computing devices included in the receiving module 601 may be distributed in the same region or in different regions. The multiple computing devices included in the receiving module 601 may be distributed in the same availability zone (AZ) or in different AZs. Similarly, the multiple computing devices included in the receiving module 601 may be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Among them, the multiple computing devices may be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.

[0136] In other embodiments, the receiving module 601 may be used to execute Figures 3 to 4 any step executed by the database proxy node in the shared transaction method shown, and the sending module 602 may be used to execute Figures 3 to 4 any step executed by the database proxy node in the shared transaction method shown. The steps to be implemented by the receiving module 601 and the sending module 602 can be specified as needed and are implemented by respectively implementing Figures 3 to 4 different steps in the shared transaction method shown to implement all the functions of the database proxy node.

[0137] This application also provides a computing device 700. As Figure 7 shown, in one embodiment, the computing device 700 includes: a bus 702, a processor 704, a memory 706, and a communication interface 708. The processor 704, the memory 706, and the communication interface 708 communicate with each other through the bus 702. It should be understood that this application does not limit the number of processors and memories in the computing device 700.

[0138] The bus 702 can be a peripheral component interconnect (PCI) bus, an extended industry standard architecture (EISA) bus, or the like. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 only one line is used in Figure 7 , but it does not mean that there is only one bus or one type of bus. The bus 704 can include a path for transmitting information between various components of the computing device 700 (for example, the memory 706, the processor 704, and the communication interface 708).

[0139] The processor 704 can 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), etc. The processor includes multiple processing cores.

[0140] The memory 706 can include volatile memory, such as random access memory (RAM). The memory 706 can also include non-volatile memory, such as read-only memory (ROM), flash memory, a hard disk drive (HDD), or a solid state drive (SSD). In some embodiments, executable program code is stored in the memory 706, and the processor 704 executes the executable program code to implement the functions of the aforementioned receiving module 501, processing module 502, and sending module 503, thereby implementing the above-mentioned shared transaction method. In other embodiments, executable program code is stored in the memory 706, and the processor 704 executes the executable program code to implement the functions of the aforementioned receiving module 601 and sending module 602, thereby implementing the above-mentioned shared transaction method.

[0141] The communication interface 708 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 700 and other devices or communication networks.

[0142] Embodiments of the present application also provide a computing device cluster. The computing device cluster includes at least one computing device. The computing device can 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 can also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.

[0143] As Figure 8 shown, the computing device cluster includes at least one computing device 700. Memories 706 in one or more of the computing devices 700 in the computing device cluster can store the same instructions for executing a shared transaction method.

[0144] In some possible implementation manners, memories 706 in one or more of the computing devices 700 in the computing device cluster can also separately store partial instructions for executing the shared transaction method. In other words, a combination of one or more computing devices 700 can jointly execute the instructions for executing the shared transaction method.

[0145] Please refer to Figure 9 , Figure 9 which is a schematic diagram of a computer device in the computing cluster provided by the embodiments of the present application connected through a network. As Figure 9 shown, two computing devices 700A and 700B are connected through a network. Specifically, they are connected to the network through communication interfaces in each computing device.

[0146] In one possible implementation manner, the memory in computing device 700A stores instructions for executing the functions of receiving module 501 and sending module 503. At the same time, the memory in computing device 700B stores instructions for executing the function of processing module 502.

[0147] In another possible implementation manner, the memory in computing device 700A stores instructions for executing the function of receiving module 601. At the same time, the memory in computing device 700B stores instructions for executing the function of sending module 602.

[0148] It should be understood that Figure 9 the functions of computing device 700A shown in [[ ]] can also be completed by multiple computing devices. Similarly, the functions of computing device 700B can also be completed by multiple computing devices.

[0149] Embodiments of the present application also provide a computer program product containing instructions. The computer program product can be software or a program product containing instructions that can run on a computing device or be stored in any available medium. When the computer program product runs on at least one computing device, it causes at least one computing device to execute the shared transaction method of the present application.

[0150] Embodiments of the present application also provide 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 including one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state drive), etc. The computer-readable storage medium includes instructions that direct the computing device to execute the shared transaction method of the present application.

[0151] The terms "first", "second", etc. in the specification, claims and drawings of the present application are used to distinguish similar objects and do not necessarily have to be used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments described herein can be implemented in an order different from that shown or described herein. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0152] The above embodiments are only used to illustrate the technical solutions of the present application and are not intended to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and 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 application.

Claims

1. A shared transaction method, characterized in that: The method is used for a first cloud instance of a cloud service system, the cloud service system further comprising a second cloud instance and a database proxy node, the first cloud instance and the second cloud instance both being used to provide cloud services, the method comprising: The first cloud instance receives a first call request; The first cloud instance sends the first database operation of the transaction to the database proxy node according to the first call request; The first cloud instance sends a second call request to the second cloud instance, where the second call request is used to instruct the second cloud instance to send a second database operation of the transaction to the database proxy node; The first cloud instance receives a message sent by the database proxy node, where the message is used to indicate a status of a database operation in the transaction; The first cloud instance sends a transaction processing instruction to the database proxy node according to the message.

2. The method according to claim 1, characterized in that The second call request includes a token, where the token is used to establish a shadow connection between the database proxy node and the second cloud instance.

3. The method according to claim 1 or 2, characterized in that: The message is used to indicate that the first database operation of the transaction and the second database operation of the transaction have been executed normally, and the transaction processing instruction is used to commit the transaction.

4. The method according to claim 1 or 2, characterized in that: The message is used to indicate that at least one database operation in the transaction is in an abnormal state, and the transaction processing instruction is used to roll back the transaction.

5. The method according to any one of claims 1 to 4, characterized in that The first cloud instance is used to provide common services in the cloud service, and the second cloud instance is used to provide extended services in the cloud service.

6. The method according to any one of claims 1 to 4, characterized in that The first cloud instance and the second cloud instance are both used to provide an extended service in the cloud service.

7. A shared transaction method, characterized in that: The method is used for a second cloud instance of a cloud service system, the cloud service system further comprising a first cloud instance and a database proxy node, the first cloud instance and the second cloud instance both being used to provide cloud services, the method comprising: The second cloud instance receives a second call request sent by the first cloud instance; The second cloud instance generates a second database operation of the transaction according to the second call request; The second cloud instance sends the second database operation to a database proxy node.

8. The method according to claim 7, characterized in that The second call request includes a token, and the second cloud instance sends the second database operation to the database proxy node including: The second cloud instance sends the token to the database proxy node, where the token is used to establish a shadow connection between the second cloud instance and the database proxy node; The second cloud instance sends the second database operation to a database proxy node through the shadow connection.

9. The method according to claim 8, characterized in that The method further comprises: The second cloud instance shuts down the shadow connection.

10. A shared transaction method, characterized in that: The method is used for a database proxy node of a cloud service system, the cloud service system further comprising a first cloud instance and a second cloud instance, the first cloud instance and the second cloud instance both being used to provide cloud services, the method comprising: The database proxy node receives a first database operation sent by the first cloud instance; The database proxy node sends the first database operation to the database through a database connection; The database proxy node receives a second database operation sent by a second cloud instance, where the first database operation and the second database operation belong to the same transaction; The database proxy node sends the second database operation to the database through the database connection; The database proxy node receives a message sent by the database, where the message is used to indicate a status of a database operation in the transaction; The database proxy node sends the message to the first cloud instance; The database proxy node receives a transaction processing instruction sent by the first cloud instance; The database proxy node sends the transaction processing instruction to the database.

11. The method according to claim 10, characterized in that The database proxy node receiving the second database operation sent by the second cloud instance includes: The database proxy node receives a token sent by the second cloud instance; When the token passes the verification, the database proxy node establishes a shadow connection between the second cloud instance and the database proxy node; The database proxy node receives a second database operation sent by the second cloud instance through the shadow connection.

12. A cloud instance, characterized in that: The cloud instance is used as a first cloud instance, and the cloud instance includes: A receiving module, used for receiving a first call request; A sending module, configured to send the first database operation of the transaction to a database proxy node according to the first call request; The sending module is further used to send a second call request to the second cloud instance, where the second call request is used to instruct the second cloud instance to send the second database operation of the transaction to the database proxy node; The receiving module is further used to receive a message sent by a database proxy node, where the message is used to indicate a status of a database operation in the transaction; The sending module is further used to send a transaction processing instruction to the database proxy node according to the message.

13. The cloud instance according to claim 12, characterized in that: The second call request also includes a token, where the token is used to establish a shadow connection between the database proxy node and the second cloud instance.

14. The cloud instance according to claim 12 or 13, characterized in that: The message is used to indicate that the first database operation of the transaction and the second database operation of the transaction have been executed normally, and the transaction processing instruction is used to commit the transaction.

15. The cloud instance according to claim 12 or 13, characterized in that: The message is used to indicate that at least one database operation in the transaction is in an abnormal state, and the transaction processing instruction is used to roll back the transaction.

16. The cloud instance according to any one of claims 12 to 15, characterized in that: The first cloud instance is used to provide a common service in the cloud service, and the second cloud instance is used to provide an extended service in the cloud service.

17. The cloud instance according to any one of claims 12 to 15, characterized in that: The first cloud instance and the second cloud instance are both used to provide extended services in cloud services.

18. A cloud instance, characterized in that: The cloud instance is used as a second cloud instance, and the cloud instance includes: A receiving module, configured to receive a second call request sent by the first cloud instance; A processing module, configured to generate a second database operation of a transaction according to the second call request; A sending module is used to send the second database operation to a database proxy node.

19. The cloud instance according to claim 18, characterized in that: When the second call request includes a token, the sending module is specifically used to send the token to the database proxy node, and the token is used to establish a shadow connection between the second cloud instance and the database proxy node; and send the second database operation to the database proxy node through the shadow connection.

20. The cloud instance according to claim 19, characterized in that: The processing module is further configured to shut down the shadow connection.

21. A database proxy node, characterized in that: include: A receiving module, configured to receive a first database operation sent by a first cloud instance; A sending module, configured to send the first database operation sent by the first cloud instance to a database through a database connection; The receiving module is further used to receive a second database operation sent by a second cloud instance, where the first database operation and the second database operation belong to the same transaction; The sending module is further used to send the second database operation to the database through the database connection; The receiving module is further used to receive a message sent by the database, where the message is used to indicate a status of a database operation in the transaction; The sending module is further used to send the message to the first cloud instance; The receiving module is further used to receive a transaction processing instruction sent by the first cloud instance; The sending module is further used to send the transaction processing instruction to the database.

22. The database proxy node according to claim 21, characterized in that: The receiving module is specifically used to receive a token sent by the second cloud instance; when the token passes the verification, a shadow connection between the second cloud instance and the database proxy node is established, and a second database operation sent by the second cloud instance through the shadow connection is received.

23. The database proxy node according to any one of claims 21 to 22, characterized in that: The database proxy node and the database are located in the same computing device.

24. The database proxy node according to any one of claims 21 to 22, characterized in that: The database proxy node and the database are located in different computing devices.

25. A computing device cluster, characterized in that: It includes at least one computing device, each computing device includes a processor and a memory; the processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method as described in any one of claims 1 to 11.

26. A computer-readable storage medium, characterized in that: The method comprises computer program instructions, and 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 11.

27. 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 11.