A data operation method and database example
By introducing interfaces, configurations, and semantic conversion modules into database instances within cloud data centers, in-memory database operations are converted into KV operation requests, enabling multi-tenant shared database instances. This solves the problems of low resource utilization and high costs, improves resource utilization, and reduces tenant costs.
Patent Information
- Application Number
- CN202011639146.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2020-06-29
- Filing Date
- 2020-12-31
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2040-12-31
AI Technical Summary
How to improve the resource utilization of cloud databases and reduce the cost of using cloud databases, especially how to optimize resource allocation in a multi-tenant environment to reduce the cost burden of tenants while avoiding the risk of data loss.
By introducing a database instance with an interface module, a configuration module, and a semantic conversion module in the cloud data center, the memory database operation request sent by the client is converted into a KV operation request within the database instance and executed in the KV storage pool, realizing multi-tenant sharing of the database instance. The configuration module generates configuration items and allocates bucket IDs and IP addresses to optimize resource utilization.
It improves the utilization of host resources, reduces tenants' costs, maintains the efficiency and data security of the memory database, avoids resource consumption caused by data staying in the host for a long time, improves resource utilization and reduces tenants' cost burden.
Smart Images

Figure CN113934704B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to a data operation method, a database instance supporting the execution of the method, and a corresponding computer and readable storage medium. Background Art
[0002] With the rise of public cloud technology, the application scale of cloud databases is also growing. How to improve the resource utilization of cloud databases and reduce the cost of using cloud databases has become an issue that requires continuous attention. Summary of the Invention
[0003] The data operation method provided in this application improves the resource utilization of the database and reduces the resource consumption of the database.
[0004] In a first aspect, a data operation method is provided, including: a client sends a memory database operation request to a database instance, wherein the memory database operation request conforms to the interface format of the memory database, and the memory database uses memory to store tenant data to improve the processing speed of the tenant data; the database instance converts the memory database operation request into a key-value KV operation request; the database instance sends the KV operation request to a KV storage pool; and the KV storage pool executes the KV operation request.
[0005] In one possible implementation, before the client sends an in-memory database operation request to a database instance, the method includes: the client sends a create request to the database instance; the database instance generates configuration items based on the create request, the configuration items including a bucket ID assigned by the database instance and metadata carried by the create request; the database instance sends the bucket ID to the client; and the client generates the in-memory database operation request based on the bucket ID.
[0006] In a possible implementation, the method further includes: the database instance allocating an IP address for accessing the database instance, and sending the IP address to the client; and the client sending the memory database operation request to the database instance according to the IP address.
[0007] In one possible implementation, the method further includes: another client sends another creation request to the database instance; the database instance generates another configuration item based on the another creation request, and the other configuration item includes another bucket ID assigned by the database instance and metadata carried by the another creation request; the database instance sends the other bucket ID to the other client; the database instance assigns another IP address for accessing the database instance, and sends the other IP address to the other client.
[0008] In one possible implementation, the client runs in a virtual private cloud (VPC). The tenant needs to create the client in the VPC. The VPC and the database instance are both deployed in the same cloud data center.
[0009] The second aspect provides a database instance, including: an interface module for receiving a memory database operation request sent by a client, wherein the memory database operation request conforms to the interface format of the memory database, and the memory database uses memory to store tenant data to improve the processing speed of the tenant data; a semantic conversion module for converting the memory database operation request into a key-value KV operation request and sending the KV operation request to a KV storage pool.
[0010] In one possible implementation, the database instance also includes a configuration module; the interface module is used to receive a creation request sent by the client; the configuration module is used to generate configuration items based on the creation request, and the configuration items include a bucket ID assigned by the configuration module and metadata carried by the creation request; the interface module is also used to send the bucket ID to the client.
[0011] In a possible implementation, the interface module is configured to allocate an IP address for accessing the database instance, and send the IP address to the client.
[0012] In one possible implementation, the interface module is used to receive another creation request sent by another client; the configuration module generates another configuration item based on the another creation request, and the another configuration item includes another bucket ID assigned by the configuration module and metadata carried by the another creation request; the interface module is used to assign another IP address for accessing the database instance and send the other IP address to the other client.
[0013] A third aspect provides a cloud data center, including the database instance, client, and KV storage pool provided by the second aspect and its possible implementation methods.
[0014] A fourth aspect provides a computer, comprising a memory and a processor, wherein the memory stores program instructions, and the processor executes the program instructions to perform the method provided by the first aspect and possible implementations thereof. Specifically, the processor executes the program instructions to execute the database instance provided by the second aspect and possible implementations thereof.
[0015] A fifth aspect provides a readable storage medium, which may be non-transitory. When the instructions stored in the readable storage medium are executed by a host, the host executes the method provided by the first aspect and its possible implementation. The readable storage medium stores program instructions. The readable storage medium includes but is not limited to a volatile storage device, such as a random access storage device, and a non-volatile storage device, such as a flash memory device, a hard disk drive (HDD), and a solid state drive (SSD).
[0016] A sixth aspect provides a computer program product. When executed by a host, the instructions contained in the computer program product cause the host to perform the method provided in the first aspect and possible implementations thereof. The computer program product may be a software installation package. When the method provided in the first aspect and possible implementations thereof is required, the computer program product may be downloaded and executed on the host. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 A schematic diagram of the organizational structure of a cloud data center provided for this application;
[0018] Figure 2 Another diagram of the organizational structure of a cloud data center provided for this application;
[0019] Figure 3 Another diagram of the organizational structure of a cloud data center provided for this application;
[0020] Figure 4 A schematic diagram of the data operation method provided in this application;
[0021] Figure 5 A schematic diagram of the organizational structure of a computer provided in this application. DETAILED DESCRIPTION
[0022] First, some terms involved in this application are introduced.
[0023] Host: A physical server deployed in a cloud data center. The host's hardware layer includes various hardware resources, such as the central processing unit (CPU), memory, and network bandwidth, which are used by the operating system, database middleware, and in-memory database instances running on the host.
[0024] Instance: A computing node running on a host. Common instances include virtual machines (VMs) or containers. Each instance occupies some or all of the host's virtual resources. A host runs at least one instance to run a database.
[0025] In-memory databases: These use memory to store tenant data. By storing data in memory, they speed up data reads and writes. In-memory databases, also known as cache databases, include Redis, Apache Ignite, Kinetica, Memcached, and Oracle RDBMS.
[0026] Client: The client in this application is an in-memory database client that supports the in-memory database interface format. Therefore, the operation requests sent by the client to the database instance conform to the in-memory database interface format. Tenants can create one or more virtual private clouds (VPCs) in a cloud data center, and the client can run within the VPC.
[0027] Persistence: The process of transferring data from volatile media (such as memory) to non-volatile media.
[0028] Key-value (KV) storage pool: A distributed storage system that uses the KV format and generally supports multiple data types, such as blocks, objects, and files. Buckets can be created within a KV storage pool, and bucket tenants can use KV operations to operate on the data within the buckets.
[0029] like Figure 1 As shown, a cloud data center includes multiple hosts. Each host's hardware layer runs an operating system, database middleware, and an in-memory database instance. Multiple tenants' in-memory database clients connect to the cloud data center to rent in-memory database instances. Each tenant's in-memory database instance resides on a different host. In this scenario, each tenant pays a relatively high fee for the hardware resources used by their in-memory database instance.
[0030] like Figure 2As shown in the figure, in another cloud data center, the operating system and database middleware running on the host hardware layer support the operation of multiple in-memory database instances. When multiple tenants' in-memory database clients apply for in-memory database instances, these instances can run on the same host. In this case, each tenant pays less for the hardware resources occupied by their own in-memory database instance. However, since multiple in-memory database instances share the database middleware and operating system, the database middleware also persists a larger amount of data when persisting data processed by these multiple in-memory database instances. This increases the risk of data loss if a host fails during the persistence process.
[0031] Based on this, this application provides a cloud data center, such as Figure 3 As shown in the figure, in this cloud data center, multiple tenants' clients access the same database instance. The database instance includes an interface module, a configuration module, and a semantic conversion module. The interface module receives creation requests from clients. The configuration module stores each tenant's configuration items. The semantic conversion module converts tenants' in-memory database operation requests into KV operation requests and sends them to the KV storage pool.
[0032] Figure 4 This application introduces a data operation method for a database instance provided by the present application, including:
[0033] At step S200 , the client sends a create request to the interface module. This create request is used to create an in-memory database instance in the cloud data center. The create request may include the tenant ID and in-memory database metadata. The in-memory database metadata includes in-memory database performance parameters, such as storage capacity, maximum number of supported connections, and performance parameters.
[0034] S202: The client instructs the configuration module to generate corresponding configuration items according to the creation request.
[0035] The indication sent by the client includes the tenant ID and metadata of the in-memory database.
[0036] S204: The configuration module creates and stores the configuration item corresponding to the creation request according to the instruction.
[0037] The configuration module creates a bucket in the KV storage pool for the tenant based on the instruction and assigns a bucket ID. It generates and records configuration items, which include the correspondence between the tenant ID (optional), bucket ID, and metadata of the in-memory database, such as Figure 3 shown.
[0038] Multiple create requests from the same tenant, or multiple create requests from different tenants, can be assigned multiple different bucket IDs within the same database instance.
[0039] S206: The configuration module sends a creation success response to the interface module.
[0040] S208: The interface module allocates an IP address for accessing the in-memory database instance and sends a creation success response to the client. The IP address may also be allocated by the configuration module and sent to the interface module in S206. The creation success response carries the bucket ID.
[0041] Multiple creation requests from the same tenant, or multiple creation requests from different tenants, can be assigned multiple different IP addresses within the same database instance. These multiple IP addresses all point to the semantic conversion module, which is used by the client to send memory database operation requests to the semantic conversion module. Figure 3 As shown in the figure, three tenants are assigned IP addresses 1, 2, and 3, respectively. IP addresses 1, 2, and 3 all point to the semantic conversion module. This creation process allows multiple tenants to share a database instance, improving the utilization of the host's physical resources and reducing tenant costs.
[0042] After S208, the client is notified that the in-memory database instance has been created. (Actually, a new in-memory database instance is not actually created in the cloud data center; instead, a configuration item is generated in the configuration module.) Multiple creation requests from the same tenant, or multiple creation requests from different tenants, can create multiple configuration items in the configuration module of the same database instance. Each configuration item has a different tenant ID and bucket ID.
[0043] S210: The client sends a memory database operation request to the semantic conversion module according to the allocated IP address.
[0044] In-memory database operation requests conform to the in-memory database interface format and can be used to write data, delete data, modify data, query data, etc. In-memory database operation requests carry a bucket ID.
[0045] S212: The semantic conversion module converts the memory database operation request into a KV operation request.
[0046] The semantic conversion module generates the key carried in the KV operation request based on the key and bucket ID of the data carried in the in-memory database operation request. The specific generation method can use hashing, splicing, etc.
[0047] S214: The semantic conversion module sends the KV operation to the KV storage pool.
[0048] S216: The KV storage pool executes the KV operation request.
[0049] S218: The semantic conversion module notifies the configuration module to adjust the configuration item corresponding to the memory database operation request.
[0050] S218 can be executed after S212 or after S216 confirms that the KV storage pool has completed the KV operation request. The semantic conversion module can notify the configuration module to adjust the metadata in the configuration item corresponding to the in-memory database operation request. For example, if the in-memory database operation request is for writing data, then S218 can adjust the remaining capacity of the bucket.
[0051] In the data manipulation method described above, multiple clients can share a database instance, improving host resource utilization and reducing tenant costs. Tenant clients send in-memory database operation requests to the database instance, preserving the in-memory database interface format and ensuring tenant efficiency. Furthermore, in-memory database operation requests are converted into KV operation requests within the database instance, avoiding the resource consumption caused by the operated data remaining in the host's memory for an extended period. This further improves resource utilization and reduces tenant costs.
[0052] Figure 5 A computer 400 is provided, including the computer 400, which is also a host running a database instance provided in this application.
[0053] Computer 400 includes a processor 401, a network device 402, a bus 403, and a storage device 404. Processor 401, network device 402, and storage device 404 communicate with each other via bus 403. Processor 401 may be a central processing unit (CPU). Storage device 403 may include a volatile memory device (volatile memory), such as a random access memory device (random access memory, RAM), or a non-volatile memory device (non-volatile memory), such as a read-only memory device (read-only memory, ROM), a flash memory device, an HDD, or an SSD. Network device 402 is a network interface card used to communicate with the client and the KV storage pool.
[0054] The storage device 404 stores executable instructions, and the processor 401 executes the executable instructions to execute each module of the database instance to run Figure 4 The storage device 404 may also include executable instructions required to run an operating system (OS). The OS may be LINUX TM ,UNIX TM ,WINDOWS TM wait.
[0055] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented using software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital tenant line or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated. 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., an SSD).
Claims
1. A data operation method, characterized in that: include: The client sends a create request to the database instance; The database instance generates a configuration item according to the creation request, where the configuration item includes a bucket ID assigned by the database instance and metadata carried in the creation request; The database instance sends the bucket ID to the client; The client generates an in-memory database operation request according to the bucket ID; The client sends the memory database operation request to the database instance according to the Internet Protocol IP address assigned by the database instance, wherein the memory database operation request complies with the interface format of the memory database, the memory database uses memory to store tenant data to improve the processing speed of the tenant data, and the memory database operation request carries the bucket ID; The database instance converts the memory database operation request into a key-value KV operation request according to the bucket ID carried in the memory database operation request; The database instance sends the KV operation request to the KV storage pool; The KV storage pool executes the KV operation request.
2. The method according to claim 1, wherein The method further comprises: The database instance allocates the IP address for accessing the database instance, and sends the IP address to the client; The client sends the memory database operation request to the database instance according to the IP address.
3. The method according to claim 2, wherein The method further comprises: Another client sends another creation request to the database instance; The database instance generates another configuration item according to the another creation request, where the another configuration item includes another bucket ID allocated by the database instance and metadata carried in the another creation request; The database instance sends the other bucket ID to the other client; The database instance allocates another IP address for accessing the database instance, and sends the another IP address to the another client.
4. The method according to any one of claims 1 to 3, characterized in that The client runs in a virtual private cloud (VPC).
5. A data operation device, characterized in that: include: The interface module is used to receive the creation request sent by the client; A configuration module, configured to generate configuration items according to the creation request, wherein the configuration items include the bucket ID assigned by the configuration module and metadata carried in the creation request; The interface module is further configured to send the bucket ID to the client; The interface module is further configured to receive a memory database operation request sent by the client according to the Internet Protocol IP address assigned by the interface module, wherein the memory database operation request conforms to the interface format of the memory database, the memory database uses memory to store tenant data to improve the processing speed of the tenant data, and the memory database operation request carries the bucket ID; The semantic conversion module is used to convert the memory database operation request into a key-value KV operation request according to the bucket ID carried by the memory database operation request, and send the KV operation request to the KV storage pool.
6. The data operation device according to claim 5, wherein: The interface module is used to allocate an IP address for accessing the database instance and send the IP address to the client.
7. The data operation device according to claim 6, wherein: The interface module is configured to receive another creation request sent by another client; The configuration module generates another configuration item according to the another creation request, where the another configuration item includes another bucket ID assigned by the configuration module and metadata carried in the another creation request; The interface module is used to allocate another IP address for accessing the database instance and send the another IP address to the another client.
8. A computer, characterized in that: The method comprises a memory and a processor, wherein the memory stores instructions, and the processor runs the instructions to perform the method according to any one of claims 1 to 4.
9. A readable storage medium, characterized in that When the instructions stored in the readable storage medium are executed by a computer, the computer is caused to execute the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Log processing method and system based on key value database
CN105068765A
Database system providing single-tenant and multi-tenant environments
CN105074702A
Memory database instance management method and device
CN106021370A