Database instance cold start method and database query method

By screening and decoupling candidate processes in the database process pool and executing non-related operations in advance, the problem of high cold start latency in traditional databases is solved, and fast response and efficient database services are achieved.

CN120447994BActive Publication Date: 2025-09-23ALIBABA CLOUD COMPUTING CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510941802.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-09
Publication Date
2025-09-23
Estimated Expiration
2045-07-09

AI Technical Summary

Technical Problem

Traditional database cold start methods have high latency and low configuration response efficiency. It is difficult to quickly rebuild database instances when there is no traffic, which affects the user experience.

Method used

By obtaining the target configuration information, candidate database processes that have executed non-related operations are screened out from the database process pool and cold started. Non-related operations that are not related to the database instance are decoupled and executed in advance to reduce cold start delay.

Benefits of technology

Significantly reduces cold start latency, improves cold start efficiency and service availability of database processes, and achieves rapid response without user awareness. This feature is suitable for PostgreSQL and other similar database services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120447994B_ABST
    Figure CN120447994B_ABST
Patent Text Reader

Abstract

Embodiments of this specification provide a cold start method for a database instance and a database query method, wherein the cold start method for the database instance comprises: obtaining target configuration information for cold starting the database instance; screening a database process to be configured from a database process pool, wherein the database process pool includes at least one candidate database process, the candidate database process being a database process that has executed a non-associated operation, where a non-associated operation is an operation in the database process that is unrelated to the database instance; and cold starting the database process to be configured based on the target configuration information. Non-associated operations in the database process that are unrelated to the database instance are decoupled and pre-executed before obtaining the target configuration information, effectively removing time-consuming non-associated operations from the critical path of cold starting the database process, significantly reducing cold start latency, and improving cold start efficiency and service availability of the database process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of this specification relate to the field of computer technology, and in particular to a cold start method for a database instance and a database query method. Background Art

[0002] With the rapid development of cloud computing and serverless architectures, database services are evolving towards on-demand startup, elastic scaling, and efficient resource utilization. In this context, managing the lifecycle of database instances has become increasingly complex. In particular, efficient cold restarts of database processes are a key challenge, especially in scenarios where resources must be released during periods of low traffic and instances must be quickly rebuilt upon request.

[0003] Currently, traditional database cold start methods typically use a full initialization process, resulting in high cold start latency and low configuration response efficiency. Therefore, an efficient cold start solution for database instances is urgently needed to achieve lightweight and fast-response database service construction. Summary of the Invention

[0004] In light of this, embodiments of this specification provide a database instance cold start method. One or more embodiments of this specification also relate to a database query method, a database instance cold start device, a database query device, a computing device, a computer-readable storage medium, and a computer program product to address technical deficiencies in the prior art.

[0005] According to a first aspect of an embodiment of this specification, a method for cold starting a database instance is provided, comprising:

[0006] Get the target configuration information for cold starting the database instance;

[0007] Filtering a database process to be configured from a database process pool, wherein the database process pool includes at least one candidate database process, where the candidate database process is a database process that has executed a non-associated operation, where the non-associated operation is an operation in the database process that is not related to the database instance;

[0008] Cold start the database process to be configured based on the target configuration information.

[0009] According to a second aspect of the embodiments of this specification, a database query method is provided, including:

[0010] Get database query request;

[0011] The target database process is called to process the database query request and obtain a database query result, wherein the target database process is obtained by cold starting the database process to be configured based on the target configuration information for cold starting the database instance, and the database process to be configured is screened from a database process pool, the database process pool including at least one candidate database process, the candidate database process being a database process that has executed a non-associated operation, and the non-associated operation being an operation in the database process that is not related to the database instance.

[0012] According to a third aspect of an embodiment of this specification, a cold start device for a database instance is provided, comprising:

[0013] A first acquisition module is configured to acquire target configuration information for cold starting a database instance;

[0014] a screening module configured to screen a database process to be configured from a database process pool, wherein the database process pool includes at least one candidate database process, wherein the candidate database process is a database process that has executed a non-associated operation, wherein the non-associated operation is an operation in the database process that is not related to the database instance;

[0015] The cold start module is configured to cold start the process of the database to be configured according to the target configuration information.

[0016] According to a fourth aspect of the embodiments of this specification, a database query device is provided, including:

[0017] A second acquisition module is configured to acquire a database query request;

[0018] The processing module is configured to call a target database process, process a database query request, and obtain a database query result, wherein the target database process is obtained by cold starting a database process to be configured based on target configuration information for cold starting a database instance, and the database process to be configured is screened from a database process pool, the database process pool including at least one candidate database process, the candidate database process being a database process that has executed a non-associated operation, where the non-associated operation is an operation in the database process that is unrelated to the database instance.

[0019] According to a fifth aspect of the embodiments of this specification, there is provided a computing device, including:

[0020] memory and processor;

[0021] The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the method provided in the first aspect or the second aspect are implemented.

[0022] According to a sixth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps of the method provided in the first or second aspect are implemented.

[0023] According to a seventh aspect of the embodiments of this specification, a computer program product is provided, comprising a computer program / instruction, which, when executed by a processor, implements the steps of the method provided in the first or second aspect above.

[0024] One embodiment of the present specification provides a cold start method for a database instance, comprising: obtaining target configuration information for cold starting the database instance; screening a database process to be configured from a database process pool, wherein the database process pool includes at least one candidate database process, the candidate database process being a database process that has executed a non-associated operation, where the non-associated operation is an operation in the database process that is unrelated to the database instance; and cold starting the database process to be configured based on the target configuration information. By decoupling non-associated operations in the database process that are unrelated to the database instance and pre-executing them before obtaining the target configuration information, time-consuming non-associated operations are effectively removed from the critical path of the database process cold start. As a result, after obtaining the target configuration information, only a small amount of personalized configuration is required for the database process to be configured to achieve a rapid response, significantly reducing cold start latency and improving cold start efficiency and service availability of the database process. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 This is a flowchart of a cold start method for a database instance provided by one embodiment of this specification;

[0026] Figure 2 This is a schematic diagram of a process operation reordering process provided by an embodiment of this specification;

[0027] Figure 3 This is a flowchart of a database query method provided by one embodiment of this specification;

[0028] Figure 4 This is an architectural diagram of a cold start system for a database instance provided in one embodiment of this specification;

[0029] Figure 5 This is a flowchart of a database query method according to an embodiment of the present disclosure;

[0030] Figure 6 This is a schematic diagram of the structure of a cold start device for a database instance provided in one embodiment of this specification;

[0031] Figure 7This is a schematic diagram of the structure of a database query device provided by one embodiment of this specification;

[0032] Figure 8 This is a structural block diagram of a computing device provided by one embodiment of this specification. DETAILED DESCRIPTION

[0033] The following description sets forth many specific details to facilitate a thorough understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the scope of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.

[0034] The terms used in one or more embodiments of this specification are for the purpose of describing specific embodiments only and are not intended to limit one or more embodiments of this specification. The singular forms "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items. The term "at least one" in one or more embodiments of this specification refers to "one or more" and "a plurality" refers to "two or more". The term "including" is an open description and should be understood as "including but not limited to", and may include other content on the basis of what has been described.

[0035] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0036] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0037] First, the terms involved in one or more embodiments of this specification are explained.

[0038] Structured Query Language (SQL): A standard programming language for managing data in relational database management systems. SQL allows users to perform various database operations, including but not limited to querying, inserting, updating, and deleting data.

[0039] MySQL: A widely used open-source relational database management system that uses SQL as the query language to manage and operate databases. MySQL supports multiple operating systems and is favored by developers for its high performance, reliability, and ease of use.

[0040] NoSQL: A database system that does not use SQL as a query language. It is typically used to process large-scale distributed data sets and has a flexible data model and high scalability.

[0041] PostgreSQL: A powerful, open-source relational database system known for its reliability and powerful functionality. It supports most SQL standards and provides many advanced features, such as complex queries, foreign keys, triggers, views, transaction integrity, and multi-version concurrency control.

[0042] Serverless: is a cloud computing execution model that allows building and running applications and services without managing servers, allowing developers to focus on writing code and project logic without having to worry about infrastructure management.

[0043] Cold start: This refers to the process of reinitializing the environment and establishing connections when an application or service (such as a PostgreSQL database instance) receives its first request after a long period of inactivity.

[0044] User-imperceptible cold start: This means that when an application or service (such as an application or database using a serverless architecture) is started for the first time or restarted after a long period of inactivity, users will not experience any noticeable delay or performance degradation.

[0045] Scaling down to 1 core is a strategy used to maintain a minimum number of running instances in a Serverless or auto-scaling computing resource environment. Specifically, applying this strategy to a database service means that even when there is no or minimal traffic, the database instance will not be completely shut down. Instead, it will maintain a very minimal resource configuration, allowing it to quickly respond to new requests without undergoing a full startup process.

[0046] Write-Ahead Logging (WAL) is a key technology for ensuring database transaction durability and data consistency. Widely used in relational database management systems (such as PostgreSQL), it records all database modification operations in a log file, ensuring data recovery in the event of a system crash or unexpected power outage.

[0047] Software as a Service (SaaS) is a cloud-based software delivery model. In this model, software applications are provided to users over the internet without requiring local installation, deployment, or maintenance. All infrastructure (servers, databases, networks, security, etc.), platforms, and applications are managed and maintained by the cloud service provider.

[0048] Platform as a Service (PaaS) is a cloud computing service model that provides a platform for developing, running, and managing applications, allowing customers to deploy applications without having to build and maintain the underlying hardware and software infrastructure. PaaS solutions typically include an operating system, database management, development tools, middleware, and other service components, providing developers with a complete development and deployment environment.

[0049] Multi-tenant SaaS: It is a deployment model in the SaaS architecture that allows multiple customers (called "tenants") to share the same application instance and infrastructure while keeping their respective data and configurations isolated.

[0050] The CPU (Central Processing Unit) is the core component of a computer system, responsible for executing and processing instructions. It serves as the brains of the computer, controlling most of the system's operations, including calculations, data processing, and communication with other hardware components.

[0051] The shared buffer is a key memory area in database management systems (such as PostgreSQL) that caches data pages read from disk and about to be written to disk. By using the shared buffer, the database system can significantly reduce the number of accesses to physical storage devices, thereby improving query performance and overall throughput.

[0052] Initializing the buffer pool (InitBufferPool) is the process of initializing the shared buffer pool at database management system startup. The shared buffer pool is the primary memory area used by the database to cache data pages read from disk and data pages to be written to disk. It is related to the shared buffer parameters.

[0053] Initialization lock mechanism (InitLocks): This refers to the process by which a database management system initializes its lock mechanism at startup. Locking is a key component of database concurrent access management, ensuring that multiple transactions can safely execute concurrently without conflict. This mechanism is related to the maximum number of connections (Max Connections) and the maximum number of locks per transaction (Max Locks Per Transaction).

[0054] Initializing Predicate Locks (InitPredicateLocks) refers to the process by which the database management system initializes the predicate locking mechanism at startup. Predicate locks are a special type of lock, typically used to support the Serializable isolation level. In this isolation level, all transactions appear to be executed sequentially, one after another. This is related to Max Connections and the maximum number of pred locks per transaction.

[0055] CheckpointerShmemInit: This is the process by which the database management system initializes the shared memory structures associated with the checkpoint mechanism at startup. A checkpoint is a crucial database maintenance operation that synchronizes dirty data pages to persistent storage to ensure database consistency and recovery. This is related to the maximum locks per transaction.

[0056] Lazy loading: is a design pattern or optimization strategy used to delay the loading of objects, resources, or data until they are actually needed. This approach can significantly improve the startup speed and performance of the application, reduce unnecessary resource consumption, and improve the user experience.

[0057] The core of pay-as-you-go serverless technology involves elasticity (automatically scaling resources up and down based on traffic) and cold starts (process termination when traffic is low). However, database process cold starts typically take 6 to 40 seconds, making them difficult for users to perceive. Some cloud vendors even resort to scaling down to a single core to avoid cold starts, but this sacrifices the true resource savings advantage.

[0058] Based on this, the embodiments of this specification propose a user-imperceptible cold start solution for serverless databases, that is, a cold start method for database instances: obtaining target configuration information for cold starting a database instance; screening out a database process to be configured from a database process pool, wherein the database process pool includes at least one candidate database process, and the candidate database process is a database process that has performed a non-associated operation, and a non-associated operation is an operation in a database process that is not related to the database instance; cold starting the database process to be configured according to the target configuration information. The solution proposed in the embodiments of this specification significantly improves the cold start speed and reduces the cold start delay. The database cold start can be completed within 20ms to 50ms, moving from "semi-serverless" to "full serverless" database. At the same time, it can also maintain a low operation and maintenance cost, and provide enterprises with more efficient and flexible database services.

[0059] It is worth noting that the cold start method of the database instance proposed in the embodiment of this specification is not only applicable to PostgreSQL, but can also be easily extended to other similar database services. Since many modern database management systems have similarities in architectural design, especially the increasing popularity of support for containerization and microservice architecture, the cold start method of the database instance proposed in the embodiment of this specification can be reused in multiple environments (such as MySQL, NoSQL, etc.) to provide consistent performance improvement effects. In addition, considering that different application scenarios may have different resource requirements and delay sensitivity, the solution proposed in the embodiment of this specification also supports adjusting the size of the process pool, optimizing the resource scheduling algorithm, etc. to adapt to various specific needs, further improving user experience and resource utilization.

[0060] In this specification, a cold start method for a database instance is provided. This specification also relates to a database query method, a cold start device for a database instance, a database query device, a computing device, a computer-readable storage medium, and a computer program product, which are described in detail one by one in the following embodiments.

[0061] See also Figure 1 , Figure 1 A flowchart of a cold start method for a database instance provided in one embodiment of this specification is shown, which specifically includes the following steps:

[0062] Step 102: Obtain target configuration information for cold starting the database instance.

[0063] It should be noted that target configuration information refers to a set of parameters or configuration items used for a cold start of a database instance. This target configuration information guides subsequent configuration processes in adjusting candidate database processes to meet the needs of current users or services. This target configuration information identifies and defines the specific operating environment and behavior of the database process cold start process. This target configuration information includes, but is not limited to, the database instance name, user authentication information, connection permission settings, and resource quota limits (such as memory and CPU). This target configuration information determines whether the database process selected from the database process pool can be reused and what customizations are required.

[0064] In actual applications, there are many ways to obtain target configuration information for cold starting a database instance, and the specific method to be selected depends on the actual situation. The embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, the target configuration information for cold starting a database instance actively sent by a client, middleware, or scheduling system can be received. In another possible implementation of this specification, the target configuration information for cold starting a database instance can be loaded from other data acquisition devices or databases. When obtaining the target configuration information for cold starting a database instance, the target configuration information can be obtained directly or lazily loaded.

[0065] Step 104: Filter out a database process to be configured from the database process pool, wherein the database process pool includes at least one candidate database process, which is a database process that has executed a non-associated operation. The non-associated operation is an operation in the database process that is not related to the database instance.

[0066] It should be noted that the database process pool refers to a set of candidate database processes that are created and maintained in advance. The candidate database processes in the database process pool have completed some common operations (such as non-associated operations unrelated to the database instance) and can be used as basic resources for quickly building new database processes. By maintaining the database process pool, the cold start time of the database process can be significantly reduced. Compared with the multi-tenant SaaS process pool, the multi-tenant SaaS service starts a process to provide services to multiple users, and the processes in its process pool are fully initialized processes that can serve users immediately. The database process pool in the embodiment of this specification is aimed at PaaS database services with better isolation, that is, each user occupies a container and a corresponding database process separately, and one user's database process does not provide services to another user.

[0067] A candidate database process is a database process in the database process pool that is available for further configuration. It has already performed some common operations (such as non-association operations) but still retains sufficient flexibility to adapt to different user requests through subsequent configuration. A candidate database process can be considered a database process in a "semi-initialized" state, not yet bound to a specific user or database instance. Activating a general candidate database process into a fully initialized (serviceable) database process typically takes only 20ms to 50ms.

[0068] A database process is one that hasn't been decoupled and initialized. Its startup process includes a complete initialization process, including but not limited to shared memory allocation, semaphore initialization, WAL checking, and configuration loading. These operations include both those related to the database instance and those unrelated to the database instance. These operations are collectively reflected in the cold start process of the process.

[0069] A database instance is a standalone database server process or a set of related processes running on an operating system that manages and provides access to data in a specific database. A database instance includes the necessary memory structures and background processes to handle client requests, manage data storage, execute queries, and maintain transaction consistency and integrity.

[0070] Non-association operations refer to container startup and process initialization operations within a database process that are unrelated to a specific database instance. Repeating these operations for each user request would incur unnecessary performance overhead. Therefore, they can be performed in advance and the results cached. Non-association operations include, but are not limited to, WAL checks, shared memory allocation, semaphore initialization, extension loading, and configuration file parsing.

[0071] A database process to be configured is a candidate database process selected from the database process pool and used for subsequent personalized configuration based on the target configuration information. A database process to be configured is in the intermediate stage of transitioning from a general state to a dedicated state.

[0072] In practical applications, there are multiple ways to select the database process to be configured from the database process pool. The specific method to be selected depends on the actual situation, and the embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, the database process to be configured can be randomly selected from the candidate database processes in the database process pool. In another possible implementation of this specification, the database process to be configured corresponding to the target configuration information can be selected from the candidate database processes in the database process pool.

[0073] In an optional embodiment of the present specification, the database process pool includes multiple sub-process pools, the candidate database processes in different sub-process pools have different corresponding memory sizes, and the target configuration information includes target memory information; the above-mentioned screening of the database process to be configured from the database process pool may include the following steps:

[0074] According to the target memory information, the target sub-process pool is selected from multiple sub-process pools;

[0075] Filter the database process to be configured from the target sub-process pool.

[0076] It's important to note that a sub-process pool is a subdivision of the database process pool. Each sub-process pool contains one or more candidate database processes with the same resource allocation characteristics. For example, all processes in a sub-process pool might have the same pre-allocated memory size or fall within the same memory range. By dividing the database process pool into multiple sub-process pools, database processes can be finely managed and scheduled based on varying resource allocation requirements.

[0077] The target memory information specifies the memory resource configuration required for the target database process to be generated. The target memory information can be a specific value, such as "1GB of available memory required." It can also be a memory range, such as "1GB to 20GB of available memory required."

[0078] The target sub-process pool is a sub-process pool in the database process pool that is selected based on the target memory information and matches the target memory information. Specifically, when specific configuration requirements (such as target memory information) are obtained, the system selects the sub-process pool that matches these configuration requirements from multiple sub-process pools as the "target sub-process pool."

[0079] In actual applications, there are multiple ways to filter out the database process to be configured from the target sub-process pool. The specific method to be selected depends on the actual situation, and the embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, any candidate database process can be randomly selected from the target sub-process pool as the database process to be configured. In another possible implementation of this specification, based on the priority of each candidate database process in the target sub-process pool, a candidate database process with a higher priority can be selected as the database process to be configured.

[0080] By applying the solution of the embodiments of this specification, the database process pool is divided into multiple sub-process pools with different resource configuration characteristics, and matching target sub-process pools are screened out according to the target memory information, and then suitable candidate database processes are selected from them for subsequent configuration. This hierarchical screening mechanism not only improves the flexibility and performance of the database process initialization process, but also effectively avoids resource waste and configuration conflicts, thereby significantly shortening the cold start time and enhancing the responsiveness and resource utilization of database services.

[0081] Step 106: Cold start the database process to be configured according to the target configuration information.

[0082] It should be noted that the database to be configured after a cold start is referred to as the target database process. The target database process is capable of responding to user database requests and can directly service user database query requests. The target database process is based on the database to be configured and customized based on the target configuration information, enabling it to directly provide services for specific users or database instances.

[0083] In actual applications, there are multiple ways to cold-start the database process to be configured based on the target configuration information. The specific method to be selected depends on the actual situation, and the embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, the user-related parameters in the database process to be configured can be dynamically replaced with the target configuration information through a preset database process template to perform a cold start. In another possible implementation of this specification, the target configuration information can be injected into the database process to be configured through inter-process communication, shared memory, or environment variables, and it can be triggered to perform a cold start.

[0084] By applying the solution of the embodiments of this specification, by decoupling non-associated operations in the database process that are not related to the database instance and executing them in advance before obtaining the target configuration information, time-consuming non-associated operations are effectively moved out of the critical path of database process startup. Therefore, after obtaining the target configuration information, only a small amount of personalized configuration of the database process to be configured is required to quickly respond, significantly reducing the cold start delay and improving the cold start efficiency and service availability of the database process.

[0085] In an optional embodiment of the present specification, before filtering out the database process to be configured from the database process pool, the following steps may also be included:

[0086] According to the association relationship between the multiple operations in the database process and the database instance, the multiple operations are divided into non-associated operations and associated operations, wherein the associated operation is an operation that has an associated relationship with an existing association relationship;

[0087] Execute non-association operations and obtain the completed non-association operations;

[0088] Build a database process pool based on the completed non-association operations and association operations.

[0089] It should be noted that operations within a database process can be understood as database process startup steps. Associated operations refer to initialization steps within a database process that are related to a specific database instance, such as user authentication, session parameter loading, and connection listener startup. These operations require customized execution based on the target configuration information in the request. For example, during the PostgreSQL startup process, steps like container startup and process initialization are time-consuming, non-associated operations unrelated to the database instance. In contrast, searching all table-related folders for temporary files for possible recovery (such as WAL files) when connecting to the database is an associated operation that is closely related to the database instance.

[0090] In actual applications, there are many ways to execute non-associated operations and obtain completed non-associated operations. The specific selection is based on the actual situation, and the embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, all non-associated operations can be directly executed to obtain completed non-associated operations. In another possible implementation of this specification, based on the running time of the database process, the associated operations and non-associated operations in the database process may be arranged in an interlaced manner. Therefore, the associated operations and non-associated operations in the database process can be rearranged. During the rearrangement process, all non-associated operations are placed before the associated operations for execution, thereby obtaining completed non-associated operations.

[0091] Furthermore, the process of "dividing multiple operations according to the association relationship between multiple operations in the database process and the database instance to obtain non-associated operations and associated operations, wherein the associated operation is an operation that has an association relationship with an existing association relationship; executing the non-associated operations to obtain completed non-associated operations; and building a database process pool based on the completed non-associated operations and associated operations" can also be performed before obtaining the target configuration information.

[0092] By applying the solution of the embodiments of this specification, by obtaining the database process and dividing multiple operations into non-associated operations and associated operations based on the association relationship between the operations included and the database instance, the system can pre-execute non-associated operations that are not related to the database instance before the user request arrives, and build a database process pool based on the execution results, effectively moving time-consuming operations out of the critical path of database process startup, significantly reducing cold start delays, and improving the response efficiency and service availability of the database instance.

[0093] See also Figure 2 , Figure 2A schematic diagram of a process operation rearrangement process provided by an embodiment of the present specification is shown, specifically comprising: first, parsing the cold start process, and reordering multiple operations in the database process (such as Figure 2 ) are divided into non-related operations unrelated to the database instance and related operations related to the database instance. Then, based on the timing information of each operation during the database process startup, the dependencies of each operation during the database process startup are determined. While respecting these dependencies, the order of each operation is modified to reschedule the process cold start operations. In other words, non-related operations that are time-consuming and unrelated to the database instance are executed earlier.

[0094] It should be noted that the process after the non-associated operation is completed (such as Figure 2 The optimized process (shown in Figure 1) can be called a candidate database process. After obtaining the target configuration information to determine which database instance to start, the candidate database process completes startup initialization related to that database instance (typically taking only 20 to 50 milliseconds).

[0095] By applying the solutions of the embodiments of this specification, most of the preparation work can be completed without specific target configuration information, thereby shortening the actual response time. For example, time-consuming non-related operations such as container startup and basic process initialization can be completed in advance when the system is idle.

[0096] In an optional embodiment of the present specification, the multiple operations include at least one of a container startup operation and a process initialization operation; and the above-mentioned dividing the multiple operations according to the association relationship between the multiple operations in the database process and the database instance to obtain non-associated operations and associated operations may include the following steps:

[0097] Classify the container startup operations according to the association relationship between the container startup operations and the database instances to obtain non-associated operations and associated operations; and / or,

[0098] According to the association relationship between the process initialization operation and the database instance, the process initialization operation is divided into non-associated operations and associated operations.

[0099] It should be noted that container startup refers to the series of operations performed to start a database container instance in a containerized environment. These operations typically include but are not limited to pulling images, mounting volumes, setting environment variables, configuring the network, and executing entry scripts.

[0100] Process initialization refers to the operations performed at the operating system level when starting a database process to prepare the process's operating environment. These operations include, but are not limited to, initializing shared memory and semaphores, loading configuration files, starting background processes, initializing transaction logs, and implementing locking mechanisms.

[0101] By applying the solutions in the embodiments of this specification, container startup and process initialization operations are divided according to their association with database instances. This effectively identifies which operations can be executed before a database instance is determined (i.e., non-associated operations), thereby preheating database processes and reusing resources. This division not only improves the responsiveness of database services in a serverless architecture, but also significantly reduces the initialization overhead of each database request, enhancing system elasticity and resource utilization.

[0102] In an optional embodiment of the present specification, there are multiple non-associated operations; and performing the non-associated operations to obtain completed non-associated operations may include the following steps:

[0103] Parse database processes to determine dependencies between multiple non-related operations;

[0104] Execute multiple non-related operations according to the dependency relationship and obtain the completed non-related operations.

[0105] It's important to note that a dependency relationship refers to the execution order constraints that exist between multiple non-correlated operations. For example, if the execution order of operations in a database process is "non-correlated operation 1, correlated operation 1, non-correlated operation 2, correlated operation 2," then the dependency relationship among the multiple non-correlated operations is "non-correlated operation 2 is performed after non-correlated operation 1." After the process is reordered, the execution order of the operations will be "non-correlated operation 1, non-correlated operation 2, correlated operation 1, correlated operation 2."

[0106] In actual applications, there are many ways to parse a database process and determine the dependencies of multiple non-associated operations. The specific method to be selected depends on the actual situation. The embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, the source code or initialization module of the database engine can be statically scanned to identify the call chain of each initialization function and its parameter dependencies, thereby determining the dependencies between non-associated operations. In another possible implementation of this specification, the execution order of all non-associated operations can be recorded during the normal startup of the database process, and their execution paths and dependencies can be extracted through log analysis tools.

[0107] By applying the solution of the embodiments of this specification, the dependency relationships between multiple non-associated operations are identified through analysis of the database process, and these operations are executed in the correct order, thereby achieving orderly execution of operations based on dependency relationships. This not only improves the stability and efficiency of the execution of non-associated operations, but also lays the foundation for building a unified and reusable database process pool, significantly reducing the initialization time each time a database instance is created, and improving service response speed and resource utilization.

[0108] In actual applications, the main time-consuming item of database process startup is in the function that starts the process (PostMasterMain function). The main time-consuming operations of process startup include two parts:

[0109] The first part is to remove temporary files (RemovePgTempFiles), see Table 1 below:

[0110] Table 1

[0111]

[0112] The second part is to allocate shared memory (reset shared), see Table 2 below:

[0113] Table 2

[0114]

[0115] First, we analyze RemovePgTempFiles. The time-consuming issue with RemovePgTempFiles can be resolved through an "intelligent monitoring mechanism," which we will explain next. By monitoring the outage status of each database instance, we can make more informed decisions when allocating server nodes. For example, based on the outage status information, we can intelligently determine whether time-consuming recovery operations (such as WAL file checks) are necessary, thereby skipping unnecessary redundant operations, further reducing cold start time and saving resources. For example, if we know that a user's previous serverless node has failed, we can perform the necessary recovery operations in a new process. In the case of a normal exit, this time-consuming recovery step can be skipped.

[0116] In an optional embodiment of the present specification, the cold start of the database process to be configured according to the target configuration information may include the following steps:

[0117] Monitor the status of the database process to be configured and obtain the shutdown status information of the database process to be configured;

[0118] Perform a cold start on the database process to be configured based on the outage status information and target configuration information.

[0119] It should be noted that status monitoring refers to the process of performing real-time or periodic monitoring on the running status of the database process to be configured during or after shutdown to obtain its current status information.

[0120] Outage status information refers to key status data obtained through status monitoring regarding the database process being configured during or after an outage. This information includes, but is not limited to, whether the process has successfully terminated, whether there are unreleased memory or connection resources, the reason for the outage (e.g., timeout, manual termination, abnormal exit), the duration of the outage, and whether the process can be returned to the database process pool for reuse. This information is selected based on actual circumstances and is not limited in this specification.

[0121] In actual applications, there are many ways to monitor the status of the database process to be configured and obtain the shutdown status information of the database process to be configured. The specific method to be selected depends on the actual situation. The embodiments of this specification do not impose any restrictions on this. In one possible implementation method of this specification, the status information of the database process to be configured can be obtained in real time by using the system call provided by the operating system. In another possible implementation method of this specification, a lightweight heartbeat service can be run in the database process to be configured to regularly send a survival signal to the monitoring unit. If the heartbeat signal is not received within the specified time, it is determined to be out of service, and the shutdown status information of the database process to be configured is recorded.

[0122] By applying the solution of the embodiments of this specification, by monitoring the status of the configured database process and obtaining its shutdown status information, it is possible to accurately grasp the life cycle changes of the database process, intelligently determine whether time-consuming recovery operations need to be performed, thereby skipping unnecessary redundant operations, further reducing cold start time and saving resources.

[0123] In traditional solutions, the lifecycle of a database process begins when it is started, and ends when the process exits. The database can only obtain its state at the time of the last process exit by scanning the local disk. Based on this, in an optional embodiment of this specification, the lifecycle of the serverless database is managed by the system, and the system can clearly determine which steps of the cold start process can be skipped based on the outage status information (for example, if it exits normally, there is no need to repair data if it exits abnormally). In other words, the above-mentioned cold start of the configured database process based on the outage status information and the target configuration information can include the following steps:

[0124] Determine the redundant operations corresponding to the database process to be configured based on the outage status information;

[0125] During the cold start of the database process to be configured based on the target configuration information, redundant operations are skipped.

[0126] It should be noted that redundant operations refer to those operations that have been executed during the database process initialization and do not need to be repeated in the current context.

[0127] In actual applications, there are multiple ways to determine the redundant operations corresponding to the database process to be configured based on the outage status information. The specific selection is based on the actual situation, and the embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, the resource retention status of the database process to be configured at the time of outage (such as whether temporary files exist, etc.) can be extracted from the outage status information, and the redundant operations corresponding to the database process to be configured can be determined based on the resource retention status. In another possible implementation of this specification, the historical operation log of the database process to be configured can be compared with the current outage status information to identify operations that have been successfully executed and mark them as redundant operations.

[0128] By applying the solution of the embodiments of this specification, by monitoring the status of the configured database process and obtaining its shutdown status information, when a restart event occurs, redundant operations in the associated operations are identified based on the information, and these unnecessary initialization steps are skipped during the startup and instance configuration process, avoiding the repeated execution of redundant operations, significantly shortening the recovery time of the database process, and improving service availability and resource utilization.

[0129] Next, we further analyzed the reset shared function. For example, we allocated a 100GB shared buffer and increased other user parameters by 10-100 times their default values. We found that the main time-consuming functions within the reset shared function were: InitBufferPool (300ms), InitLocks (26ms), InitPredicateLocks (18ms), and CheckpointerShmemInit (28ms). We then conducted a more detailed analysis of these functions.

[0130] InitBufferPool: The main time-consuming part comes from the internal initialization of buffer headers. The shared buffer is divided into multiple buffer pages, each of which is 8KB. Initializing the header for a single page takes a short time, but too many headers need to be initialized (for example, 10 million headers need to be initialized for 100GB), resulting in low efficiency. InitLocks: The main time-consuming part is ShmemInitHash (used to create a hash table in shared memory). This function allocates a large block of contiguous memory in shared memory to initialize the hash table. InitPredicateLocks: Similar to InitLocks, the main time-consuming part is also ShmemInitHash. CheckpointerShmemInit: The internal "MemSet(CheckpointerShmem,0,size)" is very time-consuming and can be optimized. Among them, MemSet(CheckpointerShmem,0,size) is used to set the bytes allocated to the shared memory area Checkpoint to zero.

[0131] Optimization strategy: Rearrange reset shared. Using InitBufferPool as the dividing point, divide reset shared into two execution phases. The example is as follows:

[0132] void reset shared() {

[0133] / / ……

[0134] size = ...; / / Estimate the shared memory required by each module (related to many user parameters)

[0135] / / ……

[0136] PGSharedMemoryCreate(size, port,&shim); / / Create a shared memory segment (related to the user data directory DataDir)

[0137] PGReserveSemaphores(); / / Create semaphores (related to Max Connections)

[0138] / / ……

[0139] InitBufferPool();

[0140] / / dividing point========================================

[0141] InitLocks();

[0142] / / ……

[0143] }

[0144] In practical applications, the reordering of reset shared internal functions can be achieved by eliminating user parameter dependencies. The following describes several solutions for eliminating user parameter dependencies.

[0145] In the first optional embodiment of the present specification, during the pre-allocation of shared memory, it is necessary to estimate the size of the memory to be allocated based on the parameters in some configuration files (config files). Take extreme values ​​for the parameters related to the pre-allocation of shared memory in the config file. For example, the parameters related to the maximum number of locks (max lock) are increased by 100-1000 times, and other parameters are increased by 10 times compared to the default values. The pre-allocated memory sizes corresponding to shared buffers of different sizes are probably no more than 10% of the shared buffer. The size of shared memory is mainly affected by the shared buffer. Therefore, allocating 5% to 10% more than the shared buffer can eliminate the dependence on user-related parameters. That is, after the database process pool is constructed based on the non-associated operations and associated operations that have been executed, the following steps can also be included:

[0146] Get the shared memory parameters of the database process;

[0147] Allocate shared memory to candidate database processes in the database process pool based on the shared memory parameters.

[0148] It's important to note that shared memory parameters refer to a set of key parameters used to configure the shared memory area within a database process. These parameters include, but are not limited to, the shared buffer size, the maximum number of connections for a process, and the lock table size. Shared memory parameters determine the total amount and organization of shared memory resources required to run a database process.

[0149] In actual applications, there are multiple ways to allocate shared memory to candidate database processes in the database process pool based on shared memory parameters. The specific method to be selected depends on the actual situation, and the embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, a fixed amount of shared memory can be allocated to all candidate database processes at one time based on the shared memory parameters. In another possible implementation of this specification, the shared memory can be adjusted and allocated to each candidate database process in real time based on the actual runtime needs. For example, when a process needs more shared memory, additional resources are dynamically allocated from the global shared memory pool.

[0150] By applying the solution of the embodiments of this specification, by obtaining the shared memory parameters of the database process and allocating shared memory resources to the candidate database processes in the database process pool accordingly, unified configuration and efficient reuse of database process memory usage are achieved. This not only improves the preloading efficiency of the candidate database processes, but also ensures the consistency of resource configuration between different database processes, and reduces the initialization overhead when processing each user request.

[0151] In a second optional embodiment of the present specification, identification information may be bound when allocating shared memory, and the identification information may be written into the shared memory header. That is, after allocating shared memory to the candidate database processes in the database process pool according to the shared memory parameters, the following steps may also be included:

[0152] Obtain identification information of a database process, where the identification information is not related to a database instance;

[0153] The identification information is added to the shared memory, where the identification information is used to identify the database process corresponding to the shared memory.

[0154] It should be noted that identification information refers to metadata used to uniquely identify a database process and uniquely label allocated shared memory. This identification information includes, but is not limited to, metadata about the current data directory (DataDir) (such as the device number st_dev and inode number st_ino), startup timestamp, configuration version number, and port numbers allocated to different processes. The specific information is selected based on actual circumstances and is not limited in this specification.

[0155] By applying the solution of the embodiments of this specification, the identification information of the database process is added to the shared memory, so that other database processes can determine whether the shared memory belongs to the current instance, thereby avoiding cross-instance shared memory conflicts.

[0156] In a third optional embodiment of the present specification, for the PGReserveSemaphores function, the semaphore depends on the client connection parameters and is not related to the shared memory allocation. Therefore, it can be moved back to the user-related stage for execution. That is, after obtaining the target configuration information for the cold start of the database instance, the following steps may also be included:

[0157] Get the client connection parameters of the database process;

[0158] Determine the semaphore for the database process based on the client connection parameters.

[0159] It should be noted that client connection parameters refer to the configuration information set used to establish a database connection, such as the MaxConnections number.

[0160] Quoting the above code example, the example after PGReserveSemaphores is moved to the user-related stage for execution is as follows:

[0161] void reset shared() {

[0162] / / ……

[0163] / / ……

[0164] InitBufferPool();

[0165] / / dividing point========================================

[0166] PGReserveSemaphores(); / / Create semaphores (related to Max Connections)

[0167] InitLocks();

[0168] / / ……

[0169] }

[0170] By applying the solution of the embodiments of this specification, the process of determining the semaphore of the database process based on the client connection parameters is moved to the user-related stage, which can effectively decouple the resource pre-allocation and process initialization processes, thereby improving the construction efficiency and resource utilization of the database process pool, so that the candidate database process does not need to occupy semaphore resources before receiving the actual user connection request, reducing the system overhead in the cold start stage, and avoiding the waste or limitation of operating system resources caused by pre-allocating too many semaphores.

[0171] See also Figure 3 , Figure 3 A flowchart of a database query method provided by an embodiment of this specification is shown, which specifically includes the following steps:

[0172] Step 302: Obtain a database query request.

[0173] Step 304: Call the target database process, process the database query request, and obtain a database query result. The target database process is obtained by cold-starting the database process to be configured based on the target configuration information for cold-starting the database instance. The database process to be configured is screened from a database process pool. The database process pool includes at least one candidate database process. The candidate database process is a database process that has executed a non-associated operation. The non-associated operation is an operation in the database process that is unrelated to the database instance.

[0174] It should be noted that a database query request is a request initiated by a user, client, or application to access or operate database content, usually containing SQL query statements or other database operation instructions. The configuration method of the target database process can be referred to Figure 1 The method for configuring the database shown in the figure will not be described in detail in the embodiments of this specification.

[0175] Database query results refer to the output data or status information generated by the target database process after parsing and executing the database query request. Database query results can include a set of data records that meet the query conditions, a success or failure status code, the number of affected rows, and error messages.

[0176] In actual applications, there are multiple ways to call the target database process, process the database query request, and obtain the database query results. The specific method to be selected depends on the actual situation, and the embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, the database query request can be forwarded to the corresponding target database process through middleware (such as a connection pool proxy or a reverse proxy), which executes the query and feeds back the database query results. In another possible implementation of this specification, the database service endpoint of the target database process can be called through a network interface or an internal application programming interface to execute the database query request and obtain the database query results.

[0177] By applying the solution of the embodiments of this specification, upon receiving a database query request, the target database process, which has been personalized cold-started based on the target configuration information, is invoked to perform query processing, effectively improving the response efficiency and resource utilization of the database service. The target database process is completed by a customized cold-start of the database process to be configured, which is selected from the database process pool. The candidate database process has already been pre-initialized on non-associated operations, avoiding the repetition of these time-consuming operations at each startup. This significantly reduces cold-start latency, allowing the database instance to be built and respond to user requests in a very short time.

[0178] See also Figure 4 , Figure 4 An architectural diagram of a cold start system for a database instance provided by one embodiment of this specification is shown. The cold start system for a database instance may include a client 402 and a server 404;

[0179] Server 404 is configured to obtain target configuration information for cold starting the database instance; select a database process to be configured from a database process pool, wherein the database process pool includes at least one candidate database process, where the candidate database process is a database process that has executed a non-associated operation, where a non-associated operation is an operation in the database process that is not related to the database instance; and cold start the database process to be configured based on the target configuration information.

[0180] In an optional embodiment of this specification, the client 402 is further configured to send a database query request to the server 404;

[0181] The server 404 is also used to call the target database process, process the database query request, obtain the database query result, and feedback the database query result to the client 402;

[0182] The client 402 is also used to receive the database query results fed back by the server 404.

[0183] By applying the solution of the embodiments of this specification, by decoupling non-associated operations in the database process that are not related to the database instance and executing them in advance before obtaining the target configuration information, time-consuming non-associated operations are effectively moved out of the critical path of database process startup. Therefore, after obtaining the target configuration information, only a small amount of personalized configuration of the database process to be configured is required to quickly respond, significantly reducing the cold start delay and improving the cold start efficiency and service availability of the database process.

[0184] In actual applications, the cold start system of a database instance may include multiple clients 402 and a server 404, wherein the client 402 may include an end-side device and the server 404 may include a cloud-side device. A communication connection may be established between the multiple clients 402 through the server 404. In the cold start scenario of the database instance, the server 404 is used to provide a cold start service of the database instance between the multiple clients 402. The multiple clients 402 may act as a sender or a receiver, respectively, and communicate through the server 404. The connection between the client 402 and the server 404 is established through a network. The network provides a medium for the communication link between the client 402 and the server 404. The network may include various connection types, such as wired, wireless communication links or optical fiber cables, etc. The data transmitted by the client 402 may need to be encoded, transcoded, compressed, and other processes before being released to the server 404.

[0185] Client 402 can be a browser, an application (APP), a web application such as a Hypertext Markup Language 5 (H5) application, a lightweight application (also known as a mini-program, a type of lightweight application), or a cloud application. Client 402 can be developed based on a software development kit (SDK) for the corresponding service provided by server 404, such as a real-time communication (RTC) SDK. Client 402 can be deployed in an electronic device and rely on the device or certain applications within the device to operate. For example, the electronic device can have a display and support information browsing, such as a personal mobile terminal such as a mobile phone, tablet computer, or personal computer. Various other types of applications can also be configured in the electronic device, such as human-computer interaction applications, model training applications, text processing applications, web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0186] Server 404 may include servers that provide various services, such as servers providing communication services to multiple clients, servers supporting backend training for models used on clients, and servers processing data sent by clients. It should be noted that server 404 can be implemented as a distributed server cluster consisting of multiple servers or a single server. The server can also be a server in a distributed system or a server integrated with blockchain. The server can also be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), big data and artificial intelligence platforms, or intelligent cloud computing servers or intelligent cloud hosts equipped with artificial intelligence technology.

[0187] It is worth noting that the cold start method and database query method for the database instance provided in the embodiments of this specification are generally executed by the server. However, in other embodiments of this specification, the client may also have similar functions to the server, thereby executing the cold start method and database query method for the database instance provided in the embodiments of this specification. In other embodiments, the cold start method and database query method for the database instance provided in the embodiments of this specification may also be executed jointly by the client and the server.

[0188] See also Figure 5 , Figure 5A flowchart of a database query method according to an embodiment of the present invention is shown, which specifically includes the following steps:

[0189] Step 502: Based on the association relationship between the multiple operations in the database process and the database instance, the multiple operations are divided to obtain non-association operations and association operations.

[0190] Step 504: Execute the non-associated operations according to the dependency relationship between the non-associated operations, and obtain the non-associated operations that have been completed.

[0191] Step 506: Build a database process pool based on the completed non-association operations and association operations.

[0192] Step 508: Allocate shared memory to the candidate database processes in the database process pool according to the shared memory parameters of the database processes.

[0193] Step 510: Add identification information of the database process to the shared memory, wherein the identification information is irrelevant to the database instance and is used to identify the database process corresponding to the shared memory.

[0194] Step 512: Obtain target configuration information for cold starting the database instance.

[0195] Step 514: According to the target memory information in the target configuration information, a target sub-process pool is screened out from the multiple sub-process pools included in the database process pool.

[0196] Step 516: Filter out the database process to be configured from the target sub-process pool.

[0197] Step 518: Monitor the status of the database process to be configured and obtain the shutdown status information of the database process to be configured; determine the redundant operation corresponding to the database process to be configured based on the shutdown status information; and skip the redundant operation during the cold start of the database process to be configured based on the target configuration information.

[0198] Corresponding to the above-mentioned cold start method embodiment of the database instance, this specification also provides an embodiment of a cold start device for the database instance. Figure 6 FIG. 1 shows a schematic diagram of a cold start device for a database instance provided in one embodiment of this specification. Figure 6 As shown, the device includes:

[0199] A first acquisition module 602 is configured to acquire target configuration information for cold starting a database instance;

[0200] The screening module 604 is configured to screen a database process to be configured from a database process pool, wherein the database process pool includes at least one candidate database process, where the candidate database process is a database process that has executed a non-associated operation, where a non-associated operation is an operation in the database process that is not related to the database instance;

[0201] The cold start module 606 is configured to cold start the database process to be configured according to the target configuration information.

[0202] Optionally, the database process pool includes multiple sub-process pools, the candidate database processes in different sub-process pools have different corresponding memory sizes, and the target configuration information includes target memory information; the screening module 604 is further configured to screen out the target sub-process pool from the multiple sub-process pools based on the target memory information; and screen out the database process to be configured from the target sub-process pool.

[0203] Optionally, the cold start module 606 is further configured to monitor the status of the database process to be configured, obtain shutdown status information of the database process to be configured, and cold start the database process to be configured according to the shutdown status information and the target configuration information.

[0204] Optionally, the cold start module 606 is further configured to determine redundant operations corresponding to the database process to be configured according to the outage status information; and skip redundant operations during the cold start of the database process to be configured according to the target configuration information.

[0205] Optionally, the device also includes: a construction module, configured to obtain a database process; divide multiple operations according to the association relationship between multiple operations and database instances in the database process to obtain non-associated operations and associated operations, wherein the associated operation is an operation that has an association relationship with an existing association relationship; execute the non-associated operation to obtain the non-associated operation that has been executed; and construct a database process pool based on the non-associated operations and associated operations that have been executed.

[0206] Optionally, the multiple operations include at least one of a container startup operation and a process initialization operation; the construction module is further configured to divide the container startup operation according to the association relationship between the container startup operation and the database instance to obtain non-associated operations and associated operations; and / or, divide the process initialization operation according to the association relationship between the process initialization operation and the database instance to obtain non-associated operations and associated operations.

[0207] Optionally, there are multiple non-associated operations; the construction module is further configured to parse the database process and determine the dependency relationship between the multiple non-associated operations; execute the multiple non-associated operations according to the dependency relationship to obtain the non-associated operations that have been executed.

[0208] Optionally, the device further includes: an allocation module configured to obtain shared memory parameters of the database process; and allocate shared memory to candidate database processes in the database process pool according to the shared memory parameters.

[0209] Optionally, the device further includes: an adding module configured to obtain identification information of a database process, wherein the identification information is independent of a database instance; and add the identification information to a shared memory, wherein the identification information is used to identify the database process corresponding to the shared memory.

[0210] Optionally, the device further includes: a determination module configured to obtain client connection parameters of the database process; and determine the semaphore of the database process according to the client connection parameters.

[0211] By applying the solution of the embodiments of this specification, by decoupling non-associated operations in the database process that are not related to the database instance and executing them in advance before obtaining the target configuration information, time-consuming non-associated operations are effectively moved out of the critical path of database process startup. Therefore, after obtaining the target configuration information, only a small amount of personalized configuration of the database process to be configured is required to quickly respond, significantly reducing the cold start delay and improving the cold start efficiency and service availability of the database process.

[0212] The above is a schematic diagram of a cold start device for a database instance according to this embodiment. It should be noted that the technical solution of the cold start device for this database instance and the technical solution of the cold start method for the database instance described above share the same concept. For details not described in detail in the technical solution of the cold start device for the database instance, please refer to the description of the technical solution of the cold start method for the database instance described above.

[0213] Corresponding to the above-mentioned database query method embodiment, this specification also provides a database query device embodiment, Figure 7 FIG1 shows a schematic diagram of the structure of a database query device provided by an embodiment of this specification. Figure 7 As shown, the device includes:

[0214] The second acquisition module 702 is configured to acquire a database query request;

[0215] Processing module 704 is configured to call a target database process, process the database query request, and obtain a database query result, wherein the target database process is obtained by cold starting the database process to be configured based on the target configuration information for cold starting the database instance, and the database process to be configured is screened from a database process pool, the database process pool including at least one candidate database process, where the candidate database process is a database process that has executed a non-associated operation, where the non-associated operation is an operation in the database process that is not related to the database instance.

[0216] By applying the solution of the embodiments of this specification, upon receiving a database query request, the target database process, which has been personalized cold-started based on the target configuration information, is invoked to perform query processing, effectively improving the response efficiency and resource utilization of the database service. The target database process is completed by a customized cold-start of the database process to be configured, which is selected from the database process pool. The candidate database process has already been pre-initialized on non-associated operations, avoiding the repetition of these time-consuming operations at each startup. This significantly reduces cold-start latency, allowing the database instance to be built and respond to user requests in a very short time.

[0217] The above is a schematic diagram of a database query device according to this embodiment. It should be noted that the technical solution of the database query device and the technical solution of the above-mentioned database query method are based on the same concept. For details not described in detail in the technical solution of the database query device, please refer to the description of the technical solution of the above-mentioned database query method.

[0218] Figure 8 8. The structure of a computing device provided in one embodiment of the present specification is shown in FIG. Components of the computing device 800 include, but are not limited to, a memory 810 and a processor 820. The processor 820 is connected to the memory 810 via a bus 830, and a database 850 is used to store data.

[0219] The computing device 800 also includes an access device 840 that enables the computing device 800 to communicate via one or more networks 860. Examples of such networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 840 may include one or more of any type of network interface (e.g., a network interface card (NIC)) whether wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a World Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.

[0220] In one embodiment of the present specification, the above components of the computing device 800 and Figure 8 Other components not shown in the figure may also be connected to each other, for example, via a bus. Figure 8 The computing device structure block diagram shown is for illustrative purposes only and is not intended to limit the scope of this specification. Those skilled in the art may add or replace other components as needed.

[0221] Computing device 800 can be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, personal digital assistant, laptop computer, notebook computer, netbook computer, etc.), a mobile phone (e.g., a smartphone), a wearable computing device (e.g., a smartwatch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or personal computer (PC). Computing device 800 can also be a mobile or stationary server.

[0222] The processor 820 is configured to execute a computer program / instruction, which, when executed by the processor, implements the steps of the cold start method of the above-mentioned database instance or the database query method.

[0223] The above is a schematic diagram of a computing device according to this embodiment. It should be noted that the technical solution of this computing device is based on the same concept as the technical solutions of the cold start method and database query method described above. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solutions of the cold start method and database query method described above.

[0224] An embodiment of the present specification further provides a computer-readable storage medium storing a computer program / instruction. When the computer program / instruction is executed by a processor, the steps of the cold start method of the above-mentioned database instance or the database query method are implemented.

[0225] The above is a schematic diagram of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium is based on the same concept as the technical solutions of the cold start method and database query method described above. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solutions of the cold start method or database query method described above.

[0226] An embodiment of the present specification further provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the cold start method of the above-mentioned database instance or the database query method.

[0227] The above is a schematic diagram of a computer program product according to this embodiment. It should be noted that the technical solution of this computer program product shares the same concept as the technical solutions of the cold start method and database query method described above. For details not described in detail in the technical solution of the computer program product, please refer to the description of the technical solutions of the cold start method or database query method described above.

[0228] The foregoing description of this specification describes specific embodiments. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0229] Computer instructions include computer program code, which may be in source code, object code, executable files, or some intermediate form. Computer-readable media may include any entity or device capable of carrying computer program code, recording media, USB flash drives, removable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signals, telecommunications signals, and software distribution media. It should be noted that the content of computer-readable media may be appropriately expanded or reduced based on the requirements of patent practice. For example, in some jurisdictions, according to patent practice, computer-readable media does not include electric carrier signals or telecommunications signals.

[0230] It should be noted that for the aforementioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of this specification.

[0231] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0232] The preferred embodiments disclosed above are intended only to help illustrate this specification. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific embodiments described. Obviously, many modifications and variations can be made based on the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that those skilled in the art can better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.

Claims

1. A cold start method for a database instance, comprising: Get the target configuration information for cold starting the database instance; Filtering a database process to be configured from a database process pool, wherein the database process pool includes at least one candidate database process, the candidate database process being a database process that has executed a non-associated operation, wherein the non-associated operation is an operation in the database process that is unrelated to the database instance, and the non-associated operation includes at least one of write-ahead log checking, shared memory allocation, semaphore initialization, extension loading, and configuration file parsing; Cold start the database process to be configured according to the target configuration information.

2. The method according to claim 1, wherein the database process pool includes multiple sub-process pools, the candidate database processes in different sub-process pools have different corresponding memory sizes, and the target configuration information includes target memory information; The step of selecting the database process to be configured from the database process pool includes: Filtering a target sub-process pool from the multiple sub-process pools according to the target memory information; The database process to be configured is screened out from the target sub-process pool.

3. The method according to claim 1, wherein cold starting the database process to be configured according to the target configuration information comprises: Performing status monitoring on the process of the database to be configured to obtain shutdown status information of the process of the database to be configured; cold starting the database process to be configured according to the outage status information and the target configuration information; The cold starting of the database process to be configured according to the outage status information and the target configuration information includes: Determining, based on the outage status information, a redundant operation corresponding to the database process to be configured; In the process of cold starting the database process to be configured according to the target configuration information, the redundant operation is skipped.

4. The method according to any one of claims 1 to 3, before filtering out the database process to be configured from the database process pool, further comprising: Dividing the multiple operations in the database process into the non-associated operations and the associated operations according to the association relationship between the multiple operations and the database instance, wherein the associated operations are operations that have an association relationship with the database instance; Executing the non-associated operation to obtain the completed non-associated operation; The database process pool is constructed according to the non-associated operations and the associated operations that have been executed.

5. The method according to claim 4, wherein the plurality of operations include at least one of a container startup operation and a process initialization operation; The dividing the multiple operations according to the association relationship between the multiple operations in the database process and the database instance to obtain the non-associated operations and the associated operations includes: According to the association relationship between the container startup operation and the database instance, the container startup operation is divided to obtain the non-associated operation and the associated operation; and / or, According to the association relationship between the process initialization operation and the database instance, the process initialization operation is divided to obtain the non-associated operation and the associated operation.

6. The method according to claim 4, wherein the number of the non-association operations is multiple; The performing of the non-associated operation to obtain the completed non-associated operation includes: Parsing the database process to determine dependencies between multiple non-related operations; The plurality of non-associated operations are executed according to the dependency relationship to obtain the non-associated operations that have been completed.

7. The method according to claim 4, after constructing the database process pool based on the completed non-associated operations and the associated operations, further comprising: Obtaining shared memory parameters of the database process; Allocate shared memory to the candidate database process in the database process pool according to the shared memory parameter.

8. The method according to claim 7, after allocating shared memory to the candidate database processes in the database process pool according to the shared memory parameters, further comprising: Obtaining identification information of the database process, wherein the identification information is unrelated to the database instance; The identification information is added to the shared memory, wherein the identification information is used to identify the database process corresponding to the shared memory.

9. The method according to any one of claims 1 to 3, further comprising: after obtaining target configuration information for cold starting a database instance; Obtaining client connection parameters of the database process; The semaphore of the database process is determined according to the client connection parameters.

10. A database query method, comprising: Get database query request; A target database process is called to process the database query request and obtain a database query result, wherein the target database process is obtained by cold starting a database process to be configured based on target configuration information for cold starting a database instance, and the database process to be configured is screened from a database process pool, wherein the database process pool includes at least one candidate database process, and the candidate database process is a database process that has performed a non-associated operation, wherein the non-associated operation is an operation in the database process that is unrelated to the database instance, and the non-associated operation includes at least one of write-ahead log checking, shared memory allocation, semaphore initialization, extension loading, and configuration file parsing.

11. A computing device comprising: memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer program / instructions are executed by the processor, the steps of the method according to any one of claims 1 to 10 are implemented.

12. A computer-readable storage medium storing a computer program / instruction, wherein the computer program / instruction, when executed by a processor, implements the steps of the method according to any one of claims 1 to 10.

13. A computer program product comprising a computer program / instruction, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Memory database and data processing method thereof

    CN101901250A

  • Starting method and device of search server, and search server

    CN110895475A