A method and related device for managing application data
By allocating independent storage areas for each application in the cloud database system and managing them on a single node, the problem of low resource utilization of cloud databases in high concurrency scenarios is solved, and efficient reuse of resources and independent data storage are achieved. .
Patent Information
- Application Number
- CN202010647919.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-07
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2040-07-07
AI Technical Summary
When cloud databases face a large amount of user data and concurrent requests, they need to consider the multi-tenancy model to provide services. They must not only meet the isolation of user data, but also ensure the reliability and scalability of the system, resulting in high resource overhead and poor utilization. Low.
By allocating independent storage areas for each application in the database system and managing these storage areas on a single node, the computing resources of the node are used to ensure data isolation and optimize resource usage, and realize the reuse of storage resources.
It effectively reduces system resource overhead and deployment costs, improves resource utilization, and ensures that data of different applications are stored independently and do not interfere with each other.
Smart Images

Figure CN113918644B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a method for managing application data and a related device. Background Art
[0002] Cloud databases usually adopt a distributed architecture. When indicators such as the capacity of user data and the number of concurrent requests to access data are too large, the user data will be split and stored on different physical hosts or virtual machines.
[0003] Users can purchase hardware resources such as virtual machines and deploy databases by themselves. This approach requires users to consider issues such as reliability, maintainability, and scalability. The technical difficulty and workload are great, and the maintenance cost is also high.
[0004] Users can also choose to purchase database services provided by cloud service providers, such as CloudSQL and BigTable cloud database services provided by Google, Azure SQL database services provided by Microsoft, etc. As a cloud service provider, facing users with different business volumes, it is necessary to consider from many aspects which multi-tenancy model to choose to provide services, which must not only meet the isolation of user data, but also ensure the reliability and scalability of the system.
[0005] The database service can allocate storage resources of applications in the database system for application developers. In one implementation, each application can be deployed on a node in the database system, which can be a virtual machine, and different nodes are physically isolated. However, as the number of applications increases, the number of nodes that need to be deployed in the database system also increases, resulting in very high resource overhead and low resource utilization. Summary of the invention
[0006] In a first aspect, an embodiment of the present application provides a method for managing application data, the method comprising:
[0007] Obtain a first operation request, obtain the first operation request, the first operation request is used to operate the data related to the first application; wherein the first application can initiate a service request to the application server, and the application server can verify the legitimacy of the access of the first application, and after the verification is passed, the service request of the first application is converted into the first operation request. wherein the first operation request may include at least one of the following: add operation, delete operation, modify operation and query operation. send the first operation request to the first node of the database system, so that the first node performs the operation corresponding to the first operation request on the data in the first storage area; the application server can send the first operation request to the first node of the database system, wherein the first operation request may include the identifier of the first storage area, and the first node may perform the operation corresponding to the first operation request on the data in the first storage area based on the identifier of the first storage area. wherein if the first storage area corresponds to a schema in the database, the first operation request may include the identifier of the schema, and the first node may perform the operation corresponding to the first operation request on the data in the storage area (first storage area) corresponding to the identifier of the schema based on the identifier of the schema. Obtain a second operation request, the second operation request is used to operate data related to a second application; send the second operation request to the first node, so that the first node performs the operation corresponding to the second operation request on the data in the second storage area; wherein the first storage area and the second storage area are located in the first node, and the first storage area and the second storage area are two independent storage areas in the first node. wherein the first storage area and the second storage area are two independent storage areas on the first node, and the first storage area and the second storage area do not occupy common storage resources in the database memory; specifically, data related to the first application cannot be stored in the second storage area, and data related to the second application cannot be stored in the first storage area, the first node can perform the operation request related to the first application on the data in the first storage area, and cannot perform the operation request related to the first application on the data in the second storage area, the first node can perform the operation request related to the second application on the data in the second storage area, and cannot perform the operation request related to the second application on the data in the first storage area.
[0008] The embodiment of the present application provides a method for managing application data, the method comprising: obtaining a first operation request, the first operation request is used to operate data related to the first application; sending the first operation request to a first node of a database system, so that the first node performs the operation corresponding to the first operation request on data in a first storage area; obtaining a second operation request, the second operation request is used to operate data related to a second application; sending the second operation request to the first node, so that the first node performs the operation corresponding to the second operation request on data in a second storage area; wherein the first storage area and the second storage area are located at the first node, and the first storage area and the second storage area are two independent storage areas in the first node. Through the above method, storage resource isolation can be guaranteed, data of different applications are stored independently without interfering with each other, and different applications can reuse the computing resources of the same node, effectively reducing the resource overhead and deployment cost of the system and improving resource utilization.
[0009] In an optional implementation, the first node uses the computing resources of the first node to perform the operation corresponding to the first operation request on the data in the first storage area; the first node uses the computing resources of the first node to perform the operation corresponding to the second operation request on the data in the second storage area. Since both the first storage area and the second storage area are located in the first node, the first node can use the computing resources of the first node when performing operations on the data in the first storage area and the data in the second storage area, wherein the computing resources can be CPU resources, memory resources, and network bandwidth.
[0010] In an optional implementation, the first node is a virtual machine or a physical machine.
[0011] In an optional implementation, the first node includes a data node DN and a data storage device, and the data storage device includes the first storage area and the second storage area; sending the first operation request to the first node of the database system includes: sending the first operation request to the data node DN, so that the data node DN performs the operation corresponding to the first operation request on the data in the first storage area. The number of data nodes DN included in the first node can be one or more.
[0012] In an optional implementation, the operations corresponding to the first operation request and the second operation request include at least one of the following: an adding operation, a deleting operation, a modifying operation, and a querying operation.
[0013] In an optional implementation, the first storage area includes a first sub-storage area and a second sub-storage area, and the first sub-storage area and the second sub-storage area are two independent storage areas in the first node. The first storage area may include a first sub-storage area and a second sub-storage area, and the first sub-storage area and the second sub-storage area are two independent storage areas in the first node. That is, the first storage area can be further divided into multiple sub-storage areas, and at least two of the multiple sub-storage areas (the first sub-storage area and the second sub-storage area) are independent of each other. In this case, data related to the first application can be distributed in different sub-storage areas in the first storage area. In some scenarios, storage isolation is also required between some data of the same application (for example, data isolation between different game servers in a game application).
[0014] In an optional implementation, the method further includes: allocating, on the first node, computing resources available for the first node to operate the data stored in the first storage area; the available computing resources include at least one of the following: available CPU resources, available memory resources, and available network bandwidth.
[0015] In an optional implementation, the method further includes: obtaining a first computing resource used by the first node when operating the data stored in the first storage area, the first computing resource including at least one of the following: a used CPU resource, a used memory resource, and a used network bandwidth; based on the first computing resource being greater than a threshold, adjusting the computing resource available to the first node when operating the data stored in the first storage area. The threshold is the available computing resource pre-allocated to the first storage area, and different thresholds may be set for different computing resource types. Based on at least one of the used computing resources being greater than the corresponding threshold, the computing resource available to the first node when operating the data stored in the first storage area may be adjusted. More specifically, based on the used CPU resource being greater than the corresponding threshold, the CPU resource available to the first node when operating the data stored in the first storage area may be adjusted; the CPU resource available to the first node when operating the data stored in the first storage area may be a CPU occupancy rate, and the CPU occupancy rate may be a ratio of the CPU resource available to the first node when operating the data stored in the first storage area to the total CPU resources available to the first node. More specifically, based on the fact that the used memory resources are greater than the corresponding threshold, the memory resources available to the first node when operating the data stored in the first storage area may be adjusted; wherein the memory resources available to the first node when operating the data stored in the first storage area may be a memory occupancy rate, and the memory occupancy rate may be a ratio of the memory resources available to the first node when operating the data stored in the first storage area to the total memory resources available to the first node. More specifically, based on the fact that the used network bandwidth is greater than the corresponding threshold, the network bandwidth available to the first node when operating the data stored in the first storage area may be adjusted; wherein the network bandwidth available to the first node when operating the data stored in the first storage area may be a ratio of the network bandwidth available to the first node when operating the data stored in the first storage area to the upper limit of the network bandwidth available to the first node.
[0016] In an embodiment of the present application, the first node uses computing resources pre-allocated to the first storage area to perform the operation corresponding to the first operation request on the data in the first storage area, and uses computing resources pre-allocated to the second storage area to perform the operation corresponding to the second operation request on the data in the second storage area; when pre-allocating resources, the available computing resources allocated to the first storage area are limited. When the computing resources occupied by the first storage area exceed the pre-allocated resource upper limit, it is necessary to adjust the available computing resources of the first storage area.
[0017] In one implementation, the CPU resources used when operating the data in the first storage area can be obtained, and based on the CPU resources being greater than a threshold, the CPU resource usage rate available to the first storage area can be increased. In an embodiment of the present application, with respect to CPU resources, the total CPU usage rate of the current system and the total number of structured query language (SQL) statements being executed by the system can be obtained each time by sampling and counting. The average CPU usage rate of each SQL statement can be calculated by taking multiple samples to obtain the average value. The number of SQL statements currently being executed in each storage area can then be counted in real time to calculate the current CPU usage rate of each storage area.
[0018] In one implementation, the memory resources of the first node when operating the data stored in the first storage area can be obtained, and based on the memory resources being greater than a threshold, the memory resources available to the first storage area are increased. In the embodiment of the present application, with respect to memory resources, since cross-storage area data operations are not supported, that is, each data operation request is limited to one storage area, it is only necessary to accumulate the memory occupied by all data operations in each storage area within a statistical unit time to calculate the memory resources of each storage area.
[0019] In one implementation, the network bandwidth used by the first node when operating the data in the first storage area can be obtained, and based on the fact that the network bandwidth used by the first node when operating the data in the first storage area is greater than a threshold, the upper limit of the network bandwidth that can be used in the first storage area is increased. The used network bandwidth can be generated by the interaction between the distributed database system and the application. In the embodiment of the present application, with respect to the network bandwidth, since each data operation request is limited to one storage area, it is only necessary to accumulate the network bandwidth of all data operations in each storage area within a unit time to calculate the network bandwidth of each storage area.
[0020] In an optional implementation, the method further includes: allocating storage resources available for use by the first storage area on the first node.
[0021] In an optional implementation, the method further includes: acquiring storage resources used by the first storage area; and adjusting storage resources available for use in the first storage area based on the storage resources used by the first storage area being greater than a threshold.
[0022] In an embodiment of the present application, when resources are allocated in advance, the available storage resources allocated to the first storage area are limited. When the storage resource occupancy of the first storage area exceeds the upper limit of the pre-allocated resources, the available storage resources of the first storage area need to be adjusted.
[0023] In an optional implementation, the method further includes: obtaining a second computing resource used by the first node when operating data stored in the first node, the second computing resource used including at least one of the following: CPU resources used, memory resources used, and network bandwidth used; based on the second computing resource being greater than a threshold, migrating data related to the first application in the first storage area to a third storage area; wherein the third storage area is located at a second node of the database system, and the first node and the second node are different nodes.
[0024] In an embodiment of the present application, a first node uses the computing resources of the first node to perform an operation corresponding to the first operation request on data in a first storage area, and uses the computing resources of the first node to perform an operation corresponding to the second operation request on data in a second storage area; when resources are allocated in advance, the usable resources allocated to the first storage area are limited. When the resource occupancy of the first storage area exceeds the upper limit of the pre-allocated resources, it is necessary to adjust the usable resources of the first storage area. However, when the resource usage of the first node exceeds its own upper limit, data in some storage areas can be migrated to other nodes.
[0025] In an optional implementation, the storage resources used by the first node can also be obtained; based on the storage resources used by the first node being greater than a threshold, the data related to the first application in the first storage area is migrated to a third storage area; wherein the third storage area is located at the second node of the database system, and the first node and the second node are different nodes.
[0026] In one implementation, the CPU resources when operating the data in the first storage area can be obtained, and based on the CPU resources when operating the data in the first storage area being greater than a threshold, the data related to the first application in the first storage area is migrated to the third storage area; in one implementation, the memory resources of the first node can be obtained, and based on the memory resources of the first node being greater than a threshold, the data related to the first application in the first storage area is migrated to the third storage area; in one implementation, the network bandwidth of the first node can be obtained, and based on the network bandwidth of the first node being greater than a threshold, the data related to the first application in the first storage area is migrated to the third storage area; in one implementation, the storage resource occupancy of the data in the first node can be obtained, and based on the storage resource occupancy of the data in the first node being greater than a threshold, the data related to the first application in the first storage area is migrated to the third storage area. By counting and limiting the resource usage of the first storage area, as well as the storage area size level and the data limit in the node, it is possible to realize the sharing of data nodes by multiple storage areas, and when the resource usage of the node exceeds the threshold, the node is automatically expanded and the storage area data is migrated.
[0027] In an optional implementation, the method further includes: after migrating the data related to the first application in the first storage area to the third storage area, obtaining a third operation request related to the first application; and sending the third operation request to the second node so that the second node performs the operation corresponding to the third operation request on the data in the third storage area.
[0028] In an optional implementation, the first node includes a first database instance and a second database instance, the first database instance and the second database instance are different instances, the first database instance is used to manage the data stored in the first storage area, and the second database instance is used to manage the data stored in the second storage area. The first node may include multiple database instance instances, each database instance instance may correspond to an application, and the database instance instance may refer to a series of processes and memory blocks allocated to these processes, which is equivalent to deploying multiple application-related data on the first node, and allocating a database instance instance to each application. Since the first storage area stores data related to the first application, the first instance instance is used to manage the data stored in the first storage area (data related to the first application), and the second storage area stores data related to the second application, the second instance instance is used to manage the data stored in the second storage area (data related to the second application).
[0029] In an optional implementation, the first node includes a first schema and a second schema, the first schema and the second schema are different schemas, the first schema corresponds to the first storage area, and the second schema corresponds to the second storage area, and sending the first operation request to the first node of the database system so that the first node performs the operation corresponding to the first operation request on the data in the first storage area includes: sending the first operation request to the first node of the database system so that the first node performs the operation corresponding to the first operation request on the data in the storage area corresponding to the first schema; sending the second operation request to the first node so that the first node performs the operation corresponding to the second operation request on the data in the second storage area includes: sending the second operation request to the first node so that the first node performs the operation corresponding to the second operation request on the data in the storage area corresponding to the second schema.
[0030] In one implementation, the first storage area and the second storage area correspond to different schemas in the database. The schema can be understood as a collection of database objects, which includes various objects such as tables, views, stored procedures, indexes, etc. In order to distinguish different collections, different collections need to be given different names; if the database is regarded as a warehouse, the warehouse includes many rooms, and the rooms can be regarded as schemas, and a schema can represent a room. The first storage area and the second storage area correspond to different schemas in the database, which ensures that the first storage area and the second storage area are two independent storage areas on the first node, and the first storage area and the second storage area do not occupy common storage resources in the database memory.
[0031] In a second aspect, the present application provides a device for managing application data, the device comprising:
[0032] An acquisition module is used to acquire a first operation request, where the first operation request is used to operate data related to a first application; a sending module is used to send the first operation request to a first node of a database system, so that the first node performs the operation corresponding to the first operation request on data in a first storage area; the acquisition module is used to acquire a second operation request, where the second operation request is used to operate data related to a second application; the sending module is used to send the second operation request to the first node, so that the first node performs the operation corresponding to the second operation request on data in a second storage area; wherein the first storage area and the second storage area are located at the first node, and the first storage area and the second storage area are two independent storage areas in the first node.
[0033] In an optional implementation, the first node uses the computing resources of the first node to perform the operation corresponding to the first operation request on the data in the first storage area; the first node uses the computing resources of the first node to perform the operation corresponding to the second operation request on the data in the second storage area.
[0034] In an optional implementation, the first node is a virtual machine or a physical machine.
[0035] In an optional implementation, the first node includes a data node DN and a data storage device, and the data storage device includes the first storage area and the second storage area; the sending module is used to send the first operation request to the data node DN, so that the data node DN performs the operation corresponding to the first operation request on the data in the first storage area.
[0036] In an optional implementation, the operations corresponding to the first operation request and the second operation request include at least one of the following: an adding operation, a deleting operation, a modifying operation, and a querying operation.
[0037] In an optional implementation, the first storage area includes a first sub-storage area and a second sub-storage area, and the first sub-storage area and the second sub-storage area are two independent storage areas in the first node.
[0038] In an optional implementation, the device also includes: an allocation module, used to allocate computing resources available on the first node for the first node to operate the data stored in the first storage area; the available computing resources include at least one of the following: available CPU resources, available memory resources, and available network bandwidth.
[0039] In an optional implementation, the device also includes: a resource acquisition module, used to acquire a first computing resource used by the first node when operating the data stored in the first storage area, the first computing resource including at least one of the following: used CPU resources, used memory resources, and used network bandwidth; a computing resource adjustment module, used to adjust the computing resources available for use by the first node when operating the data stored in the first storage area based on the first computing resource being greater than a threshold.
[0040] In an optional implementation, the device further includes: an allocation module, configured to allocate storage resources available for use by the first storage area on the first node.
[0041] In an optional implementation, the device further includes: a resource acquisition module, used to acquire storage resources used by the first storage area; and a storage resource adjustment module, used to adjust the storage resources available for the first storage area based on the storage resources used by the first storage area being greater than a threshold.
[0042] In an optional implementation, the resource acquisition module is also used to acquire a second computing resource used by the first node when operating the data stored in the first node, and the used second computing resource includes at least one of the following: used CPU resources, used memory resources, and used network bandwidth; the device also includes: a resource migration module, which is used to migrate the data related to the first application in the first storage area to a third storage area based on the second computing resource being greater than a threshold; wherein the third storage area is located at a second node of the database system, and the first node and the second node are different nodes.
[0043] In an optional implementation, the resource acquisition module is also used to acquire the storage resources used by the first node; the device also includes: a resource migration module, used to migrate the data related to the first application in the first storage area to a third storage area based on the storage resources used by the first node being greater than a threshold; wherein the third storage area is located at a second node of the database system, and the first node and the second node are different nodes.
[0044] In an optional implementation, the acquisition module is used to obtain a third operation request after migrating the data related to the first application in the first storage area to the third storage area, and the third operation request is used to operate the data related to the first application; the sending module is used to send the third operation request to the second node, so that the second node performs the operation corresponding to the third operation request on the data in the third storage area.
[0045] In an optional implementation, the first node includes a first database instance and a second database instance, the first database instance and the second database instance are different instances, the first database instance is used to manage data stored in the first storage area, and the second database instance is used to manage data stored in the second storage area.
[0046] In an optional implementation, the first node includes a first schema and a second schema, the first schema and the second schema are different schemas, the first schema corresponds to the first storage area, and the second schema corresponds to the second storage area, the sending module is used to send the first operation request to the first node of the database system, so that the first node performs the operation corresponding to the first operation request on the data in the storage area corresponding to the first schema; the sending module is used to send the second operation request to the first node, so that the first node performs the operation corresponding to the second operation request on the data in the storage area corresponding to the second schema.
[0047] In a third aspect, the present application provides a device for managing application data, which may include a processor, the processor and a memory are coupled, the memory stores program instructions, and when the program instructions stored in the memory are executed by the processor, the first aspect and any of the methods described above are implemented. For the steps performed by the processor in each possible implementation of the first aspect, please refer to the first aspect for details, and no further description is given here.
[0048] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, which, when executed on a computer, enables the computer to execute any of the methods described in the first aspect above.
[0049] In a fifth aspect, the present application provides a circuit system, which includes a processing circuit, and the processing circuit is configured to execute the first aspect and any one of the methods described above.
[0050] In a sixth aspect, the present application provides a computer program which, when executed on a computer, enables the computer to execute any of the methods described in the first aspect above.
[0051] In a seventh aspect, the present application provides a chip system, which includes a processor for implementing the functions involved in the above aspects, for example, sending or processing the data and / or information involved in the above method. In one possible design, the chip system also includes a memory, which is used to store program instructions and data necessary for the server or communication device. The chip system can be composed of chips, or it can include chips and other discrete devices.
[0052] The embodiment of the present application provides a method for managing application data, the method comprising: obtaining a first operation request, the first operation request is used to operate data related to the first application; sending the first operation request to a first node of a database system, so that the first node performs the operation corresponding to the first operation request on data in a first storage area; obtaining a second operation request, the second operation request is used to operate data related to a second application; sending the second operation request to the first node, so that the first node performs the operation corresponding to the second operation request on data in a second storage area; wherein the first storage area and the second storage area are located at the first node, and the first storage area and the second storage area are two independent storage areas in the first node. Through the above method, storage resource isolation is guaranteed, data of different applications are stored independently without interfering with each other, and different applications can reuse the computing resources of the same node, effectively reducing the resource overhead and deployment cost of the system and improving resource utilization. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1A A schematic diagram of the architecture of a database system;
[0054] Figure 1B A schematic diagram of the architecture of a distributed database system provided in an embodiment of the present application;
[0055] Figure 1C Another schematic diagram of the architecture of the distributed database system provided in the embodiment of the present application;
[0056] Figure 1D An application architecture diagram provided for an embodiment of the present application;
[0057] Figure 1E An application data management system provided in an embodiment of the present application;
[0058] Figure 2 A schematic diagram of a process for managing application data provided by an embodiment of the present application;
[0059] Figure 3 A schematic diagram of the structure of a virtual machine provided in an embodiment of the present application;
[0060] Figure 4 A schematic diagram of the structure of a system provided in an embodiment of the present application;
[0061] Figure 5a A schematic diagram of a node shown in an embodiment of the present application;
[0062] Figure 5b A schematic diagram of a system shown in an embodiment of the present application;
[0063] Figure 6 A schematic diagram of the structure of a device for managing application data provided in an embodiment of the present application;
[0064] Figure 7 A computer-readable storage medium is provided for the present application;
[0065] Figure 8 A schematic diagram of a computer device provided for this application;
[0066] Fig. 9 A schematic diagram of a cluster database system provided in this application. DETAILED DESCRIPTION
[0067] The following describes the embodiments of the present application in conjunction with the accompanying drawings. Obviously, the described embodiments are only embodiments of a part of the present application, rather than all embodiments. It is known to those skilled in the art that with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0068] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described here can be implemented in an order other than that illustrated or described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or modules is not necessarily limited to those steps or modules clearly listed, but may include other steps or modules that are not clearly listed or inherent to these processes, methods, products or devices. The naming or numbering of steps in this application does not mean that the steps in the method flow must be executed in the time or logical sequence indicated by the naming or numbering. The process steps that have been named or numbered can change the execution order according to the technical purpose to be achieved, as long as the same or similar technical effects can be achieved.
[0069] The method provided in the embodiment of the present application can be applied to Figure 1AIn the database system 100 shown, the database system 100 is connected in communication with an application server 300 so as to provide database services for the application server 300. The application server 300 is connected in communication with a client 200. The client 200 is usually an application deployed on a user device. The client 200 initiates a service request to the application server 300 to implement a specific function, such as downloading or uploading data. The data related to the client 200 is stored in the database system 100. When the application server 300 responds to the service request of the client 200, if it needs to operate the data related to the client 200 (such as querying data, adding data, updating data and deleting data, etc.), it can be realized by sending an operation request to the database system 100.
[0070] Figure 1A A typical logical architecture of the database system 100 is shown. Figure 1A The database system 100 includes a database 110 and a database management system (DBMS) 130 .
[0071] Among them, the database 110 is an organized data set stored in the data storage 120, that is, a collection of associated data organized, stored and used according to a specific data model. According to the different data models used to organize data, data can be divided into multiple types, such as relational data, graph data, time series data, etc. Relational data is data modeled using a relational model, usually represented as a table, and the rows in the table represent a set of related values of an object or entity. Graph data, referred to as "graph", is used to represent the relationship between objects or entities, such as social relationships. Time series data, referred to as time series data, is a data column recorded and indexed in chronological order, used to describe the state change information of an object in the time dimension.
[0072] The database management system 130 is the core of the database system and is a system software for organizing, storing and maintaining data. The client 200 can access the database 110 through the database management system 130, and the database administrator also performs database maintenance work through the database management system. The database management system 130 provides multiple functions for the client 200 to establish, modify and query the database, wherein the client 200 can be an application or a user device running an application. The functions provided by the database management system 130 may include but are not limited to the following: (1) Data definition function. The database management system 130 provides a data definition language (DDL) to define the structure of the database 110. DDL is used to describe the database framework and can be saved in the data dictionary; (2) Data access function. The database management system 130 provides a data manipulation language (DML) to implement basic access operations on the database 110, such as retrieval, insertion, modification and deletion; (3) Database operation management function. The database management system 130 provides a data control function to effectively control and manage the operation of the database 110 to ensure that the data is correct and valid; (4) Database establishment and maintenance function, including loading of initial database data, database dumping, recovery, reorganization, system performance monitoring, analysis and other functions; (5) Database transmission. The database management system provides transmission of processed data to achieve communication between the client and the database management system, which is usually coordinated with the operating system.
[0073] The database storage 120 includes, but is not limited to, solid state drives (SSDs), disk arrays, cloud storage, or other types of non-transitory computer-readable storage media.
[0074] In the embodiment of the present application, the client 200 may initiate a service request to the application server 300, and the application server 300 is deployed with a data service for responding to the service request initiated by the client 200. In one embodiment, the data service deployed on the application server 300 may verify the legitimacy of the access of the client 200, record the session after the verification, and convert the service request initiated by the client 200 into a data operation request, such as a query statement, to the database 110. Furthermore, the data service may perform real-time statistics and control on the system resources occupied by different clients 200.
[0075] It should be understood that a person skilled in the art will understand that a database system may include Figure 1A Fewer or more components than those shown in the figure, or including Figure 1A The components shown are different components, Figure 1A Only components more relevant to the implementation disclosed in the embodiment of the present invention are shown.
[0076] Combine the following Figure 1B An embodiment of an application server 300 provided in the present application is introduced.
[0077] The functions implemented by the application server 300 may include but are not limited to access control, session management, data management, resource monitoring, storage management, etc. Among them, access control can control the legitimacy of client access and bandwidth. Session management can perform session management on clients that have successfully accessed. Data management can convert client service requests into operation requests for the database. Resource monitoring can perform real-time statistics and control on system resources occupied by different clients. Storage management can convert operation requests for the database into operation requests that are supported or executable by the database system, such as database query statements (referred to as "queries"), which can be structured query language (SQL) queries. It should be noted that the application server 300 converts service requests into queries that are supported or executable by the database system, which can be completed once or in multiple times, and the specific conversion process belongs to the prior art in this field.
[0078] The database system provided in the embodiment of the present application may be a distributed database system (DDBS), such as a database system with a massively parallel processor (MPP) architecture. Figure 1C and Figure 1D Introducing DDBS.
[0079] Figure 1CThe schematic diagram of a distributed database system using a shared-storage architecture includes one or more coordinator nodes (CN), multiple data nodes (DN). Of course, the DDBS may also include other components, such as a global transaction manager (GTM). CN and DN communicate through a network channel. CN can generate an execution plan corresponding to a received query, such as a query from an application server, and distribute the query to a corresponding DN for execution based on the execution plan. CN can also generate a query result based on the execution result of the DN. In one embodiment, the network channel may be composed of network devices such as switches, routers, and gateways. CN and DN jointly implement the functions of a database management system and provide database retrieval, insertion, modification, and deletion services to the client. In one embodiment, a database management system is deployed on each CN and DN. The shared data storage stores data that can be shared by multiple DNs, and the DN can perform read and write operations on the data in the data storage through the network channel. The shared data storage may be a shared disk array. The CN and DN in the distributed database system can be physical machines, such as database servers, or virtual machines (VM) or containers running on abstract hardware resources. In one embodiment, the CN and DN are virtual machines or containers, and the network channel is a virtual switching network, which includes a virtual switch. The database management system deployed in the CN and DN is a DBMS instance, which can be a process or a thread, and these DBMSs cooperate to complete the functions of the database relational system. In another embodiment, the CN and DN are physical machines, and the network channel includes one or more switches, which are storage area network (SAN) switches, Ethernet switches, fiber switches or other physical switching devices.
[0080] Figure 1D This is a diagram of a distributed database system that uses a shared-nothing architecture. Each DN has its own exclusive hardware resources (such as CPU, memory, data storage, etc.). CN and DN communicate through a network channel. The network channel can be found in the above Figure 1C Under this system, data will be distributed to each DN according to the database model and application characteristics. The query task will be divided into several parts by CN and executed in parallel on multiple DNs. They will coordinate calculations with each other and provide database services as a whole. All communication functions are implemented on a high-bandwidth network interconnection system. Figure 1CLike the distributed database system with shared-storage architecture described in the previous section, the CN and DN here can be either physical machines or virtual machines.
[0081] In all embodiments of the present application, the data storage of the database system includes but is not limited to solid state drives (SSDs), disk arrays, or other types of non-transitory computer-readable media. Figure 1C-Figure 1D Although the database is not shown in the figure, it should be understood that the database is stored in the data storage. A person skilled in the art can understand that a database system may include Figure 1A-Figure 1D Fewer or more components than those shown in the figure, or including Figure 1A - Figure 1D The components shown in the figure are different components. Figure 1A-Figure 1D Only components more relevant to the implementation disclosed in the embodiments of the present application are shown. However, those skilled in the art can understand that a distributed database system can include any number of CNs and DNs. The database management system functions of each CN and DN can be implemented by a suitable combination of software, hardware and / or firmware running on each CN and DN.
[0082] In the embodiment of the present application, the distributed database system can provide application developers with deployment services for application programs (APP). Specifically, the application program can be deployed in a node in the distributed database system, such as a virtual machine. The virtual machine can include one or more data nodes DN and corresponding data storage devices (for example, Figure 1C The shared data memory in Figure 1D The application can send a service request to the application server, and the application server processes the service request, for example, converts the service request of the application into one or more data operation requests (referred to as "operation requests") supported or executable by the database system, and sends the data operation request to the distributed database system. In response to the data operation request, the DN corresponding to the application in the distributed database system operates the data in the data storage.
[0083] Figure 1EAn application data management system provided by an embodiment of the present application is shown. Specifically, as shown, a data node cluster may include multiple data node DNs. Application developers may deploy relevant data of developed applications in corresponding data node DNs. Applications may send service requests to application servers, and application servers may convert service requests into data operation requests; application servers may send data operation requests to distributed database systems. Then, one or more data node DNs in the distributed database system perform operations corresponding to the operation requests on data in the database memory. Specifically, the application server may send data operation requests to coordination nodes in the coordination node cluster, and the coordination nodes may forward the operation requests to relevant DNs, and the relevant DNs may perform data operations corresponding to the operation requests.
[0084] Figure 2 A schematic diagram of a process for managing application data provided by an embodiment of the present application is shown in FIG. Figure 2 As shown, the method for managing application data provided by the embodiment of the present application includes:
[0085] 201. Obtain a first operation request, where the first operation request is used to operate data related to a first application.
[0086] In the embodiment of the present application, the first application may initiate a service request to the application server, and the application server may verify the legitimacy of the access of the first application, and convert the service request of the first application into a first operation request after the verification is passed. The first operation request may include at least one of the following: data addition operation, data deletion operation, data modification operation, and data query operation.
[0087] In an embodiment of the present application, before obtaining a first operation request related to a first application, a first storage area may be allocated to the first application so that data related to the first application is stored in the first storage area; wherein the first storage area is located at a first node.
[0088] In one implementation, the first node is a logical concept, and the first node may be a virtual machine or a physical machine. Figure 3 An example of a first node provided by an embodiment of the present application is shown, wherein the first node has a data storage device, and the data storage device may include multiple storage areas (including a first storage area and a second storage area), and each storage area is independent of each other. Since both the first storage area and the second storage area are located in the first node, the data node DN in the first node can use the computing resources of the first node when performing operations on the data in the first storage area and the data in the second storage device, wherein the computing resources may be at least one of resources such as CPU, memory, and network bandwidth.
[0089] In an embodiment of the present application, multiple database instances can be deployed on the first node, each database instance uniquely corresponds to an application, and the database instance can refer to one or more processes and the memory allocated to these processes, which is equivalent to deploying data related to multiple applications on the first node and allocating a database instance to each application.
[0090] In an embodiment of the present application, the distributed database system can provide a first storage area on the first node to an application developer of a first application, and then the application developer of the first application can deploy data related to the first application in the first storage area.
[0091] Reference Figure 4 , Figure 4 A schematic diagram of the structure of a system provided in an embodiment of the present application is shown as follows: Figure 4 As shown in the figure, the distributed database system may include nodes 1, ..., node n, wherein node 1 includes storage area 1, storage area 2, ..., storage area n, storage area 1 can store data related to application 1, storage area 2 can store data related to application 2, and in order to ensure the isolation of data related to application 1 and data related to application 2, storage area 1 and storage area 2 are two independent storage areas on node 1, and since they are deployed on the same node, the computing resources of node 1 can be used to operate the data in storage area 1 and storage area 2.
[0092] Similarly, the first node may also include a second storage area, wherein the distributed database system may allocate the second storage area for the second application, so that data related to the second application is stored in the second storage area. The first application and the second application are different applications, and in order to ensure the isolation of storage resources between the first application and the second application, the first storage area and the second storage area are two independent storage areas on the first node.
[0093] Among them, the first storage area and the second storage area are two independent storage areas on the first node, and the first storage area and the second storage area do not occupy common storage resources in the database storage device; specifically, data related to the first application cannot be stored in the second storage area, and data related to the second application cannot be stored in the first storage area. The first node can execute operation requests related to the first application on the data in the first storage area, but cannot execute operation requests related to the first application on the data in the second storage area. The first node can execute operation requests related to the second application on the data in the second storage area, but cannot execute operation requests related to the second application on the data in the first storage area.
[0094] In one implementation, the first storage area and the second storage area are different schemas in the database. The schema can be understood as a collection of database objects, which includes various objects such as tables, views, stored procedures, indexes, etc. In order to distinguish different collections, different collections need to be given different names; if the database is regarded as a warehouse, the warehouse includes many rooms, and the rooms can be regarded as schemas, and a schema can represent a room. The first storage area and the second storage area are different schemas in the database, which ensures that the first storage area and the second storage area are two independent storage areas on the first node, and the first storage area and the second storage area do not occupy common storage resources in the database memory.
[0095] In the embodiment of the present application, the first node uses the computing resources of the first node to perform the operation corresponding to the first operation request on the data in the first storage area, and uses the computing resources of the first node to perform the operation corresponding to the second operation request on the data in the second storage area; when the resources are allocated in advance, the available resources allocated to the first storage area are limited. When the resource occupancy of the first storage area exceeds the upper limit of the pre-allocated resources, the application server needs to adjust the available resources of the first storage area; the following describes in detail how to adjust the available resources of the first storage area:
[0096] In an optional implementation, the application server may allocate computing resources on the first node that are available for the first node to operate the data stored in the first storage area; the available computing resources include at least one of the following: available CPU resources, available memory resources, and available network bandwidth.
[0097] In an optional implementation, the application server can obtain the first computing resources used by the first node when operating the data stored in the first storage area, the first computing resources including at least one of the following: used CPU resources, used memory resources, and used network bandwidth; based on the first computing resources being greater than a threshold, adjust the computing resources that can be used by the first node when operating the data stored in the first storage area.
[0098] Among them, the threshold is the available computing resources pre-allocated to the first storage area. Different thresholds can be set for different types of computing resources. Based on the fact that at least one of the used computing resources is greater than the corresponding set threshold, the computing resources available for the first node to operate the data stored in the first storage area can be adjusted.
[0099] More specifically, based on the fact that the used CPU resources are greater than the corresponding threshold, the CPU resources available for use by the first node when operating the data stored in the first storage area may be adjusted; wherein, the CPU resources available for use by the first node when operating the data stored in the first storage area may be a CPU occupancy rate, and the CPU occupancy rate may be a ratio of the CPU resources available for use by the first node when operating the data stored in the first storage area to all CPU resources available to the first node.
[0100] More specifically, based on the fact that the used memory resources are greater than the corresponding threshold, the memory resources available for use by the first node when operating the data stored in the first storage area can be adjusted; wherein, the memory resources available for use by the first node when operating the data stored in the first storage area can be a memory occupancy rate, and the memory occupancy rate can be a ratio of the memory resources available for use by the first node when operating the data stored in the first storage area to all memory resources available to the first node.
[0101] More specifically, based on the fact that the used network bandwidth is greater than the corresponding threshold, the network bandwidth available for use by the first node when operating the data stored in the first storage area can be adjusted; wherein, the network bandwidth available for use by the first node when operating the data stored in the first storage area can be the ratio of the network bandwidth available for use by the first node when operating the data stored in the first storage area to the upper limit of the network bandwidth available to the first node.
[0102] In an embodiment of the present application, the first node uses computing resources pre-allocated to the first storage area to perform the operation corresponding to the first operation request on the data in the first storage area, and uses computing resources pre-allocated to the second storage area to perform the operation corresponding to the second operation request on the data in the second storage area; when pre-allocating resources, the available computing resources allocated to the first storage area are limited. When the computing resources occupied by the first storage area exceed the pre-allocated resource upper limit, it is necessary to adjust the available computing resources of the first storage area.
[0103] In one implementation, the CPU resources used when operating the data in the first storage area may be obtained, and based on the CPU resources being greater than a threshold, the CPU resource occupancy rate available for the first storage area may be increased.
[0104] In the embodiment of the present application, for CPU resources, the total CPU occupancy rate of the current system and the total number of structured query language (SQL) statements being executed by the system can be obtained by sampling statistics each time. The average CPU occupancy rate of each SQL statement can be calculated by taking multiple samples to obtain the average value. The number of SQL statements currently being executed in each storage area can be counted in real time to calculate the current CPU occupancy rate of each storage area.
[0105] In one implementation, the application server may obtain memory resources used by the first node when operating data stored in the first storage area, and increase available memory resources for the first storage area based on the memory resources being greater than a threshold.
[0106] In the embodiment of the present application, with respect to memory resources, since cross-storage area data operations are not supported, that is, each data operation request is limited to one storage area, it is only necessary to accumulate the memory occupied by all data operations in each storage area within a unit time to calculate the memory occupancy rate of each storage area.
[0107] In one implementation, the application server may obtain the network bandwidth used by the first node when operating the data in the first storage area, and increase the upper limit of the network bandwidth that can be used by the first storage area based on the fact that the network bandwidth used by the first node when operating the data in the first storage area is greater than a threshold. The used network bandwidth may be generated by the interaction between the distributed database system and the application.
[0108] In the embodiment of the present application, with respect to network bandwidth, since each data operation request is limited to one storage area, the network bandwidth of each storage area can be calculated by simply adding up the network bandwidth used by all data operations in each storage area within a unit time.
[0109] In an optional implementation, the application server may allocate storage resources available to the first storage area on the first node.
[0110] In an optional implementation, the application server may obtain storage resources used by the first storage area; and adjust storage resources available for use in the first storage area based on the fact that the storage resources used by the first storage area are greater than a threshold.
[0111] In an embodiment of the present application, when resources are allocated in advance, the available storage resources allocated to the first storage area are limited. When the storage resource occupancy of the first storage area exceeds the upper limit of the pre-allocated resources, the available storage resources of the first storage area need to be adjusted.
[0112] Optionally, in an embodiment of the present application, when creating a storage area, resources (computing resources and storage resources) can be allocated to the storage area at a minimum level, where the resources may include at least one of available CPU resource occupancy, available memory resource occupancy, network bandwidth upper limit, and available disk occupancy.
[0113] Specifically, resources can be divided into several levels, and resources can be allocated based on the storage area. For example, resources can be divided into 6 levels, and the resource quota allocated to each level can be as shown in the following table:
[0114]
[0115] In the embodiment of the present application, the resource level definition and the percentage of resources occupied by each level can be dynamically configured, that is, adjusted according to the actual business volume. As the scale of application users increases and the business volume grows, the demand for resources by application is also increasing. The application divides and manages data by storage area. When the resource level corresponding to the storage area cannot meet the actual resource needs of the application, it is necessary to dynamically and gradually increase the resources of the storage area. This process relies on real-time monitoring of the resources of all storage areas in the node.
[0116] In the embodiment of the present application, for each storage area, through the above statistics of the resource usage status of the first storage area, it is determined that as long as any resource exceeds the level of the current storage area, the resource level of the storage area needs to be upgraded. For example, assuming that the current resource level of a storage area is level 2, and the upper limit of the CPU occupancy corresponding to resource level 2 is 5%. If it is found during the statistical process that the CPU occupancy of the storage area exceeds 5%, the level of the storage area needs to be upgraded to level 3, and the corresponding upper limit of the CPU occupancy is 10%.
[0117] In an embodiment of the present application, a second computing resource used by the first node when operating data stored in the first node is obtained, and the second computing resource used includes at least one of the following: CPU resources used, memory resources used, and network bandwidth used; based on the second computing resource being greater than a threshold, the data related to the first application in the first storage area is migrated to a third storage area; wherein the third storage area is located at a second node of the database system, and the first node and the second node are different nodes.
[0118] In an embodiment of the present application, a first node uses the computing resources of the first node to perform an operation corresponding to the first operation request on data in a first storage area, and uses the computing resources of the first node to perform an operation corresponding to the second operation request on data in a second storage area; when resources are allocated in advance, the usable resources allocated to the first storage area are limited. When the resource occupancy of the first storage area exceeds the upper limit of the pre-allocated resources, it is necessary to adjust the usable resources of the first storage area. However, when the resource usage of the first node exceeds its own upper limit, data in some storage areas can be migrated to other nodes.
[0119] In an optional implementation, the storage resources used by the first node can also be obtained; based on the storage resources used by the first node being greater than a threshold, the data related to the first application in the first storage area is migrated to a third storage area; wherein the third storage area is located at the second node of the database system, and the first node and the second node are different nodes.
[0120] In one implementation, the CPU resources used when operating on the data in the first storage area can be obtained, and based on the CPU resources used when operating on the data in the first storage area being greater than a threshold, the data related to the first application in the first storage area is migrated to a third storage area; in one implementation, the memory resources of the first node can be obtained, and based on the memory resources of the first node being greater than a threshold, the data related to the first application in the first storage area is migrated to a third storage area; in one implementation, the network bandwidth of the first node can be obtained, and based on the network bandwidth of the first node being greater than a threshold, the data related to the first application in the first storage area is migrated to a third storage area; in one implementation, the storage resource occupancy of the data in the first node can be obtained, and based on the storage resource occupancy of the data in the first node being greater than a threshold, the data related to the first application in the first storage area is migrated to a third storage area.
[0121] By counting and limiting the resource usage of the first storage area, as well as the storage area size level and data restrictions in the node, multiple storage areas can share data nodes, and when the resource usage of the node exceeds the threshold, automatic node expansion and storage area data migration can be achieved.
[0122] Specifically, when the utilization rate of various resources in the storage area of the first node reaches a threshold, the storage area needs to be migrated. In an optional implementation, the snapshot copy and incremental logical log functions can be used for cross-node migration to copy each table snapshot and logical log of the storage area. When all tables have copied the snapshots and the incremental logical logs have been kept up, the storage area is locked and intercepted. After the remaining logical logs are synchronized, the route is switched, the storage area at the new location takes over the service, and the storage area at the original location is cleared.
[0123] It should be noted that the first storage area is a storage area in the first node. For other storage areas in the node, the method for managing application data similar to the first storage area can also be adopted, which will not be repeated here.
[0124] This embodiment realizes sharing of data nodes by multiple storage areas through statistics and restrictions on resource usage of the first storage area, as well as storage area size levels and data restrictions in the nodes, and realizes automatic node expansion and storage area data migration when the resource usage of the node exceeds the threshold.
[0125] It should be noted that the first storage area may include a first sub-storage area and a second sub-storage area, and the first sub-storage area and the second sub-storage area are two independent storage areas in the first node. That is, the first storage area can be further divided into multiple sub-storage areas, and at least two of the multiple sub-storage areas (the first sub-storage area and the second sub-storage area) are independent of each other. In this case, data related to the first application can be distributed in different sub-storage areas in the first storage area. In some scenarios, partial data of the same application also needs to be stored isolated (for example, in a game application, data isolation between different game servers).
[0126] For example, refer to Figure 5a , Figure 5a A schematic diagram of a node shown in an embodiment of the present application, such as Figure 5a As shown in FIG. 1 , node 1 includes storage area 1, storage area 2, etc., and both storage area 1 and storage area 2 can store data related to application 1. Figure 5b , Figure 5b A schematic diagram of a system shown in an embodiment of the present application is shown in FIG. Figure 5b As shown in , application APP 1 corresponds to database instance 1, wherein database instance 1 corresponds to multiple storage areas (sub-storage area 1, sub-storage area 2, and sub-storage area 3), and sub-storage area 1, sub-storage area 2, and sub-storage area 3 belong to node 1.
[0127] 202. The application server sends the first operation request to a first node of a database cluster, so that the first node performs the operation corresponding to the first operation request on the data in the first storage area.
[0128] In the embodiment of the present application, the application server may store mapping relationships between various applications, nodes, and storage areas, for example, Figure 4 In the system shown in , in the mapping relationship stored in the application server, application 1 may have a mapping relationship with node 1 and storage area 1 in node 1. When the application server obtains an operation request related to application 1 (receives a service request from application 1 and generates an operation request), it may determine that application 1 corresponds to node 1 and storage area 1 in node 1 based on the stored mapping relationship.
[0129] In an embodiment of the present application, after determining the node and storage area corresponding to the operation request, the application server can send the operation request to the determined node; specifically, after determining that the first operation request corresponds to the first storage area in the first node, the application server can send the first operation request to the first node so that the first node performs the operation corresponding to the first operation request on the data in the first storage area.
[0130] When the application server determines that the first operation request corresponds to the first storage area in the first node, the first operation request can be sent to the data node DN in the first node, so that the data node DN in the first node performs the operation corresponding to the first operation request on the data in the first storage area. A first node may include one or more data nodes, which is not limited here.
[0131] 203. The application server obtains a second operation request related to the second application program.
[0132] Step 203 may be similar to obtaining the first operation request related to the first application in step 201. For details, please refer to the specific description in step 201, which will not be repeated here.
[0133] 204. The application server sends the second operation request to the first node, so that the first node performs the operation corresponding to the second operation request on the data in the second storage area; wherein the first storage area and the second storage area are located in the first node, and the first storage area and the second storage area are two independent storage areas in the first node.
[0134] Step 204 may be similar to sending the first operation request to the first node in step 202 so that the first node performs the operation corresponding to the first operation request on the data in the first storage area. For details, please refer to the specific description of step 202, which will not be repeated here.
[0135] In an optional implementation, after migrating the data related to the first application in the first storage area to the third storage area, the application server may also memorize and obtain a third operation request related to the first application, and send the third operation request to the second node, so that the second node performs the operation corresponding to the third operation request on the data in the third storage area.
[0136] In an optional implementation, the first node includes a first database instance and a second database instance, the first database instance and the second database instance are different instances, the first database instance is used to manage data stored in the first storage area, and the second database instance is used to manage data stored in the second storage area.
[0137] The first node may include multiple database instances, each of which may correspond to an application. The database instance may refer to a series of processes and memory blocks allocated to these processes, which is equivalent to deploying data related to multiple applications on the first node, and allocating a database instance to each application. Since the first storage area stores data related to the first application, the first instance is used to manage the data stored in the first storage area (data related to the first application), and the second storage area stores data related to the second application, the second instance is used to manage the data stored in the second storage area (data related to the second application).
[0138] In an optional implementation, the first node includes a first schema and a second schema, the first schema and the second schema are different schemas, the first schema corresponds to the first storage area, and the second schema corresponds to the second storage area, and sending the first operation request to the first node of the database system so that the first node performs the operation corresponding to the first operation request on the data in the first storage area includes:
[0139] Sending the first operation request to a first node of a database system so that the first node performs an operation corresponding to the first operation request on data in a storage area corresponding to the first schema;
[0140] The sending the second operation request to the first node so that the first node performs the operation corresponding to the second operation request on the data in the second storage area includes:
[0141] The second operation request is sent to the first node, so that the first node performs the operation corresponding to the second operation request on the data in the storage area corresponding to the second schema.
[0142] In one implementation, the first storage area and the second storage area correspond to different schemas in the database. The schema can be understood as a collection of database objects, which includes various objects such as tables, views, stored procedures, indexes, etc. In order to distinguish different collections, different collections need to be given different names; if the database is regarded as a warehouse, the warehouse includes many rooms, and the rooms can be regarded as schemas, and a schema can represent a room. The first storage area and the second storage area correspond to different schemas in the database, which ensures that the first storage area and the second storage area are two independent storage areas on the first node, and the first storage area and the second storage area do not occupy common storage resources in the database memory.
[0143] The embodiment of the present application provides a method for managing application data, the method comprising: obtaining a first operation request, the first operation request is used to operate data related to the first application; sending the first operation request to a first node of a database system, so that the first node performs the operation corresponding to the first operation request on data in a first storage area; obtaining a second operation request, the second operation request is used to operate data related to a second application; sending the second operation request to the first node, so that the first node performs the operation corresponding to the second operation request on data in a second storage area; wherein the first storage area and the second storage area are located at the first node, and the first storage area and the second storage area are two independent storage areas in the first node. Through the above method, storage resource isolation is guaranteed, data of different applications are stored independently without interfering with each other, and different applications can reuse the computing resources of the same node, effectively reducing the resource overhead and deployment cost of the system and improving resource utilization.
[0144] Reference Figure 6 , Figure 6 A schematic diagram of the structure of a device for managing application data provided in an embodiment of the present application is shown as follows: Figure 6 As shown in FIG. 6 , the device 600 for managing application data provided in the embodiment of the present application includes:
[0145] An acquisition module 601 is used to acquire a first operation request, where the first operation request is used to operate data related to a first application program;
[0146] A sending module 602, configured to send the first operation request to a first node of a database system, so that the first node performs an operation corresponding to the first operation request on data in a first storage area;
[0147] The acquisition module 601 is used to acquire a second operation request, where the second operation request is used to operate data related to the second application;
[0148] The sending module 602 is used to send the second operation request to the first node, so that the first node performs the operation corresponding to the second operation request on the data in the second storage area; wherein the first storage area and the second storage area are located in the first node, and the first storage area and the second storage area are two independent storage areas in the first node.
[0149] In an optional implementation, the first node uses the computing resources of the first node to perform the operation corresponding to the first operation request on the data in the first storage area; the first node uses the computing resources of the first node to perform the operation corresponding to the second operation request on the data in the second storage area.
[0150] In an optional implementation, the first node is a virtual machine or a physical machine.
[0151] In an optional implementation, the first node includes a data node DN and a data storage device, and the data storage device includes the first storage area and the second storage area;
[0152] The sending module is used to send the first operation request to the data node DN, so that the data node DN performs the operation corresponding to the first operation request on the data in the first storage area.
[0153] In an optional implementation, the operations corresponding to the first operation request and the second operation request include at least one of the following: an adding operation, a deleting operation, a modifying operation, and a querying operation.
[0154] In an optional implementation, the first storage area includes a first sub-storage area and a second sub-storage area, and the first sub-storage area and the second sub-storage area are two independent storage areas in the first node.
[0155] In an optional implementation, the device further includes:
[0156] Allocation module 603 is used to allocate computing resources available to the first node for operating the data stored in the first storage area on the first node; the available computing resources include at least one of the following: available CPU resources, available memory resources and available network bandwidth.
[0157] In an optional implementation, the device further includes:
[0158] a resource acquisition module, configured to acquire a first computing resource used by the first node when operating the data stored in the first storage area, wherein the first computing resource includes at least one of the following: a used CPU resource, a used memory resource, and a used network bandwidth;
[0159] A computing resource adjustment module is used to adjust the computing resources that can be used by the first node when operating the data stored in the first storage area based on the fact that the first computing resource is greater than a threshold.
[0160] In an optional implementation, the device further includes:
[0161] An allocation module is used to allocate storage resources available for use by the first storage area on the first node.
[0162] In an optional implementation, the device further includes:
[0163] A resource acquisition module, used to acquire storage resources used by the first storage area;
[0164] The storage resource adjustment module is used to adjust the storage resources available for the first storage area based on the fact that the storage resources used by the first storage area are greater than a threshold.
[0165] In an optional implementation, the resource acquisition module is further used to acquire a second computing resource used by the first node when operating the data stored in the first node, the used second computing resource including at least one of the following: used CPU resources, used memory resources, and used network bandwidth;
[0166] The device also includes: a resource migration module, which is used to migrate data related to the first application in the first storage area to a third storage area based on the second computing resource being greater than a threshold; wherein the third storage area is located at a second node of the database system, and the first node and the second node are different nodes.
[0167] In an optional implementation, the resource acquisition module is further used to acquire storage resources used by the first node;
[0168] The device also includes: a resource migration module, which is used to migrate data related to the first application in the first storage area to a third storage area based on the storage resources used by the first node being greater than a threshold; wherein the third storage area is located at a second node of the database system, and the first node and the second node are different nodes.
[0169] In an optional implementation, the acquisition module is used to acquire a third operation request after migrating the data related to the first application in the first storage area to the third storage area, wherein the third operation request is used to operate the data related to the first application;
[0170] The sending module is used to send the third operation request to the second node, so that the second node performs the operation corresponding to the third operation request on the data in the third storage area.
[0171] In an optional implementation, the first node includes a first database instance and a second database instance, the first database instance and the second database instance are different instances, the first database instance is used to manage data stored in the first storage area, and the second database instance is used to manage data stored in the second storage area.
[0172] In an optional implementation, the first node includes a first schema and a second schema, the first schema and the second schema are different schemas, the first schema corresponds to the first storage area, and the second schema corresponds to the second storage area, and the sending module is used to send the first operation request to the first node of the database system, so that the first node performs the operation corresponding to the first operation request on the data in the storage area corresponding to the first schema;
[0173] The sending module is used to send the second operation request to the first node, so that the first node performs the operation corresponding to the second operation request on the data in the storage area corresponding to the second schema.
[0174] Among them, the acquisition module 601, the sending module 602 and the allocation module 603 can be functional modules deployed on the coordination node in the distributed database system. Specifically, the acquisition module 601 can execute the description related to steps 201 and 203 in the above embodiment, and the sending module can execute the description related to steps 202 and 204 in the above embodiment, which will not be repeated here.
[0175] Reference Figure 7 The present application also provides a computer-readable storage medium. In some embodiments, the above Figure 2 The disclosed methods may be implemented as computer program instructions encoded in a machine-readable format on a computer-readable storage medium or on other non-transitory media or articles of manufacture. Figure 7 Schematically illustrates a conceptual partial view of an example computer program product arranged according to at least some embodiments presented herein, the example computer program product comprising a computer program for executing a computer process on a computing device. In one embodiment, the example computer program product 700 is provided using a signal bearing medium 701. The signal bearing medium 701 may include one or more program instructions 702, which when executed by one or more processors may provide the above-described Figure 2 Thus, for example, reference to Figure 2 In the embodiment shown in , one or more features of blocks 201-204 may be undertaken by one or more instructions associated with signal bearing medium 701. In addition, Figure 7 Program instructions 702 in also describe example instructions.
[0176] In some examples, the signal bearing medium 701 may include a computer readable medium 703, such as, but not limited to, a hard drive, a compact disk (CD), a digital video disk (DVD), a digital tape, a memory, a read-only memory (ROM) or a random access memory (RAM), etc. In some embodiments, the signal bearing medium 701 may include a computer recordable medium 704, such as, but not limited to, a memory, a read / write (R / W) CD, a R / W DVD, etc. In some embodiments, the signal bearing medium 701 may include a communication medium 705, such as, but not limited to, a digital and / or analog communication medium (e.g., a fiber optic cable, a waveguide, a wired communication link, a wireless communication link, etc.). Thus, for example, the signal bearing medium 701 may be communicated by a wireless form of the communication medium 705 (e.g., a wireless communication medium complying with the IEEE 802.11 standard or other transmission protocol). One or more program instructions 702 may be, for example, computer executable instructions or logic implementation instructions. In some examples, the computing device of the computing device can be configured to provide various operations, functions, or actions in response to the program instructions 702 communicated to the computing device by one or more of the computer-readable medium 703, the computer-recordable medium 704, and / or the communication medium 705. It should be understood that the arrangement described here is only for the purpose of example. Thus, it will be understood by those skilled in the art that other arrangements and other elements (e.g., machines, interfaces, functions, sequences, and functional groups, etc.) can be used instead, and some elements can be omitted together according to the desired results. In addition, many of the described elements are functional entities that can be implemented as discrete or distributed components, or in any appropriate combination and position to be combined with other components to implement.
[0177] Figure 8 As shown, a possible logical structure diagram of the computer device 80 involved in the above-mentioned embodiment provided in the embodiment of the present application is shown. The computer device 80 may be a device for managing application data, wherein the computer device 80 may be Figure 1A to Figure 5b The computer device 80 may include: a processor 801, a communication interface 802, a memory 803, and a bus 804. The processor 801, the communication interface 802, and the memory 803 are interconnected via the bus 804. In the embodiment of the present application, the processor 801 is used to execute Figures 2 to 5bThe communication interface 802 is used to support the computer device 80 to communicate, for example: the communication interface 802 can perform the steps related to receiving or sending in the above method embodiment. The memory 803 is used to store the program code and data of the database server.
[0178] Among them, the processor 801 can be a central processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a transistor logic device, a hardware component or any combination thereof. It can implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a digital signal processor and a microprocessor, and so on. The bus 804 can be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0179] See also Fig. 9 The embodiment of the present application also provides a distributed database system, including: a hardware layer 1007 and a virtual machine monitor (VMM) 1001 running on the hardware layer 1007, and multiple virtual machines 1002. A virtual machine can be used as a data node DN of the distributed database system. Optionally, a virtual machine can also be designated as a coordination node.
[0180] Specifically, virtual machine 1002 is a virtual computer simulated on public hardware resources by virtual machine software, on which operating system and application programs can be installed, and network resources can be accessed by the virtual machine. For application programs running in the virtual machine, the virtual machine is like working in a real computer.
[0181] Hardware layer 1007: The hardware platform on which the virtualized environment runs can be abstracted from the hardware resources of one or more physical hosts. The hardware layer may include a variety of hardware, such as a processor 1004 (e.g., CPU) and a memory 1005, and may also include a network card 1003 (e.g., an RDMA network card), high-speed / low-speed input / output (I / O, Input / Output) devices, and other devices with specific processing functions.
[0182] The virtual machine 1002 runs the executable program based on the VMM and the hardware resources provided by the hardware layer 1007 to achieve the above Figure 1A to Figure 5b For the sake of brevity, some or all functions of the first node in the relevant embodiments are not described here.
[0183] Furthermore, the distributed database system may also include a host machine (Host): as a management layer, it is used to complete the management and allocation of hardware resources; present a virtual hardware platform to the virtual machine; and implement the scheduling and isolation of the virtual machine. Among them, the Host may be a virtual machine monitor (VMM); it may also be a combination of a VMM and a privileged virtual machine. Among them, the virtual hardware platform provides various hardware resources to each virtual machine running on it, such as providing a virtual processor (such as VCPU), virtual memory, virtual disk, virtual network card, etc. Among them, the virtual disk may correspond to a file or a logical block device of the Host. The virtual machine runs on the virtual hardware platform prepared for it by the Host, and one or more virtual machines run on the Host. The VCPU of the virtual machine 1002 implements or executes the method steps described in the above-mentioned method embodiments of the present invention by executing the executable program stored in its corresponding virtual memory. For example, to implement the above Figure 1A to Figure 5b Part or all of the functions of the first node in the related embodiments.
[0184] In another embodiment of the present application, a chip system is further provided. The chip system includes a processor, which is used to support the device for injecting time series data or the device for querying time series data to implement the above Figures 2 to 5b Some embodiments describe a method for managing application data. In a possible design, the chip system may also include a memory, which is used to store necessary program instructions and data for managing application data. The chip system may be composed of a chip or may include a chip and other discrete devices.
[0185] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present application.
[0186] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0187] In the several embodiments provided in the embodiments of the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0188] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0189] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0190] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program codes.
[0191] The above are only specific implementations of the embodiments of the present application, but the protection scope of the embodiments of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or replacements within the technical scope disclosed in the embodiments of the present application, which should be included in the protection scope of the embodiments of the present application. Therefore, the protection scope of the embodiments of the present application shall be based on the protection scope of the claims.
Claims
1. A method for managing data of an application, It is characterized in that The method comprises: Obtaining a first operation request, where the first operation request is used to operate data related to a first application; Sending the first operation request to a first node of a database system so that the first node uses computing resources of the first node to perform an operation corresponding to the first operation request on data in a first storage area; Obtaining a second operation request, where the second operation request is used to operate data related to a second application; The second operation request is sent to the first node so that the first node uses the computing resources of the first node to perform the operation corresponding to the second operation request on the data in the second storage area; wherein the first storage area and the second storage area are located in the first node, and the first storage area and the second storage area are two independent storage areas in the first node.
2. The method according to claim 1, It is characterized in that The first node is a virtual machine or a physical machine.
3. The method according to claim 1 or 2, It is characterized in that The first node includes a data node DN and a data storage device, and the data storage device includes the first storage area and the second storage area; The sending the first operation request to the first node of the database system includes: The first operation request is sent to the data node DN, so that the data node DN performs the operation corresponding to the first operation request on the data in the first storage area.
4. The method according to claim 1 or 2, It is characterized in that The operations corresponding to the first operation request and the second operation request include at least one of the following: an adding operation, a deleting operation, a modifying operation, and a querying operation.
5. The method according to claim 1 or 2, It is characterized in that The first storage area includes a first sub-storage area and a second sub-storage area, and the first sub-storage area and the second sub-storage area are two independent storage areas in the first node.
6. The method according to claim 1 or 2, It is characterized in that The method further comprises: Allocate computing resources available to the first node for operating the data stored in the first storage area on the first node; the available computing resources include at least one of the following: available CPU resources, available memory resources, and available network bandwidth.
7. The method according to claim 1 or 2, It is characterized in that The method further comprises: Obtain a first computing resource used by the first node when operating the data stored in the first storage area, the first computing resource comprising at least one of the following: used CPU resources, used memory resources, and used network bandwidth; based on the first computing resource being greater than a threshold, adjust the computing resources available for use by the first node when operating the data stored in the first storage area.
8. The method according to claim 1 or 2, It is characterized in that The method further comprises: Allocate storage resources available to the first storage area on the first node.
9. The method according to claim 1 or 2, It is characterized in that The method further comprises: Acquire storage resources used by the first storage area; and adjust storage resources available for use by the first storage area based on the fact that the storage resources used by the first storage area are greater than a threshold.
10. The method according to claim 1 or 2, It is characterized in that The method further comprises: Acquire a second computing resource used by the first node when operating data stored in the first node, where the used second computing resource includes at least one of the following: a used CPU resource, a used memory resource, and a used network bandwidth; Based on the second computing resource being greater than a threshold, data related to the first application in the first storage area is migrated to a third storage area; wherein the third storage area is located at a second node of the database system, and the first node and the second node are different nodes.
11. The method according to claim 1 or 2, It is characterized in that The method further comprises: Acquire storage resources used by the first node; Based on the fact that the storage resources used by the first node are greater than a threshold, data related to the first application in the first storage area is migrated to a third storage area; wherein the third storage area is located at a second node of the database system, and the first node and the second node are different nodes.
12. The method according to claim 10, It is characterized in that The method further comprises: After migrating the data related to the first application in the first storage area to the third storage area, obtaining a third operation request, where the third operation request is used to operate the data related to the first application; The third operation request is sent to the second node, so that the second node performs the operation corresponding to the third operation request on the data in the third storage area.
13. The method according to claim 1 or 2, It is characterized in that The first node includes a first database instance and a second database instance, the first database instance and the second database instance are different instances, the first database instance is used to manage data stored in the first storage area, and the second database instance is used to manage data stored in the second storage area.
14. The method according to claim 1 or 2, It is characterized in that The first node includes a first schema and a second schema, the first schema and the second schema are different schemas, the first schema corresponds to the first storage area, and the second schema corresponds to the second storage area, and sending the first operation request to the first node of the database system so that the first node performs the operation corresponding to the first operation request on the data in the first storage area includes: Sending the first operation request to a first node of a database system so that the first node performs an operation corresponding to the first operation request on data in a storage area corresponding to the first schema; The sending the second operation request to the first node so that the first node performs the operation corresponding to the second operation request on the data in the second storage area includes: The second operation request is sent to the first node, so that the first node performs the operation corresponding to the second operation request on the data in the storage area corresponding to the second schema.
15. A device for managing data of an application program, It is characterized in that The device comprises: An acquisition module, used to acquire a first operation request, where the first operation request is used to operate data related to a first application; a sending module, configured to send the first operation request to a first node of a database system, so that the first node uses computing resources of the first node to perform an operation corresponding to the first operation request on data in a first storage area; The acquisition module is used to acquire a second operation request, where the second operation request is used to operate data related to the second application; The sending module is used to send the second operation request to the first node, so that the first node uses the computing resources of the first node to perform the operation corresponding to the second operation request on the data in the second storage area; wherein the first storage area and the second storage area are located in the first node, and the first storage area and the second storage area are two independent storage areas in the first node.
16. The device according to claim 15, It is characterized in that The first node is a virtual machine or a physical machine.
17. The device according to claim 15 or 16, It is characterized in that The first node includes a data node DN and a data storage device, and the data storage device includes the first storage area and the second storage area; The sending module is used to send the first operation request to the data node DN, so that the data node DN performs the operation corresponding to the first operation request on the data in the first storage area.
18. The device according to claim 15 or 16, It is characterized in that The operations corresponding to the first operation request and the second operation request include at least one of the following: an adding operation, a deleting operation, a modifying operation, and a querying operation.
19. The device according to claim 15 or 16, It is characterized in that The first storage area includes a first sub-storage area and a second sub-storage area, and the first sub-storage area and the second sub-storage area are two independent storage areas in the first node.
20. The device according to claim 15 or 16, It is characterized in that The device also includes: An allocation module is used to allocate computing resources available on the first node for the first node to operate the data stored in the first storage area; the available computing resources include at least one of the following: available CPU resources, available memory resources and available network bandwidth.
21. The device according to claim 15 or 16, It is characterized in that The device also includes: a resource acquisition module, configured to acquire a first computing resource used by the first node when operating the data stored in the first storage area, wherein the first computing resource includes at least one of the following: a used CPU resource, a used memory resource, and a used network bandwidth; A computing resource adjustment module is used to adjust the computing resources that can be used by the first node when operating the data stored in the first storage area based on the fact that the first computing resource is greater than a threshold.
22. The device according to claim 15 or 16, It is characterized in that The device also includes: An allocation module is used to allocate storage resources available for use by the first storage area on the first node.
23. The device according to claim 15 or 16, It is characterized in that The device also includes: A resource acquisition module, used to acquire storage resources used by the first storage area; The storage resource adjustment module is used to adjust the storage resources available for the first storage area based on the fact that the storage resources used by the first storage area are greater than a threshold.
24. The device according to claim 15 or 16, It is characterized in that The device also includes: a resource acquisition module, configured to acquire a second computing resource used by the first node when operating the data stored in the first node, wherein the used second computing resource includes at least one of the following: a used CPU resource, a used memory resource, and a used network bandwidth; The device also includes: a resource migration module, which is used to migrate data related to the first application in the first storage area to a third storage area based on the second computing resource being greater than a threshold; wherein the third storage area is located at a second node of the database system, and the first node and the second node are different nodes.
25. The device according to claim 15 or 16, It is characterized in that The device also includes: A resource acquisition module, used to acquire storage resources used by the first node; The device also includes: a resource migration module, which is used to migrate data related to the first application in the first storage area to a third storage area based on the storage resources used by the first node being greater than a threshold; wherein the third storage area is located at a second node of the database system, and the first node and the second node are different nodes.
26. The device according to claim 24, It is characterized in that The acquisition module is used to acquire a third operation request after migrating the data related to the first application in the first storage area to the third storage area, wherein the third operation request is used to operate the data related to the first application; The sending module is used to send the third operation request to the second node, so that the second node performs the operation corresponding to the third operation request on the data in the third storage area.
27. The device according to claim 15 or 16, It is characterized in that The first node includes a first database instance and a second database instance, the first database instance and the second database instance are different instances, the first database instance is used to manage data stored in the first storage area, and the second database instance is used to manage data stored in the second storage area.
28. The device according to claim 15 or 16, It is characterized in that The first node includes a first schema and a second schema, the first schema and the second schema are different schemas, the first schema corresponds to the first storage area, and the second schema corresponds to the second storage area, and the sending module is used to send the first operation request to the first node of the database system, so that the first node performs the operation corresponding to the first operation request on the data in the storage area corresponding to the first schema; The sending module is used to send the second operation request to the first node, so that the first node performs the operation corresponding to the second operation request on the data in the storage area corresponding to the second schema.
29. A device for managing data of an application program, It is characterized in that The device includes at least one processor, a memory, and instructions stored in the memory and executable by the at least one processor, wherein the at least one processor executes the instructions to implement the steps of the method described in any one of claims 1 to 14.
30. A computer readable storage medium, It is characterized in that A computer program is stored, and when the program is executed by a computer, the method according to any one of claims 1 to 14 is implemented.
