+

CN113127441B - A method for dynamically selecting database components and a self-assembling database management system - Google Patents

A method for dynamically selecting database components and a self-assembling database management system Download PDF

Info

Publication number
CN113127441B
CN113127441B CN201911423460.4A CN201911423460A CN113127441B CN 113127441 B CN113127441 B CN 113127441B CN 201911423460 A CN201911423460 A CN 201911423460A CN 113127441 B CN113127441 B CN 113127441B
Authority
CN
China
Prior art keywords
target component
component
information
components
path
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911423460.4A
Other languages
Chinese (zh)
Other versions
CN113127441A (en
Inventor
李国良
钟舟
皮里红
万嘉庆
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201911423460.4A priority Critical patent/CN113127441B/en
Publication of CN113127441A publication Critical patent/CN113127441A/en
Application granted granted Critical
Publication of CN113127441B publication Critical patent/CN113127441B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • G06F16/2448Query languages for particular applications; for extensibility, e.g. user defined types

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application discloses a method for dynamically selecting components in a database management system, which can be applied to a self-assembled database management system comprising a plurality of micro-service components. The method comprises the steps of vectorizing information related to query to obtain vectorized information input, inputting the vectorized information into a reinforcement learning model to obtain a first target component, and then complementing the first target component into an execution path by using a tree search algorithm such as a Monte Carlo Tree Search (MCTS) algorithm, wherein the execution path comprises the first target component and a second target component, and the first target component and the second target component respectively realize different functions. According to the scheme provided by the embodiment of the application, the corresponding micro-service component can be automatically selected to respond to the query according to the query information and the state information of the database, so that different service scenes can be flexibly dealt with, and the execution efficiency is improved.

Description

一种动态选择数据库组件的方法及自组装数据库管理系统A method for dynamically selecting database components and a self-assembling database management system

技术领域Technical Field

本申请实施例涉及数据库领域,尤其涉及一种数据库管理系统中动态选择组件的方法及自组装数据库管理系统。The embodiments of the present application relate to the field of databases, and in particular to a method for dynamically selecting components in a database management system and a self-assembling database management system.

背景技术Background Art

数据库管理系统(database management system,DBMS),通常也简称为数据库,是许多应用系统的核心,用于为应用程序提供数据操作、权限控制、数据持久化、并发控制、崩溃恢复等能力。传统的数据库管理系统架构是面向通用处理器设计的,核心组件包含结构化查询语言(structured query language,SQL)解析器,SQL优化器,SQL执行器和存储引擎。传统的数据库管理系统在逻辑架构上进行了组件的功能划分,但是物理上却是紧耦合的实现。即数据库管理系统作为一个整体被开发,并被部署到特定的硬件设备上,以实现数据维护管理的功能。Database management system (DBMS), also commonly referred to as database, is the core of many application systems, used to provide data operations, permission control, data persistence, concurrency control, crash recovery and other capabilities for applications. The traditional database management system architecture is designed for general-purpose processors, and the core components include structured query language (SQL) parser, SQL optimizer, SQL executor and storage engine. Traditional database management systems divide the functions of components in the logical architecture, but they are tightly coupled physically. That is, the database management system is developed as a whole and deployed on specific hardware devices to implement data maintenance and management functions.

现有技术中,数据库管理中各个组件之间的连接关系是在开发时设置好的,从而数据库管理系统在执行用户输入的查询指令时通过的组件是固定的。In the prior art, the connection relationship between various components in database management is set during development, so that the components passed by the database management system when executing the query instructions input by the user are fixed.

由于组件的搭配是固定化的,不能灵活应对不同的业务场景。Since the combination of components is fixed, it cannot flexibly respond to different business scenarios.

发明内容Summary of the invention

本申请实施例提供了一种数据库管理系统中动态选择组件的方法及自组装数据库管理系统,能够根据查询信息和数据库管理系统的状态自动选择相应的组件来运行查询信息,可以灵活应对不同业务场景,并提高执行效率。The embodiments of the present application provide a method for dynamically selecting components in a database management system and a self-assembling database management system, which can automatically select corresponding components to run query information according to query information and the status of the database management system, can flexibly respond to different business scenarios, and improve execution efficiency.

本申请实施例第一方面提供了一种数据库管理系统中动态选择组件的方法,该方法可以由包含多个微服务组件的数据库管理系统实施,也可以由包含数据库管理系统的设备,比如数据库服务器,或允许在服务器上的虚拟机实施。该方法包括:获取查询信息和数据库管理系统的状态信息,该状态信息可以包括数据库管理系统中多个组件的负载信息。根据强化学习模型和向量化信息得到第一目标组件和第一目标组件的交互参数,向量化信息可以由查询信息和状态信息经过向量化处理后得到,交互参数可以包括第一目标组件与其他组件之间需要传输的参数。自组装管理器可以根据第一目标组件,使用搜索算法确定第一路径,自组装管理器可以根据第一路径响应查询信息,第一路径至少包括一个第一目标组件和一个第二目标组件,第一目标组件和第二目标组件的功能不同。The first aspect of the embodiments of the present application provides a method for dynamically selecting components in a database management system, which can be implemented by a database management system including multiple microservice components, or by a device including a database management system, such as a database server, or a virtual machine that allows implementation on a server. The method includes: obtaining query information and status information of the database management system, and the status information may include load information of multiple components in the database management system. The interaction parameters of the first target component and the first target component are obtained according to the reinforcement learning model and the vectorized information. The vectorized information can be obtained after the query information and the status information are vectorized. The interaction parameters may include parameters that need to be transmitted between the first target component and other components. The self-assembly manager can determine the first path based on the first target component using a search algorithm, and the self-assembly manager can respond to the query information based on the first path. The first path includes at least a first target component and a second target component, and the functions of the first target component and the second target component are different.

本申请实施例中,可以根据强化学习模型和向量化信息得到第一目标组件,再利用搜索算法,比如树搜索算法从数据库管理系统中选择一个或多个第二目标组件,以得到第一路径,以使得数据库管理系统根据第一路径响应查询信息,数据库管理系统可以根据查询信息和数据库管理系统的状态信息自动选择相应的组件来运行查询信息,可以灵活应对不同业务场景,并提高执行效率。In an embodiment of the present application, a first target component can be obtained based on a reinforcement learning model and vectorized information, and then a search algorithm, such as a tree search algorithm, can be used to select one or more second target components from a database management system to obtain a first path, so that the database management system responds to query information according to the first path. The database management system can automatically select a corresponding component to run the query information based on the query information and the status information of the database management system, which can flexibly respond to different business scenarios and improve execution efficiency.

一种可能的实现方式中,预先训练有强化学习模型,将向量化信息作为强化学习模型的输入,以得到第一目标组件和第一目标组件的交互参数。提升了方案的可实现性。In a possible implementation, a reinforcement learning model is pre-trained, and the vectorized information is used as input of the reinforcement learning model to obtain the interaction parameters between the first target component and the second target component, thereby improving the feasibility of the solution.

一种可能的实现方式中,可以根据强化学习模型、生成对抗网络GAN和向量化信息得到第一目标组件和该第一目标组件的交互参数。本申请实施例中,也可以利用生成对抗网络优化根据强化学习模型选择的第一目标组件,优化根据搜索算法选择的第二目标组件。In one possible implementation, the first target component and the interaction parameter of the first target component can be obtained according to the reinforcement learning model, the generative adversarial network GAN and the vectorized information. In an embodiment of the present application, the generative adversarial network can also be used to optimize the first target component selected according to the reinforcement learning model and the second target component selected according to the search algorithm.

一种可能的实现方式中,可以用GAN的生成器替换强化学习模型中的一个元素,以得到新的强化学习模型,再向新的强化学习模型输入向量化信息得到第一目标组件和第一目标组件的交互参数。提升了方案的可实现性。In one possible implementation, an element in the reinforcement learning model can be replaced with a GAN generator to obtain a new reinforcement learning model, and then vectorized information is input into the new reinforcement learning model to obtain the first target component and the interaction parameter of the first target component. This improves the feasibility of the solution.

一种可能的实现方式中,该搜索算法为蒙特卡洛树搜索算法。提升了方案的可实现性。In a possible implementation, the search algorithm is a Monte Carlo tree search algorithm, which improves the feasibility of the solution.

一种可能的实现方式中,在基于搜索算法搜索数据库管理系统并选择第二目标组件之后,可以获取GAN的判别器对第一路径的打分信息,打分信息与第一路径的性能参数相关。若第一目标组件的得分不满足预置条件,则可以将第一目标组件的得分反馈给生成器,以使得生成器对第一目标组件进行处理以得到处理后的第一目标组件,基于处理后的第一目标组件重复执行前述搜索第二目标组件以及获取打分信息,若得分满足预置条件,则输出优化组件,并得到目标状态信息,优化组件为得分满足预置条件的第一目标组件。可以根据强化学习模型、优化组件和状态信息得到目标状态信息,目标状态信息包括已确定的组件信息和查询状态信息。若所述优化组件的数量不满足预设数量,将目标状态信息作为状态信息重复执行前述获得第一目标组件、搜索第二目标组件、以及获取打分信息,若优化组件的数量满足预设数量,输出第二路径,第一目标组件的得分由打分信息经过处理后得到;第二路径至少包括两个优化组件,每个优化组件的功能不一样;根据第二路径,触发至少两个优化组件响应查询信息。In a possible implementation, after searching the database management system based on the search algorithm and selecting the second target component, the scoring information of the GAN discriminator on the first path can be obtained, and the scoring information is related to the performance parameters of the first path. If the score of the first target component does not meet the preset conditions, the score of the first target component can be fed back to the generator, so that the generator processes the first target component to obtain the processed first target component, and repeats the aforementioned search for the second target component and obtaining the scoring information based on the processed first target component. If the score meets the preset conditions, the optimized component is output, and the target state information is obtained. The optimized component is the first target component whose score meets the preset conditions. The target state information can be obtained according to the reinforcement learning model, the optimized component and the state information, and the target state information includes the determined component information and the query state information. If the number of the optimization components does not meet the preset number, the target state information is used as the state information to repeat the aforementioned steps of obtaining the first target component, searching for the second target component, and obtaining the scoring information. If the number of the optimization components meets the preset number, the second path is output, and the score of the first target component is obtained after processing the scoring information; the second path includes at least two optimization components, and each optimization component has a different function; according to the second path, at least two optimization components are triggered to respond to the query information.

本申请实施例中,根据强化学习模型和向量化信息得到第一目标组件,再利用搜索算法选择第二目标组件,以得到第一路径,选择出第一目标组件中满足预置条件的优化组件,再将目标状态信息作为状态信息重复执行前述获得第一目标组件、搜索第二目标组件、以及获取打分信息,直到优化组件的数量满足预设数量,输出第二路径,并根据第二路径中的优化组件响应查询信息,可以根据查询信息和数据库的状态信息自动选择满足预置条件的优化组件执行操作响应查询信息,可以灵活应对不同业务场景,并提高执行效率。In an embodiment of the present application, a first target component is obtained based on a reinforcement learning model and vectorized information, and then a second target component is selected using a search algorithm to obtain a first path, and an optimized component that meets a preset condition in the first target component is selected, and then the target state information is used as the state information to repeat the aforementioned steps of obtaining the first target component, searching for the second target component, and obtaining the scoring information until the number of optimized components meets a preset number, and a second path is output, and query information is responded to based on the optimized component in the second path. The optimized component that meets the preset condition can be automatically selected to execute the operation to respond to the query information based on the query information and the state information of the database, which can flexibly respond to different business scenarios and improve execution efficiency.

本申请实施例第二方面提供了一种数据库管理系统,包括多个数据库组件,每个数据库组件用于实现一种特定功能,该数据库管理系统还包括一个或多个功能单元,用于实现前述第一方面或第一方面任一可能的实现方式的方法。A second aspect of an embodiment of the present application provides a database management system, comprising multiple database components, each database component being used to implement a specific function. The database management system also includes one or more functional units for implementing the method of the aforementioned first aspect or any possible implementation method of the first aspect.

本申请实施例第二方面提供了一种自组装管理器,该自组装管理器包括多个功能单元,用于实现前述第一方面或第一方面任一可能的实现方式的方法。A second aspect of an embodiment of the present application provides a self-assembly manager, which includes multiple functional units and is used to implement the method of the aforementioned first aspect or any possible implementation manner of the first aspect.

本申请实施例第三方面提供了一种自组装管理器,该自组装管理器包括处理器和存储器,该存储器中存储有可执行程序或指令,该处理器允许该程序或执行,以实现前述第一方面或第一方面任一可能的实现方式的方法。A third aspect of an embodiment of the present application provides a self-assembly manager, which includes a processor and a memory, wherein the memory stores an executable program or instruction, and the processor allows the program or instruction to be executed to implement the method of the aforementioned first aspect or any possible implementation method of the first aspect.

本申请实施例第四方面提供了一种计算机存储介质,该计算机存储介质中存储有指令,该指令在计算机上执行时,使得计算机执行前述第一方面或第一方面任一可能的实现方式的方法。A fourth aspect of an embodiment of the present application provides a computer storage medium, which stores instructions. When the instructions are executed on a computer, the computer executes the method of the first aspect or any possible implementation method of the first aspect.

本申请实施例第五方面提供了一种计算机软件产品,该计算机程序产品在计算机上执行时,使得计算机执行前述第一方面或第一方面任一可能的实现方式的方法。A fifth aspect of an embodiment of the present application provides a computer software product. When the computer program product is executed on a computer, it enables the computer to execute the method of the first aspect or any possible implementation manner of the first aspect.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

图1A为本申请实施例提供的一种数据库系统的架构图;FIG1A is an architecture diagram of a database system provided in an embodiment of the present application;

图1B为本申请实施例中基于微服务组件解耦后的数据库系统结构示意图;FIG1B is a schematic diagram of the structure of a database system based on decoupling of microservice components in an embodiment of the present application;

图2为本申请实施例中强化学习的基础模型;FIG2 is a basic model of reinforcement learning in an embodiment of the present application;

图3为本申请实施例中自组装管理器与数据库的结构关系示意图;3 is a schematic diagram of the structural relationship between the self-assembly manager and the database in an embodiment of the present application;

图4为本申请实施例中的RL+GAN+搜索算法流程;FIG4 is a flow chart of the RL+GAN+search algorithm in an embodiment of the present application;

图5为本申请实施例中的动态选择数据库组件的方法一个流程示意图;FIG5 is a flow chart of a method for dynamically selecting a database component in an embodiment of the present application;

图6为本申请实施例中的动态选择数据库组件的方法另一流程示意图;FIG6 is another flow chart of the method for dynamically selecting a database component in an embodiment of the present application;

图7为本申请实施例中的动态选择数据库组件的方法的实施场景;FIG7 is an implementation scenario of the method for dynamically selecting a database component in an embodiment of the present application;

图8为本申请实施例中的动态选择数据库组件的方法另一流程示意图;FIG8 is another schematic diagram of a flow chart of a method for dynamically selecting a database component in an embodiment of the present application;

图9为本申请实施例中的动态选择数据库组件的方法另一流程示意图;FIG9 is another schematic diagram of a flow chart of a method for dynamically selecting a database component in an embodiment of the present application;

图10为本申请实施例中自组装管理器一个结构示意图;FIG10 is a schematic diagram of a structure of a self-assembly manager in an embodiment of the present application;

图11为本申请实施例中自组装管理器另一个结构示意图;FIG11 is another schematic diagram of the structure of the self-assembly manager in an embodiment of the present application;

图12为本申请实施例中自组装管理器另一个结构示意图;FIG12 is another schematic diagram of the structure of the self-assembly manager in an embodiment of the present application;

图13为本申请实施例中数据库系统的一个示意图;FIG13 is a schematic diagram of a database system in an embodiment of the present application;

图14为本申请实施例中数据库系统的另一示意图。FIG. 14 is another schematic diagram of a database system in an embodiment of the present application.

具体实施方式DETAILED DESCRIPTION

本申请实施例提供了一种数据库管理系统中动态选择组件的方法及相关设备,用于自动选择组件生成路径序列。The embodiment of the present application provides a method and related equipment for dynamically selecting components in a database management system, which are used to automatically select components to generate a path sequence.

本申请实施例提供的方法可应用于数据库系统(Database System)中。图1A示出了本申请实施例提供的一种数据库系统的架构,根据图1A,数据库系统10包括数据库管理系统(Database Management System,DBMS)100、数据库101以及数据存储器(DataStorage)103。The method provided in the embodiment of the present application can be applied to a database system. FIG1A shows the architecture of a database system provided in the embodiment of the present application. According to FIG1A , the database system 10 includes a database management system (DBMS) 100 , a database 101 and a data storage device (DataStorage) 103 .

数据库101是存储在数据存储器103中的有组织的数据集合,即按照特定的数据模型组织、存储和使用的相关联的数据集合。根据组织数据所使用的数据模型的不同,数据可分为多种类型,比如关系型数据(relational data)、图(graph)数据、时间序列(timeseries)数据等。关系型数据是使用关系模型建模的数据,通常表示为表,表中的行表示一个对象或实体的相关值的集合。图数据,简称为“图”,用于表示对象或实体之间的关系,比如社交关系。时间序列数据,简称时序数据,是按时间顺序记录和索引的数据列,用于描述一个对象在时间维度上的状态变化信息。Database 101 is an organized data set stored in data storage 103, that is, a collection of associated data organized, stored and used according to a specific data model. According to the different data models used to organize data, data can be divided into multiple types, such as relational data, graph data, time series data, etc. Relational data is data modeled using a relational model, usually represented as a table, and the rows in the table represent a set of related values of an object or entity. Graph data, referred to as "graph", is used to represent the relationship between objects or entities, such as social relationships. Time series data, referred to as time series data, is a data column recorded and indexed in chronological order, used to describe the state change information of an object in the time dimension.

数据库管理系统100是数据库系统的核心,是用于组织、存储以及维护数据的系统软件。客户端30经由网络20可以与数据库管理系统100建立通信连接,并可以通过数据库管理系统100访问数据库101,数据库管理员(Database Administrator,DBA)也通过数据库管理系统100进行数据库101的维护工作。数据库管理系统100提供多种功能,供客户端30建立,修改和查询数据库101,其中,客户端30可以为应用程序,或者用户设备。数据库管理系统100所提供的功能可以包括但不限于以下几项:(1)数据定义功能,数据库管理系统100提供数据定义语言(Data Definition Language,DDL)来定义数据库101的结构,DDL用于刻画数据库框架,并可以被保存在数据字典中;(2)数据存取功能,数据库管理系统100提供数据操纵语言(Data Manipulation Language,DML),实现对数据库101的基本存取操作,比如检索、插入、修改和删除;(3)数据库运行管理功能,数据库管理系统100提供数据控制功能对数据库101运行进行有效地控制和管理,以确保数据正确有效;(4)数据库的建立和维护功能,包括数据库初始数据的载入,数据库的转储、恢复、重组织,系统性能监视、分析等功能;(5)数据库的传输,数据库管理系统100提供处理数据的传输,以实现客户端30与数据库管理系统100之间的通信,通常与操作系统协调完成。The database management system 100 is the core of the database system and is a system software for organizing, storing and maintaining data. The client 30 can establish a communication connection with the database management system 100 via the network 20 and can access the database 101 through the database management system 100. The database administrator (Database Administrator, DBA) also performs maintenance work on the database 101 through the database management system 100. The database management system 100 provides multiple functions for the client 30 to establish, modify and query the database 101, wherein the client 30 can be an application or a user device. The functions provided by the database management system 100 may include but are not limited to the following: (1) Data definition function. The database management system 100 provides a data definition language (DDL) to define the structure of the database 101. DDL is used to describe the database framework and can be saved in the data dictionary. (2) Data access function. The database management system 100 provides a data manipulation language (DML) to implement basic access operations on the database 101, such as retrieval, insertion, modification and deletion. (3) Database operation management function. The database management system 100 provides a data control function to effectively control and manage the operation of the database 101 to ensure that the data is correct and valid. (4) Database establishment and maintenance function, including loading of initial database data, database dumping, recovery, reorganization, system performance monitoring, analysis and other functions. (5) Database transmission. The database management system 100 provides transmission of processed data to achieve communication between the client 30 and the database management system 100, which is usually coordinated with the operating system.

数据库管理系统100的运行依赖于必要的软硬件环境,包括但不限于硬件层104和操作系统102。其中,硬件层104包含操作系统102和数据库管理系统100运行所需的基本硬件单元,例如,处理器,内存(Memory)、输入/输出(I/O)设备、网络接口控制器(networkinterface controller,NIC)等。操作系统102是管理硬件单元的系统软件,可以提供内存管理、线程调度等功能。The operation of the database management system 100 depends on the necessary software and hardware environment, including but not limited to the hardware layer 104 and the operating system 102. The hardware layer 104 includes the basic hardware units required for the operation of the operating system 102 and the database management system 100, such as processors, memory, input/output (I/O) devices, network interface controllers (NIC), etc. The operating system 102 is the system software that manages the hardware units and can provide functions such as memory management and thread scheduling.

数据存储器103可以是硬盘、磁盘、存储阵列、存储服务器、云存储、存储区网络(Storage Area Network,SAN)等非瞬态计算机可读存储介质,与硬件层104所在的计算节点通信连接。或者,数据存储器103也可以集成在硬件层104所在的计算节点,与处理器和I/O设备通过总线或其它内部通信方式交互数据。需要说明的是,本申请实施例中的“计算节点”,是指具备执行数据计算和/或存储所需的硬件资源的实体,比如物理机或数据库服务器等,或者能够调用硬件资源进行计算和/或存储的实体,比如物理机中部署的虚拟机(virtual machine,VM)或容器等。The data storage device 103 can be a non-transient computer-readable storage medium such as a hard disk, a disk, a storage array, a storage server, a cloud storage, a storage area network (SAN), etc., which is communicatively connected to the computing node where the hardware layer 104 is located. Alternatively, the data storage device 103 can also be integrated in the computing node where the hardware layer 104 is located, and exchange data with the processor and I/O devices through a bus or other internal communication methods. It should be noted that the "computing node" in the embodiments of the present application refers to an entity that has the hardware resources required to perform data calculation and/or storage, such as a physical machine or a database server, or an entity that can call hardware resources for calculation and/or storage, such as a virtual machine (VM) or container deployed in a physical machine.

在一个实施例中,数据库管理系统100的功能可以由处理器执行内存中存储的可执行代码来实现。应理解,在本发明的各种实施例中,“可执行程序”应被广泛地解释为包括但不限于:指令,指令集,代码,代码段,子程序,软件模块,应用,软件包,线程,进程,函数,固件,中间件等。在一个实施例中,数据库管理系统100可以是运行在服务器或虚拟机上的软件,该软件对应的代码或指令存储在存储器中,当被至少一个处理器执行时,实现相应的功能。In one embodiment, the functions of the database management system 100 can be implemented by a processor executing executable codes stored in a memory. It should be understood that in various embodiments of the present invention, "executable program" should be broadly interpreted as including but not limited to: instructions, instruction sets, codes, code segments, subroutines, software modules, applications, software packages, threads, processes, functions, firmware, middleware, etc. In one embodiment, the database management system 100 can be software running on a server or a virtual machine, and the code or instructions corresponding to the software are stored in a memory, and when executed by at least one processor, the corresponding functions are implemented.

所属领域的技术人员可以理解一个数据库系统可能包括比图1A中所示的部件更少或更多的组件,或者包括与图1A中所示组件不同的组件,图1A仅仅示出了与本发明实施例所公开的实现方式更加相关的组件。Those skilled in the art may understand that a database system may include fewer or more components than those shown in FIG. 1A , or include components different from those shown in FIG. 1A , and FIG. 1A merely shows components that are more relevant to the implementation method disclosed in the embodiment of the present invention.

图1B示出了本申请实施例的一种数据库管理系统100的逻辑架构。根据图1B,数据库管理系统100包括:FIG1B shows a logical architecture of a database management system 100 according to an embodiment of the present application. According to FIG1B , the database management system 100 includes:

应用程序接口110、作业管理器120、组件管理器130、消息通信服务140、操作系统150、以及存储器103。进一步地,数据库管理系统100还包括多个数据库组件,这些数据库组件为微服务组件,每一个微服务组件用于实现数据库管理系统的一种特定功能。在一个实施例中,数据库管理系统100包括的数据库组件包括:解析器服务160、优化器服务170、解析器和优化器组合服务165、执行器服务180、存储引擎服务182、元数据服务184、统计服务186、自监控服务188、时钟服务190。下面进一步描述数据库管理系统100各个组件的功能:Application program interface 110, job manager 120, component manager 130, message communication service 140, operating system 150, and memory 103. Further, database management system 100 also includes multiple database components, which are microservice components, and each microservice component is used to implement a specific function of the database management system. In one embodiment, the database components included in database management system 100 include: parser service 160, optimizer service 170, parser and optimizer combination service 165, executor service 180, storage engine service 182, metadata service 184, statistics service 186, self-monitoring service 188, clock service 190. The functions of each component of database management system 100 are further described below:

应用程序接口110是提供给客户端连接和访问数据库管理系统100的接口,比如Java数据库连接(Java Database Connectivity,JDBC)接口、开放数据库互连(OpenDatabase Connectivity,ODBC)接口等等。The application program interface 110 is an interface provided to the client to connect to and access the database management system 100, such as a Java Database Connectivity (JDBC) interface, an Open Database Connectivity (ODBC) interface, and the like.

作业管理器120包括调度器121,根据来自客户端的用户请求,比如查询,从组件管理器231提供的执行路径选择最优执行路径,并基于最优执行路径调度服务组件以进行相应处理。当执行路径中的某个微服务组件发生错误,调度器121调度备用执行路径来继续执行当前用户请求,从而提升数据库服务可用性。作业管理器120自身也可以内嵌解析器122、优化器123、执行器124以及存储引擎125等服务组件。调度器121可以调用作业管理器120内嵌的服务组件,也可以调用作业管理器120外部的服务组件,比如解析器和优化器组合服务165、执行器服务180等。在调用外部的服务组件时,可以采用远程过程调用(RemoteProcedure Call,RPC)方式。The job manager 120 includes a scheduler 121, which selects the optimal execution path from the execution path provided by the component manager 231 according to the user request from the client, such as a query, and schedules the service component based on the optimal execution path for corresponding processing. When an error occurs in a microservice component in the execution path, the scheduler 121 schedules the backup execution path to continue to execute the current user request, thereby improving the availability of database services. The job manager 120 itself can also embed service components such as a parser 122, an optimizer 123, an executor 124, and a storage engine 125. The scheduler 121 can call the service components embedded in the job manager 120, or call service components outside the job manager 120, such as a parser and optimizer combined service 165, an executor service 180, etc. When calling external service components, a remote procedure call (RPC) method can be used.

组件管理器130主要负责微服务组件的管理,包括但不限于:组件注册与注销、组件启停、组件容错、组件升级、组件状态监控等。(1)组件注册与注销:当添加新服务组件时,需要到组件管理器130注册,当删除服务组件时,也需要到组件管理器130注销,组件管理器130可以维护相关的元数据,以记录各个服务组件的状态,部署位置等信息,这样可以确保组件管理器130了解系统中的可用服务组件,以及每个服务组件的部署位置。(2)组件启停:系统启动时,组件管理器130根据硬件配置,启动元数据服务、自监控服务、统计服务等服务组件;在分布式场景下,每个服务组件可启动多份(具体数量可配置),以用于备份。(3)组件容错:当某个服务组件失败时,组件管理器130需要调度备用服务组件来继续执行当前组装方案。(4)组件升级:组件可以轮转升级,对于无状态的组件可以随时升级;对于有状态的组件,必须当前任务完成时才能升级。(5)组件状态监控:监控服务组件运行过程中的运行状态,当数据库系统中有节点加或者退出时,需要更新运行状态,其中,运行状态包括组件服务状态和组件集群状态。组件服务状态指每个正在运行的服务组件执行的任务数量,资源使用情况。组件集群状态指每个计算节点正在运行的服务组件、可用的服务组件;每个计算节点的资源使用情况。The component manager 130 is mainly responsible for the management of microservice components, including but not limited to: component registration and deregistration, component startup and shutdown, component fault tolerance, component upgrade, component status monitoring, etc. (1) Component registration and deregistration: When adding a new service component, it is necessary to register with the component manager 130. When deleting a service component, it is also necessary to deregister with the component manager 130. The component manager 130 can maintain relevant metadata to record the status, deployment location and other information of each service component. This ensures that the component manager 130 understands the available service components in the system and the deployment location of each service component. (2) Component startup and shutdown: When the system starts, the component manager 130 starts service components such as metadata service, self-monitoring service, and statistics service according to the hardware configuration; in a distributed scenario, each service component can start multiple copies (the specific number is configurable) for backup. (3) Component fault tolerance: When a service component fails, the component manager 130 needs to schedule a backup service component to continue executing the current assembly plan. (4) Component upgrade: Components can be upgraded in rotation. For stateless components, they can be upgraded at any time; for stateful components, they must be upgraded when the current task is completed. (5) Component status monitoring: monitor the running status of service components during operation. When a node is added or exited in the database system, the running status needs to be updated. The running status includes component service status and component cluster status. Component service status refers to the number of tasks executed by each running service component and resource usage. Component cluster status refers to the service components running on each computing node, the available service components, and the resource usage of each computing node.

消息通信服务140提供低时延高带宽的通信能力,可用于微服务组件之间通信。The message communication service 140 provides low-latency and high-bandwidth communication capabilities and can be used for communication between microservice components.

解析器服务(parser service)160:主要功能是对输入的SQL语句进行词法分析、语法分析、语义分析,输出查询解析树;Parser service 160: the main function is to perform lexical analysis, syntax analysis, and semantic analysis on the input SQL statement and output the query parse tree;

优化器服务(Optimizer Service)170:主要功能是对输入的查询解析树进行处理生成执行计划,其处理逻辑包括查询重写,路径生成,代价模型评估,最优路径选择,执行计划树生成;Optimizer Service 170: Its main function is to process the input query parsing tree to generate an execution plan. Its processing logic includes query rewriting, path generation, cost model evaluation, optimal path selection, and execution plan tree generation.

执行器服务(Executer Service)180:负责将数据从存储引擎读取出来,根据执行计划将数据处理加工后返回给客户端;Executer Service 180: Responsible for reading data from the storage engine, processing the data according to the execution plan, and returning it to the client;

存储引擎服务(Storage Engine Service)182:主要功能是保证数据的持久化存储,提供高效数据访问能力,实现数据库的原子性、一致性、隔离性、持久性(Atomicity,Consistency,Isolation,Durability,ACID)能力;Storage Engine Service 182: Its main function is to ensure persistent storage of data, provide efficient data access capabilities, and implement the atomicity, consistency, isolation, and durability (ACID) capabilities of the database.

元数据服务(MetaData Service)184:主要提供元数据的持久化存储,高效元数据访问能力;Metadata Service 184: Mainly provides persistent storage of metadata and efficient metadata access capabilities;

统计服务(Statistics Service)186:主要负责收集和存储表的统计信息,主要包括表的页面个数,行数,各个列的取值分布信息等;Statistics Service 186: Mainly responsible for collecting and storing table statistics, including the number of pages, number of rows, and value distribution information of each column.

自监控服务(Instrumentation Service)188:监控数据库的各种状态数据,比如硬件资源使用信息(CPU,I/O,内存,网络),数据库各服务组件的关键性能指标(KeyPerformance Indicator,KPI)等;Instrumentation Service 188: monitors various status data of the database, such as hardware resource usage information (CPU, I/O, memory, network), key performance indicators (KPI) of each service component of the database, etc.

时钟服务(Clock Service)190:提供唯一且递增的时间戳,误差通常在100ns以内。Clock Service 190: Provides unique and incremental timestamps with an error usually within 100ns.

作业管理器120和组件管理器130组成的自组装管理器主要的功能可以是负责组件服务的启动、调度、管理,运行自组装算法,实现数据库组件的自组装。The main functions of the self-assembly manager composed of the job manager 120 and the component manager 130 may be to be responsible for starting, scheduling, and managing component services, running the self-assembly algorithm, and realizing the self-assembly of database components.

本申请实施例中,组件管理器130还可以依据系统资源确定一条或多条服务组件执行路径(以下简称“执行路径”),比如生成TOP-N最优组件执行路径。每一条组件执行路径指示有序执行的多个微服务组件,这些有序执行的微服务组件构成一个可端到端执行的完整的数据库管理系统,执行路径上的每个微服务组件可以部署在不同的计算节点。In the embodiment of the present application, the component manager 130 can also determine one or more service component execution paths (hereinafter referred to as "execution paths") based on system resources, such as generating TOP-N optimal component execution paths. Each component execution path indicates multiple microservice components that are executed in order. These ordered microservice components constitute a complete database management system that can be executed end-to-end. Each microservice component on the execution path can be deployed on different computing nodes.

本申请实施例中,组件管理器130可以包含一个组件管理器或多个组件管理器客户端,每个组件管理器客户端部署在单一计算节点(物理机或虚拟机)中,实现该节点上组件注册、组件注销、组件启停、组件资源管理、组件升级等功能。在整个数据库管理系统中,可以有多个组件管理器作为备份,比如3个。In the embodiment of the present application, the component manager 130 may include one component manager or multiple component manager clients, each of which is deployed in a single computing node (physical machine or virtual machine) to implement functions such as component registration, component deregistration, component start and stop, component resource management, and component upgrade on the node. In the entire database management system, there may be multiple component managers as backups, for example, three.

微服务组件能够独立启动、运行。例如,每个微服务组件可以运行为一个或多个实例,这里的实例,可以为线程。服务组件之间采用轻量级通讯机制相互通信。在一个实施例中,多个微服务组件也可以组合为更大粒度的组合服务组件,比如图1B所示的解析器和优化器组合服务165,是同时包含解析器服务和优化器服务功能的组合服务组件。Microservice components can be started and run independently. For example, each microservice component can run as one or more instances, where the instances can be threads. Service components communicate with each other using lightweight communication mechanisms. In one embodiment, multiple microservice components can also be combined into a larger granularity combined service component, such as the parser and optimizer combined service 165 shown in FIG. 1B, which is a combined service component that includes both the parser service and the optimizer service functions.

微服务组件能够独立部署到裸机或者容器中,并支持在线升级。用户或者数据库内核可以根据当前的业务场景,灵活搭配和组装微服务组件以构建不同类型的数据库管理系统。Microservice components can be independently deployed to bare metal or containers and support online upgrades. Users or database kernels can flexibly match and assemble microservice components to build different types of database management systems based on current business scenarios.

在一个实施例中,数据库管理系统100的微服务组件可以分布式部署到数据中心中计算节点上,或者跨数据中心部署。数据中心的计算节点之间通过高速网络互连,比如,通过无限带宽(InfiniBand)网络互连。计算节点为物理机,或者具备数据处理能力的其它设备。每个计算节点包含操作系统和应用程序运行所需的基本硬件资源,例如,处理器,内存(Memory)、输入/输出(I/O)设备等。一个计算节点上运行有一个或多个虚拟机(virtualmachine,VM),每一个VM上可以部署一个或多个微服务组件。每一个微服务组件部署可以在1个单独的VM,但应理解,多个微服务组件也可以部署在同一个VM。In one embodiment, the microservice components of the database management system 100 can be distributed and deployed on computing nodes in a data center, or deployed across data centers. The computing nodes in the data center are interconnected through a high-speed network, for example, through an InfiniBand network. The computing nodes are physical machines, or other devices with data processing capabilities. Each computing node contains the basic hardware resources required for the operation of the operating system and application programs, such as processors, memory, input/output (I/O) devices, etc. One or more virtual machines (VMs) run on a computing node, and one or more microservice components can be deployed on each VM. Each microservice component can be deployed on a separate VM, but it should be understood that multiple microservice components can also be deployed on the same VM.

在一个实施例中,数据库管理系统100的微服务组件也可以以一体机的形式部署。每个物理机上部署有一个或多个微服务组件,多个物理机可以集成到一个机柜中,通过总线,比如PCI-E总线进行通信。In one embodiment, the microservice components of the database management system 100 can also be deployed in the form of an integrated machine. One or more microservice components are deployed on each physical machine, and multiple physical machines can be integrated into one cabinet and communicate through a bus, such as a PCI-E bus.

在一个实施例中,微服务组件可以动态链接库的方式被动态加载。例如,一个微服务组件执行的过程中,可以动态加载以动态链接库形式存在的其它一个或多个微服务组件。In one embodiment, the microservice component can be dynamically loaded in the form of a dynamic link library. For example, during the execution of a microservice component, one or more other microservice components in the form of a dynamic link library can be dynamically loaded.

本申请实施例中,以上组件的数量仅以图1中的数量为例进行示意性说明,可以理解的是各组件可以根据需要设置不同的数量,各组件的数量具体此处不做限定。比如,图中示出了2个解析器服务、2个优化器服务、3个执行器服务以及3个存储服务,而元数据服务、统计服务和加速器服务的数量均为1个。数据库管理系统100也可能包含具备相同功能的多种类型的微服务组件。以存储服务180为例,图1B示出了列存引擎、行存引擎和内存引擎三种类型的存储引擎。又例如,数据库管理系统100可以同时包含多种类型的解析器服务组件,比如用于解析关系型查询的解析器、用于解析图查询的解析器、用于解析时序查询的解析器等。每一种类型的微服务组件的数量可以为一个或多个。数据库管理系统100可以基于客户端提交的查询的信息,比如查询类型,以及系统负载,比如各个微服务组件的负载,自动选择多个微服务组件来组装成一个有序的组件序列,该有序的组件为一条路径,该路径指示的微服务组件按序执行,可以实现数据库管理系统的功能从而提高整个系统的可用性和可维护性。因此,数据库管理系统100的核心能力是动态选择最优的路径(组件序列)以及调用或触发该路径指示的组件执行响应操作来响应查询。在一个实施例中,选择最优路径和调用组件执行操作分别可以由组件管理器130和作业管理器120实现。在一个实施例中,作业管理器120和组件管理器130也可以集成到一起,组成一个大的功能单元,比如自组装管理器。自组装管理器也可以作为数据库管理系统100的一个服务组件,独立于执行过程涉及的微服务组件之外,是指导执行过程的输入,通过获取数据库执行的结果作为反馈继续强化学习更新自身模型,所以如图3描述中自组装管理器放在了外面。In the embodiment of the present application, the number of the above components is only schematically illustrated by taking the number in Figure 1 as an example. It can be understood that each component can be set to a different number as needed, and the number of each component is not specifically limited here. For example, the figure shows 2 parser services, 2 optimizer services, 3 executor services and 3 storage services, while the number of metadata services, statistics services and accelerator services is 1. The database management system 100 may also include multiple types of microservice components with the same functions. Taking the storage service 180 as an example, Figure 1B shows three types of storage engines: column storage engine, row storage engine and memory engine. For another example, the database management system 100 can simultaneously include multiple types of parser service components, such as a parser for parsing relational queries, a parser for parsing graph queries, a parser for parsing time series queries, etc. The number of each type of microservice components can be one or more. The database management system 100 can automatically select multiple microservice components to assemble into an ordered component sequence based on the information of the query submitted by the client, such as the query type, and the system load, such as the load of each microservice component. The ordered component is a path, and the microservice components indicated by the path are executed in order, which can realize the function of the database management system and improve the availability and maintainability of the entire system. Therefore, the core capability of the database management system 100 is to dynamically select the optimal path (component sequence) and call or trigger the component indicated by the path to perform a response operation to respond to the query. In one embodiment, the selection of the optimal path and the calling component execution operation can be implemented by the component manager 130 and the job manager 120 respectively. In one embodiment, the job manager 120 and the component manager 130 can also be integrated together to form a large functional unit, such as a self-assembly manager. The self-assembly manager can also be used as a service component of the database management system 100, independent of the microservice components involved in the execution process, and is the input to guide the execution process. By obtaining the result of the database execution as feedback, the self-model is updated by continuous reinforcement learning, so the self-assembly manager is placed outside as described in Figure 3.

数据库管理系统100在收到查询指令后,数据库管理系统100中的各个服务组件具体如何搭配和组装,即选择哪些组件以何种顺序(路径)来响应查询指令。可以通过强化学习(reinforcement learning,RL)、搜索算法以及生成对抗网络(Generative AdversarialNetworks,GAN)选择响应该查询指令的最优路径(响应查询指令的多个特定组件构成的组件序列)。下面先对动态选择数据库组件中用到的机器学习模型进行描述。After receiving the query instruction, the database management system 100 specifically determines how to match and assemble the various service components in the database management system 100, that is, which components are selected in what order (path) to respond to the query instruction. The optimal path (component sequence consisting of multiple specific components that respond to the query instruction) to respond to the query instruction can be selected through reinforcement learning (RL), search algorithms, and generative adversarial networks (GAN). The following first describes the machine learning model used in the dynamic selection of database components.

图2示出了本申请实施例用于选择最优路径的强化学习模型的示例:FIG2 shows an example of a reinforcement learning model for selecting an optimal path according to an embodiment of the present application:

强化学习是机器学习的一个重要分支,是所学科多领域交叉的一个产物,强调如何基于环境行动,以取得最大化的预期利益。Reinforcement learning is an important branch of machine learning and a product of the intersection of multiple disciplines. It emphasizes how to act based on the environment to maximize expected benefits.

强化学习的基础模型包括:The basic models of reinforcement learning include:

智能体(agent)、当前状态(state)、动作(action)、环境(environment)以及奖励(reward)。Agent, current state, action, environment, and reward.

其中,agent是基础模型的核心,能够感知state,并且根据环境提供的强化信号,通过学习选择一个合适的action,来最大化长期的reward。Among them, the agent is the core of the basic model. It can perceive the state and select a suitable action through learning based on the reinforcement signals provided by the environment to maximize the long-term reward.

State是agent所在的环境信息,包含了agent用于进行action选择的所有信息。State is the environment information of the agent, which contains all the information used by the agent to select actions.

Environment接收agent执行action,并对action的好坏进行评价,并转化为一种可量化的reward反馈给agent。The Environment receives the actions executed by the agent, evaluates the quality of the actions, and converts them into a quantifiable reward and feeds them back to the agent.

Reward是Environment给agent的一种可量化的标量反馈信号,用于评价agent所做action的好坏。Reward is a quantifiable scalar feedback signal from the Environment to the agent, which is used to evaluate the quality of the action taken by the agent.

Agent在state下执行action,与environment进行交互,环境给出下一状态state+1和reward作用于agent供其学习,通过不断与环境接触,agent从环境中学习规律,从而学习到最优方案。The agent executes action under the state and interacts with the environment. The environment gives the next state state+1 and reward to the agent for learning. Through continuous contact with the environment, the agent learns the rules from the environment and thus learns the optimal solution.

上面对本申请实施例的数据库管理系统和强化学习模型进行了简单介绍,下面对于本申请实施例提出的自组装算法(RL+GAN+搜索算法)进行描述:The above briefly introduces the database management system and reinforcement learning model of the embodiment of the present application. The following describes the self-assembly algorithm (RL+GAN+search algorithm) proposed in the embodiment of the present application:

请参阅图4,本申请实施例中的RL+GAN+搜索算法流程:Please refer to FIG4 , the RL+GAN+search algorithm process in the embodiment of the present application:

将数据库的执行路径划分为多个状态,以强化学习的迭代思想为核心,将生成对抗网络(generative adversarial networks,GAN)的生成器(Generator)作为智能体Agent,为当前状态state生成一个执行动作action以到达下一个状态state’,利用搜索算法将每一个动作随机完整性补全成一条执行路径,再用GAN的判别器Discriminator为每个路径打分,反馈给Generator促进其迭代,生成更优的动作,直到状态结束,为数据库最终生成一条完整的执行路径,再将数据库这个实际运行的系统作为Environment,将执行结果反馈给Generator和Discriminator,促进网络优化。The execution path of the database is divided into multiple states. With the iterative idea of reinforcement learning as the core, the generator of the generative adversarial network (GAN) is used as the intelligent agent to generate an execution action for the current state state to reach the next state state'. The search algorithm is used to randomly complete each action into an execution path. The discriminator of GAN is then used to score each path and feed it back to the generator to promote its iteration and generate better actions until the state ends. Finally, a complete execution path is generated for the database. The actual running system of the database is used as the environment, and the execution results are fed back to the generator and the discriminator to promote network optimization.

本申请实施例中,以搜索算法为蒙特卡洛树搜索(monte carlo tree search,MCTS)算法进行示意性说明,可以理解的是,在实际应用中,搜索算法还可以是其他算法,例如:搜索算法可以是上限置信区间算法(upper confidence bound apply to tree,UCT),还可以是上置信界(the upper confidence bound,UCB)算法,具体此处不再限定。In the embodiment of the present application, the search algorithm is schematically illustrated as a Monte Carlo tree search (MCTS) algorithm. It can be understood that in practical applications, the search algorithm can also be other algorithms. For example, the search algorithm can be an upper confidence bound apply to tree (UCT) algorithm or an upper confidence bound (UCB) algorithm, which is not limited here.

本申请实施例中,以强化学习的迭代思想为核心,将GAN的生成器代替强化学习模型中的一个元素,为当前查询信息生成第一目标组件以到达下一个目标状态信息,利用搜索算法搜索数据库中组件并选择第二目标组件得到第一路径,再用GAN的判别器为每个第一路径打分,反馈给生成器促进生成器迭代,得到优化组件,直到生成第二路径,为数据库最终生成一条响应查询信息的完整路径。In the embodiment of the present application, with the iterative idea of reinforcement learning as the core, the GAN generator replaces an element in the reinforcement learning model, generates a first target component for the current query information to reach the next target state information, uses a search algorithm to search the components in the database and selects the second target component to obtain the first path, and then uses the GAN discriminator to score each first path, and feeds back to the generator to promote the iteration of the generator to obtain the optimized component until the second path is generated, and finally generates a complete path for the database to respond to the query information.

请参阅图5,基于图1B所示的数据库管理系统,本申请实施例中的动态选择数据库组件的方法包括:Please refer to FIG5 . Based on the database management system shown in FIG1B , the method for dynamically selecting a database component in the embodiment of the present application includes:

501、自组装管理器获取查询信息和数据库管理系统的状态信息;501. The self-assembly manager obtains query information and status information of the database management system;

本申请实施例中的自组装管理器为前述图1B对应的实施例中所描述的自组装管理器。The self-assembly manager in the embodiment of the present application is the self-assembly manager described in the embodiment corresponding to FIG. 1B .

本申请实施例中,仅以自组装管理器是由组件管理器和作业管理器集成的进行示意性说明,可以理解的是,自组装管理器执行的操作也可以是由组件管理器和作业管理器相互配合执行的。In the embodiment of the present application, the self-assembly manager is only schematically illustrated as being integrated by the component manager and the job manager. It is understandable that the operations performed by the self-assembly manager can also be performed by the component manager and the job manager in cooperation with each other.

本申请实施例中,自组装管理器通过应用程序接口接收查询信息,查询信息可以是通过特定语言描述的查询语句,比如SQL语句或指令,用于实现对数据的操作,比如新增、修改、删除、查询等等。可以理解的是,查询信息也可以是配置文件,或其他文件,具体此处不做限定。In the embodiment of the present application, the self-assembly manager receives query information through an application program interface, and the query information can be a query statement described in a specific language, such as an SQL statement or instruction, which is used to implement operations on data, such as adding, modifying, deleting, querying, etc. It can be understood that the query information can also be a configuration file or other file, which is not specifically limited here.

本申请实施例中,查询信息可以由用户通过客户端或其他设备输入,也可以由用户通过文件配置,还可以由其他系统生成,具体此处不做限定。In the embodiments of the present application, the query information may be input by a user through a client or other device, may be configured by a user through a file, or may be generated by other systems, which are not specifically limited here.

为了方便描述,结合图6进行说明:图6仅以数据库的状态信息包括数据库状态、硬件信息、网络信息和GUC参数为例进行示意性说明,可以理解的是,在实际应用中,数据库状态信息可以包括数据库状态、硬件信息、网络信息和GUC参数的至少一种。For the convenience of description, it is illustrated in conjunction with Figure 6: Figure 6 only uses the database status information including database status, hardware information, network information and GUC parameters as an example for schematic illustration. It can be understood that in actual applications, the database status information may include at least one of the database status, hardware information, network information and GUC parameters.

数据库管理系统的状态信息可以包括数据库管理系统中多个组件的负载信息,也可以包括数据库管理系统中多个组件的负载信息和数据库管理系统的性能参数(可以包括内存、CPU等负载或SQL的执行效率),其中组件的数量根据实际需要设置,可以为数据库管理系统中的所有组件,具体此处不做限定。The status information of the database management system may include the load information of multiple components in the database management system, and may also include the load information of multiple components in the database management system and the performance parameters of the database management system (which may include memory, CPU and other loads or SQL execution efficiency). The number of components is set according to actual needs and may be all components in the database management system, which is not limited here.

本申请实施例中目标状态信息可以包括SQL、语法树、执行计划和数据四个查询状态,其中SQL查询状态表示自组装管理器正在获取用户输入的查询指令。语法树查询状态表示自组装管理器正在解析查询指令为得到自然语序。执行计划查询状态表示自组装管理器正在执行自然语序。数据查询状态表示数据库通过自然语序得到响应查询指令的数据。In the embodiment of the present application, the target state information may include four query states: SQL, syntax tree, execution plan, and data, wherein the SQL query state indicates that the self-assembly manager is obtaining the query instruction input by the user. The syntax tree query state indicates that the self-assembly manager is parsing the query instruction to obtain the natural word order. The execution plan query state indicates that the self-assembly manager is executing the natural word order. The data query state indicates that the database obtains the data in response to the query instruction through the natural word order.

502、自组装管理器用GAN的生成器替换强化学习模型中的一个元素,以得到新的强化学习模型;502. The self-assembly manager replaces an element in the reinforcement learning model with the generator of the GAN to obtain a new reinforcement learning model;

利用GAN中的生成器和判别器之间的打分-反馈-优化,如图6所示:自组装管理器将GAN的生成器代替强化学习模型中的智能体,以得到新的强化学习模型。Utilizing the scoring-feedback-optimization between the generator and the discriminator in GAN, as shown in Figure 6: the self-assembly manager replaces the agent in the reinforcement learning model with the generator of GAN to obtain a new reinforcement learning model.

503、自组装管理器向新的强化学习模型输入向量化信息得到第一目标组件和第一目标组件的交互参数;503. The self-assembly manager inputs the vectorized information into the new reinforcement learning model to obtain the first target component and the interaction parameter of the first target component;

由于组件的组装是有顺序的,所以查询信息和数据库的状态信息需要经过向量化处理得到向量化信息,自组装管理器将向量化信息输入到新的强化学习模型中,得到第一目标组件和第一目标组件的交互参数,如图6所示:用户输入的查询信息结合数据库状态和负载信息,通过向量化处理并传递给生成器,生成器根据当前状态和查询请求生成一个动作(选择第一目标组件和第一目标组件的交互参数)。Since the assembly of components is sequential, the query information and the database status information need to be vectorized to obtain vectorized information. The self-assembly manager inputs the vectorized information into the new reinforcement learning model to obtain the interaction parameters between the first target component and the first target component, as shown in Figure 6: The query information input by the user is combined with the database status and load information, processed through vectorization and passed to the generator. The generator generates an action (selecting the interaction parameters between the first target component and the first target component) according to the current state and query request.

在一个实施例中,当查询信息为SQL语句时,可以将其转换成自然语言序列,交互参数包括组件之间需要传输的参数,交互参数还可以包括服务地址,具体此处不做限定。服务地址可以为了在远端点通过远程过程调用(remote procedure call,RPC)实现调用,交互参数可以包括组件之间的函数调用接口。组件之间通过消息通信服务组件实现通信。In one embodiment, when the query information is an SQL statement, it can be converted into a natural language sequence, and the interaction parameters include parameters that need to be transmitted between components. The interaction parameters can also include a service address, which is not limited here. The service address can be used to implement a call through a remote procedure call (RPC) at a remote end point, and the interaction parameters can include a function call interface between components. The components communicate through a message communication service component.

504、自组装管理器根据第一目标组件,使用搜索算法确定第一路径;504. The self-assembly manager determines a first path using a search algorithm according to the first target component;

自组装管理器确定第一目标组件后,路径还不是完整的,假设全路径是0-10,此时只有不完整的序列0-5,以及众多可选的组件{6.0,6.1,6.2,…},暂时以其中每个组件作为当前状态{0-5-6.x},之后根据经验数据随机的为第一目标组件补上后面的组件{0-5-6.x-10}。After the self-assembly manager determines the first target component, the path is not yet complete. Assume that the full path is 0-10. At this time, there is only an incomplete sequence 0-5, and many optional components {6.0, 6.1, 6.2, ...}. Temporarily, each of these components is used as the current state {0-5-6.x}, and then the following components {0-5-6.x-10} are randomly added to the first target component based on empirical data.

自组装管理器基于搜索算法搜索数据库中组件并选择第二目标组件,以确定第一路径。测试时或实际运行时数据库可以根据第一路径响应查询信息,第一路径包括第一目标组件和第一目标组件的交互参数以及除第一目标组件之外的至少一个第二目标组件。The self-assembly manager searches the components in the database based on the search algorithm and selects the second target component to determine the first path. During testing or actual runtime, the database can respond to query information according to the first path, and the first path includes the first target component and the interaction parameters of the first target component and at least one second target component other than the first target component.

可选地,在得到第一路径后,可以将第一路径中的第一目标组件和第二目标组件形成计划列表返给数据库,以便于第一目标组件和第二目标组件执行操作以响应查询信息。Optionally, after obtaining the first path, the first target component and the second target component in the first path may be formed into a plan list and returned to the database so that the first target component and the second target component can perform operations in response to the query information.

在一个实施例中,如图6所示,使用MCTS算法对当前生成的动作(第一目标组件和第一目标组件的交互参数)结合历史状态随机性的补全完成路径生成第一路径,历史状态包括数据库当前已确定的组件。In one embodiment, as shown in FIG6 , the MCTS algorithm is used to generate a first path by combining the currently generated action (the first target component and the interaction parameter of the first target component) with the random completion path of the historical state, and the historical state includes the components currently determined in the database.

505、自组装管理器获取GAN的判别器对第一路径的打分信息;505. The self-assembly manager obtains the scoring information of the first path by the discriminator of the GAN;

利用GAN中的生成器和判别器之间的打分-反馈-优化,判别器通过第一路径的性能参数对第一路径进行打分,自组装管理器获取判别器对第一路径的打分信息,第一路径的性能参数可以是第一路径执行SQL语句的效率。By utilizing the scoring-feedback-optimization between the generator and the discriminator in the GAN, the discriminator scores the first path according to the performance parameters of the first path, and the self-assembly manager obtains the scoring information of the discriminator on the first path. The performance parameters of the first path may be the efficiency of the first path in executing SQL statements.

506、若第一目标组件的得分不满足预置条件,则自组装管理器将第一目标组件的得分反馈给生成器,以使得生成器对第一目标组件进行处理,并使用处理后的第一目标组件执行步骤504至506,若第一目标组件的得分满足预置条件,则输出优化组件,并执行步骤507。506. If the score of the first target component does not meet the preset conditions, the self-assembly manager feeds back the score of the first target component to the generator so that the generator processes the first target component and uses the processed first target component to execute steps 504 to 506. If the score of the first target component meets the preset conditions, the optimized component is output and step 507 is executed.

用户可以根据需要设置预置条件,例如预置条件可以是执行SQL语句的时间为5微秒,若第一目标组件执行同样的SQL语句的时间为6微秒,自组装管理器将第一目标组件的得分反馈给生成器,生成器根据判别器的打分进行优化,直至第一目标组件执行同样的SQL语句的时间小于5微秒,则输出优化组件,并执行步骤507,优化组件为得分满足预置条件的第一目标组件,第一目标组件的得分由第一路径的打分信息经过处理后得到。The user can set preset conditions as needed. For example, the preset condition can be that the time to execute an SQL statement is 5 microseconds. If the time for the first target component to execute the same SQL statement is 6 microseconds, the self-assembly manager will feed back the score of the first target component to the generator. The generator will optimize according to the score of the discriminator until the time for the first target component to execute the same SQL statement is less than 5 microseconds. Then, the optimized component is output and step 507 is executed. The optimized component is the first target component whose score meets the preset condition. The score of the first target component is obtained by processing the scoring information of the first path.

本申请实施例中,第一目标组件的打分可以是由多个第一路径的打分信息取平均值得到,也可以取最大值,此处不做限定。In the embodiment of the present application, the score of the first target component can be obtained by taking the average of the score information of multiple first paths, or taking the maximum value, which is not limited here.

在一个实施例中,如图6所示:判别器对第一路径打分之后,取其平均值作为该动作(目标动作)的得分,若该得分满足预置条件,输出该动作(优化组件)。In one embodiment, as shown in FIG6 : after the discriminator scores the first path, the average value is taken as the score of the action (target action), and if the score meets the preset conditions, the action (optimization component) is output.

507、自组装管理器根据强化学习模型、优化组件和状态信息得到目标状态信息;507. The self-assembly manager obtains target state information according to the reinforcement learning model, the optimization component and the state information;

由强化学习模型可知,当选择第一目标组件后(动作),数据库的状态信息会发生变化(已确定的组件),变为目标状态信息,目标状态信息包括当前已确定的组件,且目标状态信息可以根据确定组件的数量进行变化。It can be seen from the reinforcement learning model that when the first target component is selected (action), the state information of the database will change (determined components) and become the target state information. The target state information includes the currently determined components, and the target state information can change according to the number of determined components.

数据库状态信息中的查询状态信息可以包括当前选择的组件数量和当前数据流的信息。The query status information in the database status information may include the number of currently selected components and information of the current data flow.

508、若所述优化组件的数量不满足预设数量,自组装管理器将目标状态信息作为状态信息执行步骤502至506,若所述优化组件的数量满足预设数量,输出第二路径。508. If the number of the optimized components does not meet the preset number, the self-assembly manager uses the target state information as the state information to execute steps 502 to 506. If the number of the optimized components meets the preset number, the second path is output.

若所述优化组件的数量不满足预设数量,自组装管理器更新状态信息,即将目标状态信息作为状态信息执行步骤502至506,继续选择下一层组件中的优化组件,若优化组件的数量满足预设数量,输出第二路径,该第二路径至少包括两个优化组件,且每个优化组件的功能不同。If the number of the optimized components does not meet the preset number, the self-assembly manager updates the state information, that is, executes steps 502 to 506 using the target state information as the state information, and continues to select the optimized components in the next layer of components. If the number of the optimized components meets the preset number, outputs a second path, which includes at least two optimized components, and each optimized component has a different function.

本申请实施例中的预设数量根据数据库管理系统中响应查询信息所需的组件个数相关,具体此处不做限定。例如,预设数量可以是为了响应查询信息以得到查询结果至少所需要的组件的数量,这些组件是响应查询信息所必需的。The preset number in the embodiment of the present application is related to the number of components required to respond to the query information in the database management system, and is not specifically limited here. For example, the preset number can be the number of components required at least to respond to the query information to obtain the query results, and these components are necessary to respond to the query information.

示例性的,数据库管理系统中响应查询信息的组件有10个,预设数量为10,即全路径是0-10(10层),每循环一次步骤502至506就选择一层的优化组件,若选择出10层中各层里的优化组件,输出第二路径,该二路径中包括10个优化组件,且每个优化组件的功能不同。Exemplarily, there are 10 components that respond to query information in the database management system, and the preset number is 10, that is, the full path is 0-10 (10 layers). Each time steps 502 to 506 are looped, an optimization component of one layer is selected. If the optimization components in each of the 10 layers are selected, the second path is output. The second path includes 10 optimization components, and the function of each optimization component is different.

509、自组装管理器根据第二路径,触发至少两个优选组件执行操作以响应查询信息。509. The self-assembly manager triggers at least two preferred components to perform operations in response to the query information according to the second path.

输出第二路径后,自组装管理器触发第二路径中的至少两个优化组件执行操作以响应查询信息。示例性的,第二路径包括10个优化组件,则自组装管理器触发这10个优化组件执行操作以响应查询信息。具体执行的操作,之后结合图8与图9针对实际情况进行描述。After outputting the second path, the self-assembly manager triggers at least two optimization components in the second path to perform operations in response to the query information. Exemplarily, if the second path includes 10 optimization components, the self-assembly manager triggers the 10 optimization components to perform operations in response to the query information. The specific operations performed will be described later in conjunction with FIG. 8 and FIG. 9 for actual situations.

下面结合图7对本申请实施例中的不同场景进行分别描述:The following describes different scenarios in the embodiment of the present application in conjunction with FIG. 7:

一、测试时的离线学习:1. Offline learning during testing:

在数据库测试阶段,根据各种典型场景,需要对查询、负载、数据进行向量化表示,让可组装的序列收敛成TOP-10路径(10个第二路径),利用最优控制论来实现自组装的初调,即每种场景(例如金融、云)选择TOP-10的组装方案,推荐给客户。During the database testing phase, according to various typical scenarios, it is necessary to vectorize queries, loads, and data so that the assembleable sequences converge into TOP-10 paths (10 second paths), and use optimal control theory to achieve initial self-assembly. That is, for each scenario (such as finance, cloud), select the TOP-10 assembly solutions and recommend them to customers.

二、开局时的部署学习:2. Deployment and learning at the beginning:

数据库开局时,根据用户真实数据和场景,在Top-10的组装方案序列中再次学习收敛出Top-3路径(3个第二路径);主要区别在于约束式学习,不用考虑Top-10之外的方案,大大提升学习收敛的速度。When the database is launched, the top-3 paths (3 second paths) are learned and converged again in the top-10 assembly solution sequence based on the user's real data and scenarios. The main difference is that it is constrained learning, and there is no need to consider solutions outside the top-10, which greatly improves the speed of learning convergence.

三、运行时的在线学习:3. Online learning at runtime:

在数据库运行时,根据用户负载和数据的实时变化在线轮转Top-3的组装方案,在Top-3的组装方案中进行微调;明确组装的过程和依据之后不断微调已有的执行计划,达到最优(1个第二路径)。When the database is running, the Top-3 assembly schemes are rotated online according to the real-time changes in user load and data, and fine-tuned in the Top-3 assembly schemes; after clarifying the assembly process and basis, the existing execution plan is continuously fine-tuned to achieve the optimal one (1 second path).

本申请实施例中的动态选择数据库组件的方法的实施场景可以有很多,仅以上面三种为例进行示意性说明,具体此处不做限定。There may be many implementation scenarios for the method of dynamically selecting a database component in the embodiment of the present application. The above three are only used as examples for schematic illustration and are not specifically limited here.

为了方便理解,下面结合图8和图9对本申请实施例中的动态选择数据库组件的方法进行说明:For ease of understanding, the method for dynamically selecting a database component in an embodiment of the present application is described below in conjunction with FIG. 8 and FIG. 9 :

请参阅图8,本申请实施例中动态选择数据库组件的方法的一个实施例:Please refer to FIG8 , which is an embodiment of a method for dynamically selecting a database component in an embodiment of the present application:

客户业务有流量高峰和低谷时间,高峰和低谷的负载大小是不一样的。利用本申请实施例的动态选择数据库组件的方法,可以根据业务负载情况,自动组装,自动调整微服务组件,满足高峰事件的业务负载。Customer services have traffic peaks and valleys, and the load sizes of peaks and valleys are different. Using the method of dynamically selecting database components in the embodiment of the present application, microservice components can be automatically assembled and adjusted according to the business load to meet the business load of peak events.

本申请实施例对于执行服务模块可以进行了更细粒度划分,包括行执行和向量执行,对于存储服务则可以划分为行存、列存和内存引擎。The embodiment of the present application can perform a more fine-grained division for the execution service module, including row execution and vector execution, and the storage service can be divided into row storage, column storage and memory engine.

公有云/私有云安装有如图7中部署学习所示对应的部署数据库服务,组件管理器中的算法进行训练收敛到如上述第二路径的应用场景中所述的TOP-3路径。The public cloud/private cloud is installed with a deployment database service corresponding to the deployment learning shown in FIG. 7 , and the algorithm in the component manager is trained to converge to the TOP-3 path as described in the application scenario of the second path above.

作业管理器接收大量查询请求。The job manager receives a large number of query requests.

由于在流量高峰下,处理可能受限于计算能力,网络传输能力等,需要确定是哪个因素成为了瓶颈,限制了性能。假设:组件管理器根据服务监控信息,确定当前集群计算能力为瓶颈点。Since processing may be limited by computing power, network transmission capacity, etc. during peak traffic, it is necessary to determine which factor has become the bottleneck and limited performance. Assumption: Based on the service monitoring information, the component manager determines that the current cluster computing capacity is the bottleneck point.

组件管理器根据如图4所示的算法,基于当前的数据库组件状态(包含每个节点的利用率,每个节点的硬件配置),生成一条利用空闲节点的路径。The component manager generates a path using idle nodes based on the algorithm shown in FIG4 and the current database component status (including the utilization of each node and the hardware configuration of each node).

组件管理器根据图4所示的算法调度空闲节点,启动SQL执行服务和GPU加速服务。The component manager schedules idle nodes according to the algorithm shown in FIG4 and starts the SQL execution service and the GPU acceleration service.

即:服务组件分布式部署多个计算节点,比如图8中的计算节点801-806,每个计算节点上部署有一个或多个服务组件,并且部署有一个组件管理器客户端832,用于管理本节点上的服务组件。That is, the service components are distributedly deployed on multiple computing nodes, such as computing nodes 801-806 in FIG. 8 , and one or more service components are deployed on each computing node, and a component manager client 832 is deployed to manage the service components on the node.

例如:计算节点801包括组件管理器客户端832以及SQL解析器和优化器服务862。计算节点802包括组件管理器客户端832以及SQL执行服务880,其中SQL执行器服务880包括行执行以及向量执行。计算节点804包括组件管理器客户端832以及SQL执行器服务880以及自监控服务888。计算节点805包括组件管理器客户端832以及存储服务882。For example, computing node 801 includes component manager client 832 and SQL parser and optimizer service 862. Computing node 802 includes component manager client 832 and SQL execution service 880, wherein SQL execution service 880 includes row execution and vector execution. Computing node 804 includes component manager client 832 and SQL execution service 880 and self-monitoring service 888. Computing node 805 includes component manager client 832 and storage service 882.

其中,组件管理器客户端832以及SQL执行器服务880也可以构成一个计算节点803。组件管理器客户端832以及存储服务882也可以构成一个计算节点806。计算节点包括的服务具体此处不做限定。The component manager client 832 and the SQL executor service 880 may also constitute a computing node 803. The component manager client 832 and the storage service 882 may also constitute a computing node 806. The services included in the computing node are not specifically limited here.

其中,SQL执行器服务880可以为行执行或向量执行。存储服务882可以为列存引擎或行存引擎。The SQL executor service 880 may be a row execution or a vector execution, and the storage service 882 may be a column storage engine or a row storage engine.

作业管理器820接收多个查询请求,并依据组件管理器831确定的执行路径,通过组件管理器客户端832调用各个计算节点上的相应服务组件进行业务处理。在业务高峰到时,若组件管理器831根据服务监控信息,确定当前系统计算为瓶颈点,则基于空闲计算节点104的硬件配置(这里假设空闲节点包含GPU),确定需要在空闲节点上开启的微服务组件,包括SQL执行器服务880和GPU加速服务898。组件管理器831向空闲节点104上的组件管理器客户端832请求启动SQL执行器服务和GPU加速服务。空闲节点104启动SQL执行器服务880和GPU加速服务898,以应对业务高峰。空闲计算节点804可以为负载低于预设值的节点,也可以为新增加的节点。The job manager 820 receives multiple query requests, and according to the execution path determined by the component manager 831, calls the corresponding service components on each computing node through the component manager client 832 to perform business processing. When the business peak arrives, if the component manager 831 determines that the current system calculation is a bottleneck point based on the service monitoring information, then based on the hardware configuration of the idle computing node 104 (here it is assumed that the idle node includes a GPU), it determines the microservice components that need to be enabled on the idle node, including the SQL executor service 880 and the GPU acceleration service 898. The component manager 831 requests the component manager client 832 on the idle node 104 to start the SQL executor service and the GPU acceleration service. The idle node 104 starts the SQL executor service 880 and the GPU acceleration service 898 to cope with the business peak. The idle computing node 804 can be a node whose load is lower than the preset value, or it can be a newly added node.

本实施例中,数据库可以同安装本申请实施例中的动态选择数据库组件的方法自动应对业务负载突发等情况,无需人工干预。In this embodiment, the database can automatically respond to business load bursts and the like by installing the method of dynamically selecting database components in the embodiment of the present application without manual intervention.

请参阅图9,本申请实施例中动态选择数据库组件的方法另一实施例:Please refer to FIG. 9 , another embodiment of the method for dynamically selecting a database component in an embodiment of the present application:

如图9所示的数据库包括查询解析服务、组件90,查询优化服务、组件91,执行引擎服务、组件92,消息通信服务、组件93,存储引擎服务、组件94。The database shown in FIG. 9 includes a query parsing service, component 90 , a query optimization service, component 91 , an execution engine service, component 92 , a message communication service, component 93 , and a storage engine service, component 94 .

其中查询解析服务、组件90包括解析器901至906;查询优化服务、组件91包括优化器911至916;执行引擎服务、组件92包括执行器921至926;消息通信服务、组件93包括传输控制协议(transmission control protocol,TCP)931,流控制传输协议(stream controltransmission protocol,SCTP)932,远程直接内存访问(remote direct memory access,RDMA)933;存储引擎服务、组件94包括存储器(行存)941和944,存储器(列存)942和945,存储器943和946。Among them, the query parsing service and component 90 include parsers 901 to 906; the query optimization service and component 91 include optimizers 911 to 916; the execution engine service and component 92 include executors 921 to 926; the message communication service and component 93 include transmission control protocol (TCP) 931, stream control transmission protocol (SCTP) 932, remote direct memory access (RDMA) 933; the storage engine service and component 94 include memory (row memory) 941 and 944, memory (column memory) 942 and 945, memory 943 and 946.

用户向数据库发送请求1,需要在分布式数据库的多个节点之间进行数据交互,汇总后进行分析。The user sends a request 1 to the database, which requires data interaction between multiple nodes of the distributed database and analysis after aggregation.

组件管理器收到请求1,运行图4的算法结合当前数据库组件状态和请求特征生成最优执行路径(第一路径),选择消息通信服务组件中的TCP服务,为请求1建立长连接。The component manager receives request 1, runs the algorithm of Figure 4 to generate the optimal execution path (first path) based on the current database component status and request characteristics, selects the TCP service in the message communication service component, and establishes a long connection for request 1.

请求1被其他节点相应之后,需要进行数据汇总搬迁,数据库生成内部的消息通信请求2,向其他节点请求数据传递。After request 1 is responded to by other nodes, data aggregation and migration are required, and the database generates internal message communication request 2 to request data transmission from other nodes.

组件管理器接收到请求2,运行算法结合当前数据库组件状态和请求特征生成最优执行路径(第二路径),选择消息通信服务组件中的RDMA服务(RDMA是一种节点间高速通信的技术,可以提供高速高宽带的通信服务),进行大量的数据传输。The component manager receives request 2, runs an algorithm to generate the optimal execution path (the second path) based on the current database component status and request characteristics, selects the RDMA service in the message communication service component (RDMA is a technology for high-speed communication between nodes that can provide high-speed and high-bandwidth communication services), and performs large-scale data transmission.

本申请实施例中通过请求特征可以确定TCP还是RDMA,行存存储器还是列存存储器。In the embodiment of the present application, TCP or RDMA, row memory or column memory can be determined by request characteristics.

本实施例,根据请求的不同特征,灵活选择了通信服务,通过建立长连接维护用户请求交互,通过高速网络进行数据传输,避免了通信网络可能出现的输入输出IO拥塞。In this embodiment, the communication service is flexibly selected according to the different characteristics of the request, and the user request interaction is maintained by establishing a long connection. Data is transmitted through a high-speed network, thereby avoiding possible input and output IO congestion of the communication network.

上面对本申请实施例中动态选择数据库组件的方法进行了描述,下面对本申请实施例中的自组装管理器进行描述,请参阅图10,本申请实施例中自组装管理器一个实施例包括:The above describes the method for dynamically selecting a database component in the embodiment of the present application. The following describes the self-assembly manager in the embodiment of the present application. Please refer to FIG. 10. An embodiment of the self-assembly manager in the embodiment of the present application includes:

获取单元1001,用于获取查询信息和数据库管理系统的状态信息,状态信息包括数据库管理系统中各个组件的负载信息。The acquisition unit 1001 is used to acquire query information and status information of the database management system, where the status information includes load information of each component in the database management system.

第一处理单元1002,用于根据强化学习模型和向量化信息得到第一目标组件和第一目标组件的交互参数,向量化信息由查询信息和状态信息经过向量化处理后得到,交互参数包括第一目标组件与第二目标组件之间需要传输的参数和服务地址。The first processing unit 1002 is used to obtain the interaction parameters between the first target component and the second target component according to the reinforcement learning model and the vectorized information. The vectorized information is obtained by vectorizing the query information and the state information. The interaction parameters include the parameters and service addresses that need to be transmitted between the first target component and the second target component.

确定单元1003,用于根据第一目标组件,使用搜索算法确定第一路径,第一路径至少包括一个第一目标组件和一个第二目标组件,第一目标组件和第二目标组件的功能不同。The determining unit 1003 is used to determine a first path using a search algorithm according to the first target component, wherein the first path includes at least a first target component and a second target component, and the first target component and the second target component have different functions.

本实施例中,自组装管理器中各单元所执行的操作与前述图5所示实施例中描述的类似,此处不再赘述。In this embodiment, the operations performed by each unit in the self-assembly manager are similar to those described in the embodiment shown in FIG. 5 , and will not be described in detail here.

本实施例中,第一处理单元1002根据强化学习模型和向量化信息得到第一目标组件,确定单元1003再使用搜索算法确定第一路径,可以根据获取单元1001获取的查询信息自动选择相应的组件来运行查询信息,可以灵活应对不同业务场景,并提高执行效率。In this embodiment, the first processing unit 1002 obtains the first target component according to the reinforcement learning model and the vectorized information, and the determination unit 1003 then uses the search algorithm to determine the first path. It can automatically select the corresponding component to run the query information according to the query information obtained by the acquisition unit 1001, and can flexibly respond to different business scenarios and improve execution efficiency.

请参阅图11,本申请实施例中自组装管理器另一实施例包括:Please refer to FIG. 11 , another embodiment of the self-assembly manager in the embodiment of the present application includes:

获取单元1101,用于获取查询信息和数据库的状态信息,状态信息包括数据库中各个组件的负载信息。The acquisition unit 1101 is used to acquire query information and database status information, where the status information includes load information of each component in the database.

第一处理单元1102,用于根据强化学习模型和向量化信息得到至少一个第一目标组件和第一目标组件的交互参数,向量化信息由查询信息和状态信息经过向量化处理后得到,交互参数包括第一目标组件与第二目标组件之间需要传输的参数和服务地址。The first processing unit 1102 is used to obtain interaction parameters between at least one first target component and the second target component according to the reinforcement learning model and vectorized information, the vectorized information is obtained by vectorizing the query information and the state information, and the interaction parameters include parameters and service addresses that need to be transmitted between the first target component and the second target component.

确定单元1103,用于基于搜索算法搜索数据库中组件并选择第二目标组件,以得到第一路径,以使得数据库根据第一路径响应查询信息,第一路径至少包括一个第一目标组件和一个第二目标组件,第一目标组件和第二目标组件的功能不一样。The determination unit 1103 is used to search the components in the database based on the search algorithm and select the second target component to obtain the first path, so that the database responds to the query information according to the first path. The first path includes at least a first target component and a second target component, and the functions of the first target component and the second target component are different.

第一处理单元1102具体用于将GAN的生成器代替强化学习模型中的一个元素,以得到新的强化学习模型;向新的强化学习模型输入向量化信息得到第一目标组件和第一目标组件的交互参数。The first processing unit 1102 is specifically used to replace an element in the reinforcement learning model with the generator of the GAN to obtain a new reinforcement learning model; input vectorized information into the new reinforcement learning model to obtain the first target component and the interaction parameter of the first target component.

获取单元1101还用于获取GAN的判别器对第一路径的打分信息,打分信息与第一路径的性能参数相关。The acquisition unit 1101 is further used to obtain scoring information of the GAN discriminator on the first path, where the scoring information is related to the performance parameters of the first path.

本实施例中的自组装管理器还包括:The self-assembly manager in this embodiment also includes:

第一触发单元1105,用于若第一目标组件的得分不满足预置条件,则将第一目标组件的得分反馈给生成器,以使得生成器对第一目标组件进行处理以得到处理后的第一目标组件,基于处理后的第一目标组件触发第一处理单元1102和第一触发单元1105执行相应的操作,若得分满足预置条件,则输出优化组件,并触发第二处理单元1104执行相应操作,优化组件为得分满足预置条件的第一目标组件,第一目标组件的得分由打分信息经过处理后得到。The first trigger unit 1105 is used to feed back the score of the first target component to the generator if the score of the first target component does not meet the preset conditions, so that the generator processes the first target component to obtain a processed first target component, and triggers the first processing unit 1102 and the first trigger unit 1105 to perform corresponding operations based on the processed first target component. If the score meets the preset conditions, the optimization component is output and the second processing unit 1104 is triggered to perform corresponding operations. The optimization component is the first target component whose score meets the preset conditions, and the score of the first target component is obtained after processing the scoring information.

第二处理单元1104,用于根据强化学习模型、优化组件和状态信息得到目标状态信息,目标状态信息包括已确定的组件信息和查询状态信息。The second processing unit 1104 is used to obtain target state information according to the reinforcement learning model, the optimization components and the state information, where the target state information includes the determined component information and the query state information.

第二触发单元1106,用于若所述优化组件的数量不满足预设数量,将目标状态信息作为状态信息触发第一处理单元1102、确定单元1103以及第一触发单元1105执行相应的操作,若所述优化组件的数量满足预设数量,输出第二路径,第二路径至少包括两个优化组件,每个优化组件的功能不一样。The second trigger unit 1106 is used to trigger the first processing unit 1102, the determination unit 1103 and the first trigger unit 1105 to perform corresponding operations using the target state information as state information if the number of the optimization components does not meet the preset number, and output a second path if the number of the optimization components meets the preset number. The second path includes at least two optimization components, and each optimization component has a different function.

响应触发单元1107,用于根据第二路径,触发至少两个优化组件执行操作以响应查询信息。The response triggering unit 1107 is used to trigger at least two optimization components to perform operations in response to the query information according to the second path.

本实施例中,自组装管理器中各单元所执行的操作与前述图5所示实施例中描述的类似,此处不再赘述。In this embodiment, the operations performed by each unit in the self-assembly manager are similar to those described in the embodiment shown in FIG. 5 , and will not be described in detail here.

本实施例中,第一处理单元1102根据强化学习模型和向量化信息得到第一目标组件,确定单元1103再利用搜索算法选择第二目标组件,以得到第一路径,根据第一触发单元1105选择出第一目标组件中满足预置条件的优化组件,若所述优化组件的数量不满足预设数量,再根据第二触发单元1106将目标状态信息作为状态信息触发第一处理单元1102、确定单元1103以及第一触发单元1105执行相应的操作,直到优化组件的数量满足预设数量,输出第二路径,以使得响应触发单元1107根据第二路径,触发至少两个优化组件执行操作以响应查询信息,可以根据获取单元1101获取的查询信息和数据库的状态信息自动选择满足预置条件的优化组件执行操作响应查询信息,可以灵活应对不同业务场景,并提高执行效率。In this embodiment, the first processing unit 1102 obtains the first target component according to the reinforcement learning model and the vectorized information, and the determination unit 1103 selects the second target component by using the search algorithm to obtain the first path, and selects the optimization component that meets the preset conditions in the first target component according to the first trigger unit 1105. If the number of the optimization components does not meet the preset number, the second trigger unit 1106 uses the target state information as the state information to trigger the first processing unit 1102, the determination unit 1103 and the first trigger unit 1105 to perform corresponding operations until the number of optimization components meets the preset number, and outputs the second path, so that the response trigger unit 1107 triggers at least two optimization components to perform operations in response to the query information according to the second path. The optimization component that meets the preset conditions can be automatically selected to perform operations in response to the query information according to the query information obtained by the acquisition unit 1101 and the state information of the database, which can flexibly respond to different business scenarios and improve execution efficiency.

下面对本申请实施例中的自组装管理器进行描述,请参阅图12,本申请实施例中自组装管理器一个实施例包括:The following describes the self-assembly manager in the embodiment of the present application. Please refer to FIG. 12. An embodiment of the self-assembly manager in the embodiment of the present application includes:

该自组装管理器1200可以包括一个或一个以上处理器(central processingunits,CPU)1201和存储器1205,该存储器1205中存储有一个或一个以上的应用程序或数据。The self-assembly manager 1200 may include one or more processors (central processing units, CPU) 1201 and a memory 1205 , wherein the memory 1205 stores one or more application programs or data.

其中,存储器1205可以是易失性存储或持久存储。存储在存储器1205的程序可以包括一个或一个以上模块,每个模块可以对自组装管理器中的一系列指令操作。更进一步地,处理器1201可以设置为与存储器1205通信,在自组装管理器1200上执行存储器1205中的一系列指令操作。The memory 1205 may be a volatile storage or a persistent storage. The program stored in the memory 1205 may include one or more modules, each of which may operate on a series of instructions in the self-assembly manager. Furthermore, the processor 1201 may be configured to communicate with the memory 1205 and execute a series of instruction operations in the memory 1205 on the self-assembly manager 1200.

自组装管理器1200还可以包括一个或一个以上电源1202,一个或一个以上有线或无线网络接口1203,一个或一个以上输入输出接口1204,和/或,一个或一个以上操作系统,例如Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM等。The self-assembly manager 1200 may also include one or more power supplies 1202, one or more wired or wireless network interfaces 1203, one or more input and output interfaces 1204, and/or, one or more operating systems, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

该处理器1201可以执行前述图5所示实施例中自组装管理器所执行的操作,具体此处不再赘述。The processor 1201 can execute the operations executed by the self-assembly manager in the embodiment shown in FIG. 5 , and the details are not repeated here.

图13示出了本申请实施例提供的一种数据库系统的示意图,该数据库系统是采用共享磁盘(Shared-storage)架构的集群数据库系统,包括多个计算节点(如图13中的节点1-N),每个节点部署有一个或多个数据库微服务组件,如前述实施例中的解析器服务、优化器服务、执行器服务、存储引擎服务、元数据服务、统计服务、自监控服务和时钟服务等等。按照特定顺序被调度执行的多个微服务组件构成一条执行路径,可以实现数据库管理系统的功能,以为用户提供数据的查询和修改等服务。组件管理器用于管理系统中的所有微服务组件。具体地,组件管理器负责微服务组件的注册和注销,维护有微服务组件的元数据,元数据包括但不限于:数据库系统当前可用的微服务组件信息,以及每个微服务组件的部署位置(比如所在计算节点的ID)。FIG13 shows a schematic diagram of a database system provided by an embodiment of the present application, which is a cluster database system using a shared-storage architecture, including multiple computing nodes (such as nodes 1-N in FIG13), each node is deployed with one or more database microservice components, such as the parser service, optimizer service, executor service, storage engine service, metadata service, statistics service, self-monitoring service and clock service in the aforementioned embodiment, etc. A plurality of microservice components that are scheduled for execution in a specific order constitute an execution path, which can realize the function of a database management system to provide users with services such as query and modification of data. The component manager is used to manage all microservice components in the system. Specifically, the component manager is responsible for the registration and deregistration of microservice components, and maintains metadata of microservice components, including but not limited to: information about microservice components currently available in the database system, and the deployment location of each microservice component (such as the ID of the computing node where it is located).

进一步地,组件管理器可以基于系统可用的微服务组件,生成一条或多条执行路径。比如,组件管理器可以生成最优执行路径和次优执行路径,或者生成TOP-N的执行路径。其中次优执行路径作为备选路径。相应地,作业管理器接收客户端提交的查询,依照组件管理器生成的最优执行路径来调用多个数据库微服务组件对查询进行处理,以得到查询结果,然后将查询结果返回给客户端。当最优执行路径中有微服务组件发生错误时,依照备选执行路径,调用多个微服务组件对所述查询进行处理。Furthermore, the component manager can generate one or more execution paths based on the microservice components available in the system. For example, the component manager can generate an optimal execution path and a suboptimal execution path, or generate a TOP-N execution path. The suboptimal execution path is used as an alternative path. Accordingly, the job manager receives the query submitted by the client, calls multiple database microservice components to process the query according to the optimal execution path generated by the component manager to obtain the query result, and then returns the query result to the client. When an error occurs in a microservice component in the optimal execution path, multiple microservice components are called to process the query according to the alternative execution path.

在一个实施例中,当系统中某个微服务组件的负载较高时,例如该微服务组件执行的任务数量超过设定阈值时,组件管理器可以在空闲计算节点上启动一个或多个该微服务组件的备份,其中,微服务组件的备份可以视为是微服务组件的实例,与该微服务组件的功能相同。作业管理器通过调用该微服务组件的备份来分担该微服务组件的负载,以提高系统的可用性。也就是说,组件管理器可以基于系统的负载来动态调整微服务组件,并调整执行路径。In one embodiment, when the load of a microservice component in the system is high, for example, when the number of tasks executed by the microservice component exceeds a set threshold, the component manager can start one or more backups of the microservice component on an idle computing node, wherein the backup of the microservice component can be regarded as an instance of the microservice component, which has the same function as the microservice component. The job manager shares the load of the microservice component by calling the backup of the microservice component to improve the availability of the system. In other words, the component manager can dynamically adjust the microservice component based on the load of the system and adjust the execution path.

在一个实施例中,计算节点之间通过无限带宽InfiniBand网络通信。共享数据存储器中存储有可被多个计算节点访问的共享数据。计算节点通过交换机对共享数据存储器中的数据执行读写操作。共享数据存储器可以为共享磁盘阵列或云存储等。计算节点可以为物理机,比如数据库服务器,也可以为运行在抽象硬件资源上的虚拟机。若节点为物理机,则交换机为存储区网络(Storage Area Network,SAN)交换机、以太网交换机,光纤交换机或其它物理交换设备。若节点为虚拟机,则交换机为虚拟交换机。In one embodiment, computing nodes communicate with each other via an infinite bandwidth InfiniBand network. A shared data memory stores shared data that can be accessed by multiple computing nodes. The computing nodes perform read and write operations on the data in the shared data memory through a switch. The shared data memory can be a shared disk array or cloud storage, etc. The computing node can be a physical machine, such as a database server, or a virtual machine running on abstract hardware resources. If the node is a physical machine, the switch is a storage area network (SAN) switch, an Ethernet switch, a fiber switch or other physical switching device. If the node is a virtual machine, the switch is a virtual switch.

图14为采用无共享(Shared-nothing)架构的集群数据库系统示意图。根据图14,每个计算节点具有各自独享的硬件资源(如数据存储器)、操作系统和数据库,节点之间通过高速网络来通信。该架构下,数据将根据数据库模型和应用特点被分配到各个节点上,查询任务将被分割成若干部分,在所有节点上并行执行,彼此协同计算,作为整体提供数据库服务,所有通信功能都在一个高宽带网络互联体系上实现。每个节点上部署有一个或多个数据库微服务组件,如前述实施例中的解析器服务、优化器服务、执行器服务、存储引擎服务、元数据服务、统计服务、自监控服务和时钟服务等等。每个节点在处理查询任务时,可以通过作业管理器调用位于其他计算节点的微服务组件来协助进行查询处理。数据存储器(Data Store)包括但不限于固态硬盘(SSD)、磁盘阵列或其他类型的非瞬态计算机可读介质。FIG. 14 is a schematic diagram of a cluster database system using a shared-nothing architecture. According to FIG. 14 , each computing node has its own exclusive hardware resources (such as data storage), operating system and database, and the nodes communicate through a high-speed network. Under this architecture, data will be allocated to each node according to the database model and application characteristics, and the query task will be divided into several parts, executed in parallel on all nodes, and calculated in coordination with each other to provide database services as a whole, and all communication functions are implemented on a high-bandwidth network interconnection system. One or more database microservice components are deployed on each node, such as the parser service, optimizer service, executor service, storage engine service, metadata service, statistics service, self-monitoring service and clock service in the aforementioned embodiment. When processing a query task, each node can call the microservice components located in other computing nodes through the job manager to assist in query processing. The data storage device (Data Store) includes but is not limited to a solid-state hard disk (SSD), a disk array or other types of non-transient computer-readable media.

如同图13所描述的共享磁盘架构的集群数据库系统一样,这里的计算节点既可以是物理机,也可以是虚拟机。Just like the cluster database system with a shared disk architecture described in FIG. 13 , the computing nodes here can be either physical machines or virtual machines.

需要说明的是,图13和14所示的数据库系统中,微服务组件、作业管理器和组件管理器的具体功能及工作流程可以参照前述相关的实施例,此处不再赘述。It should be noted that in the database system shown in Figures 13 and 14, the specific functions and workflows of the microservice components, job manager and component manager can refer to the aforementioned related embodiments and will not be repeated here.

所属领域的技术人员可以理解一个数据库系统可能包括比图13和图14中所示的部件更少或更多的组件,或者包括与图13或图14中所示组件不同的组件,图13和图14仅仅示出了与本申请实施例所公开的实现方式更加相关的组件。例如,虽然图13和图14中描述了4个计算节点,但所属领域的技术人员可理解成一个集群数据库系统可包含任何数量的节点。各节点的数据库管理系统功能可分别由运行在各节点上的软件、硬件和/或固件的适当组合来实现。Those skilled in the art will appreciate that a database system may include fewer or more components than those shown in FIG. 13 and FIG. 14, or may include components different from those shown in FIG. 13 or FIG. 14, and FIG. 13 and FIG. 14 merely illustrate components that are more relevant to the implementation disclosed in the embodiments of the present application. For example, although four computing nodes are described in FIG. 13 and FIG. 14, those skilled in the art will appreciate that a cluster database system may include any number of nodes. The database management system functions of each node may be implemented by an appropriate combination of software, hardware, and/or firmware running on each node.

在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,read-onlymemory)、随机存取存储器(RAM,random access memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk and other media that can store program code.

Claims (11)

1.一种数据库管理系统中动态选择组件的方法,其特征在于,包括:1. A method for dynamically selecting components in a database management system, comprising: 步骤1、获取查询信息和数据库管理系统的状态信息,所述查询信息包括数据查询语句,所述状态信息包括所述数据库管理系统中多个组件的负载信息;Step 1: Acquire query information and status information of a database management system, wherein the query information includes a data query statement, and the status information includes load information of multiple components in the database management system; 步骤2、根据强化学习模型和向量化信息得到第一目标组件和所述第一目标组件的交互参数,所述向量化信息由所述查询信息和所述状态信息经过向量化处理后得到,所述交互参数包括所述第一目标组件与其他组件之间需要传输的参数;Step 2: Obtain interaction parameters between the first target component and the first target component according to the reinforcement learning model and the vectorized information, wherein the vectorized information is obtained by vectorizing the query information and the state information, and the interaction parameters include parameters that need to be transmitted between the first target component and other components; 步骤3、根据所述第一目标组件,使用搜索算法确定第一路径,所述第一路径指示包括所述第一目标组件和至少一个第二目标组件的组件序列,所述第一目标组件和所述第二目标组件的功能不同;其中,所述根据所述第一目标组件,使用搜索算法确定第一路径,包括:根据经验数据随机的为所述第一目标组件补上后面的组件;基于所述搜索算法搜索数据库中组件以得到所述第二目标组件,以确定所述第一路径;Step 3: Determine a first path using a search algorithm according to the first target component, wherein the first path indicates a component sequence including the first target component and at least one second target component, and the first target component and the second target component have different functions; wherein determining the first path using a search algorithm according to the first target component comprises: randomly supplementing the first target component with the following components according to empirical data; searching for components in a database based on the search algorithm to obtain the second target component, so as to determine the first path; 步骤4、获取生成对抗网络GAN的判别器对所述第一路径的打分信息,所述打分信息与所述第一路径的性能参数相关;Step 4: Obtain scoring information of the first path by a discriminator of a generative adversarial network (GAN), wherein the scoring information is related to a performance parameter of the first path; 步骤5、若所述第一目标组件的得分不满足预置条件,则将所述第一目标组件的得分反馈给所述GAN的生成器,以使得所述生成器对所述第一目标组件进行处理以得到处理后的第一目标组件,基于所述处理后的第一目标组件执行步骤3至5;若所述得分满足预置条件,则输出优化组件,并执行步骤6,所述优化组件为得分满足所述预置条件的所述第一目标组件或所述处理后的第一目标组件;所述第一目标组件的得分由所述打分信息经过处理后得到;Step 5: If the score of the first target component does not meet the preset condition, the score of the first target component is fed back to the generator of the GAN, so that the generator processes the first target component to obtain a processed first target component, and performs steps 3 to 5 based on the processed first target component; if the score meets the preset condition, an optimized component is output, and step 6 is performed, where the optimized component is the first target component whose score meets the preset condition or the processed first target component; the score of the first target component is obtained by processing the scoring information; 步骤6、根据所述强化学习模型、所述优化组件和所述状态信息得到目标状态信息,所述目标状态信息包括所述优化组件的信息和查询状态信息;Step 6: Obtain target state information according to the reinforcement learning model, the optimization component and the state information, wherein the target state information includes information of the optimization component and query state information; 步骤7、若所述优化组件的数量不满足预设数量,将所述目标状态信息作为所述状态信息重复执行步骤2至5,若所述优化组件的数量满足所述预设数量,输出第二路径,所述第二路径至少包括两个所述优化组件,每个所述优化组件的功能不同;Step 7: If the number of the optimization components does not meet the preset number, repeat steps 2 to 5 using the target state information as the state information; if the number of the optimization components meets the preset number, output a second path, where the second path includes at least two optimization components, each of which has a different function; 根据所述第二路径,触发至少两个所述优化组件响应所述查询信息。According to the second path, at least two of the optimization components are triggered to respond to the query information. 2.根据权利要求1所述的方法,其特征在于,所述根据强化学习模型和向量化信息得到第一目标组件和所述第一目标组件的交互参数包括:2. The method according to claim 1, characterized in that the step of obtaining the interaction parameters between the first target component and the first target component according to the reinforcement learning model and the vectorized information comprises: 根据强化学习模型、生成对抗网络GAN和向量化信息得到第一目标组件和所述第一目标组件的交互参数。The interaction parameters of the first target component and the first target component are obtained according to the reinforcement learning model, the generative adversarial network GAN and the vectorized information. 3.根据权利要求2所述的方法,其特征在于,根据强化学习模型、生成对抗网络GAN和向量化信息得到第一目标组件和所述第一目标组件的交互参数包括:3. The method according to claim 2, characterized in that obtaining the interaction parameters of the first target component and the first target component according to the reinforcement learning model, the generative adversarial network GAN and the vectorized information comprises: 用所述GAN的生成器替换所述强化学习模型中的一个元素,以得到新的强化学习模型;Replacing an element in the reinforcement learning model with the generator of the GAN to obtain a new reinforcement learning model; 向所述新的强化学习模型输入所述向量化信息得到所述第一目标组件和所述第一目标组件的交互参数。The vectorized information is input into the new reinforcement learning model to obtain the interaction parameters between the first target component and the first target component. 4.根据权利要求1至3中任一项所述的方法,其特征在于,所述搜索算法为蒙特卡洛树搜索算法。4 . The method according to claim 1 , wherein the search algorithm is a Monte Carlo tree search algorithm. 5.一种自组装管理器,其特征在于,包括:5. A self-assembly manager, comprising: 获取单元,用于获取查询信息和数据库管理系统的状态信息,所述查询信息包括数据查询语句,所述状态信息包括所述数据库管理系统中多个组件的负载信息;An acquisition unit, used to acquire query information and status information of a database management system, wherein the query information includes a data query statement, and the status information includes load information of multiple components in the database management system; 第一处理单元,用于根据强化学习模型和向量化信息得到第一目标组件和所述第一目标组件的交互参数,所述向量化信息由所述查询信息和所述状态信息经过向量化处理后得到,所述交互参数包括所述第一目标组件与其他组件之间需要传输的参数;A first processing unit, configured to obtain interaction parameters between a first target component and the first target component according to a reinforcement learning model and vectorized information, wherein the vectorized information is obtained by vectorizing the query information and the state information, and the interaction parameters include parameters that need to be transmitted between the first target component and other components; 确定单元,用于根据所述第一目标组件,使用搜索算法确定第一路径,所述第一路径指示包括所述第一目标组件和至少一个第二目标组件的组件序列,所述第一目标组件和所述第二目标组件的功能不同;a determining unit, configured to determine a first path using a search algorithm according to the first target component, wherein the first path indicates a component sequence including the first target component and at least one second target component, and the first target component and the second target component have different functions; 所述确定单元,具体用于根据经验数据随机的为所述第一目标组件补上后面的组件;基于所述搜索算法搜索数据库中组件以得到所述第二目标组件,以确定所述第一路径;The determining unit is specifically configured to randomly add the following components to the first target component according to empirical data; search the components in the database based on the search algorithm to obtain the second target component, so as to determine the first path; 所述获取单元还用于获取生成对抗网络GAN的判别器对所述第一路径的打分信息,所述打分信息与所述第一路径的性能参数相关;The acquisition unit is further used to obtain scoring information of the first path by a discriminator of a generative adversarial network (GAN), wherein the scoring information is related to a performance parameter of the first path; 所述自组装管理器还包括:The self-assembly manager also includes: 第一触发单元,用于若所述第一目标组件的得分不满足预置条件,则将所述第一目标组件的得分反馈给所述GAN的生成器,以使得所述生成器对所述第一目标组件进行处理以得到处理后的第一目标组件,基于所述处理后的第一目标组件触发所述第一处理单元和所述第一触发单元执行相应的操作,若所述得分满足预置条件,则输出优化组件,并触发第二处理单元执行相应操作,所述优化组件为得分满足所述预置条件的第一目标组件或所述处理后的第一目标组件,所述第一目标组件的得分由所述打分信息经过处理后得到;A first triggering unit is configured to feed back the score of the first target component to the generator of the GAN if the score of the first target component does not meet the preset condition, so that the generator processes the first target component to obtain a processed first target component, trigger the first processing unit and the first triggering unit to perform corresponding operations based on the processed first target component, and output an optimization component if the score meets the preset condition, and trigger the second processing unit to perform a corresponding operation, wherein the optimization component is the first target component whose score meets the preset condition or the processed first target component, and the score of the first target component is obtained by processing the scoring information; 第二处理单元,用于根据所述强化学习模型、所述优化组件和所述状态信息得到目标状态信息,所述目标状态信息包括所述优化组件的信息和查询状态信息;A second processing unit, configured to obtain target state information according to the reinforcement learning model, the optimization component and the state information, wherein the target state information includes information of the optimization component and query state information; 第二触发单元,用于若所述优化组件的数量不满足预设数量,将所述目标状态信息作为所述状态信息触发所述第一处理单元、所述确定单元以及所述第一触发单元执行相应的操作,若所述优化组件的数量满足所述预设数量,输出第二路径,所述第二路径至少包括两个所述优化组件,每个所述优化组件的功能不一样;a second triggering unit, configured to, if the number of the optimization components does not meet the preset number, use the target state information as the state information to trigger the first processing unit, the determination unit, and the first triggering unit to perform corresponding operations, and, if the number of the optimization components meets the preset number, output a second path, wherein the second path includes at least two of the optimization components, and each of the optimization components has a different function; 响应触发单元,用于根据所述第二路径,触发至少两个所述优化组件响应所述查询信息。A response triggering unit is used to trigger at least two of the optimization components to respond to the query information according to the second path. 6.根据权利要求5所述的自组装管理器,其特征在于,所述第一处理单元具体用于根据强化学习模型、生成对抗网络GAN和向量化信息得到第一目标组件和所述第一目标组件的交互参数。6. The self-assembly manager according to claim 5 is characterized in that the first processing unit is specifically used to obtain the interaction parameters between the first target component and the first target component according to the reinforcement learning model, the generative adversarial network GAN and the vectorized information. 7.根据权利要求6所述的自组装管理器,其特征在于,所述第一处理单元具体用于用所述GAN的生成器替换所述强化学习模型中的一个元素,以得到新的强化学习模型;向所述新的强化学习模型输入所述向量化信息得到所述第一目标组件和所述第一目标组件的交互参数。7. The self-assembly manager according to claim 6 is characterized in that the first processing unit is specifically used to replace an element in the reinforcement learning model with the generator of the GAN to obtain a new reinforcement learning model; and input the vectorized information into the new reinforcement learning model to obtain the first target component and the interaction parameters of the first target component. 8.根据权利要求5-7中任一项所述的自组装管理器,其特征在于,所述搜索算法为蒙特卡洛树搜索算法。8. The self-assembly manager according to any one of claims 5 to 7, wherein the search algorithm is a Monte Carlo tree search algorithm. 9.一种自组装管理器,其特征在于,包括:9. A self-assembly manager, comprising: 处理器、存储器、总线、输入输出设备;Processor, memory, bus, input and output devices; 所述处理器与所述存储器、所述输入输出设备相连;The processor is connected to the memory and the input and output device; 所述总线分别连接所述处理器、所述存储器以及所述输入输出设备相连;The bus is respectively connected to the processor, the memory and the input and output devices; 所述处理器执行如权利要求1至4中任一项所述的方法。The processor executes the method according to any one of claims 1 to 4. 10.一种计算机存储介质,其特征在于,所述计算机存储介质中存储有指令,所述指令在计算机上执行时,使得所述计算机执行如权利要求1至4中任一项所述的方法。10. A computer storage medium, characterized in that instructions are stored in the computer storage medium, and when the instructions are executed on a computer, the computer executes the method according to any one of claims 1 to 4. 11.一种计算机程序产品,其特征在于,所述计算机程序产品在计算机上执行时,使得所述计算机执行如权利要求1至4中任一项所述的方法。11. A computer program product, characterized in that when the computer program product is executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 4.
CN201911423460.4A 2019-12-31 2019-12-31 A method for dynamically selecting database components and a self-assembling database management system Active CN113127441B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911423460.4A CN113127441B (en) 2019-12-31 2019-12-31 A method for dynamically selecting database components and a self-assembling database management system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911423460.4A CN113127441B (en) 2019-12-31 2019-12-31 A method for dynamically selecting database components and a self-assembling database management system

Publications (2)

Publication Number Publication Date
CN113127441A CN113127441A (en) 2021-07-16
CN113127441B true CN113127441B (en) 2024-08-09

Family

ID=76769812

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911423460.4A Active CN113127441B (en) 2019-12-31 2019-12-31 A method for dynamically selecting database components and a self-assembling database management system

Country Status (1)

Country Link
CN (1) CN113127441B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113779029A (en) * 2021-09-06 2021-12-10 中国银行股份有限公司 Data query method and device
CN119718399A (en) * 2023-09-28 2025-03-28 中兴通讯股份有限公司 Method and system for assembling software version

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7974967B2 (en) * 2008-04-15 2011-07-05 Sap Ag Hybrid database system using runtime reconfigurable hardware
CN101739451A (en) * 2009-12-03 2010-06-16 南京航空航天大学 Joint query adaptive processing method for grid database
CN105959138B (en) * 2016-04-29 2019-05-17 深圳大数点科技有限公司 The system and method for micro services Dynamical Deployment based on cloud computing
US10635670B2 (en) * 2016-09-23 2020-04-28 Sap Se Integration of query processing engines in a distributed database system
CN107463702A (en) * 2017-08-16 2017-12-12 中科院成都信息技术股份有限公司 A kind of database multi-join query optimization method based on evolution algorithm
US11176128B2 (en) * 2018-05-15 2021-11-16 International Business Machines Corporation Multiple access path selection by machine learning
CN110516142A (en) * 2019-08-29 2019-11-29 深圳前海微众银行股份有限公司 Data query method, device, equipment and medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
XuanYuan: An AI-Native Database;Guoliang Li等;IEEE Computer Society Bulletin of the Technical Committee on Data Engineering;第42卷(第2期);第70-81页 *

Also Published As

Publication number Publication date
CN113127441A (en) 2021-07-16

Similar Documents

Publication Publication Date Title
US12032572B2 (en) Microservice component-based database system and related method
US8943103B2 (en) Improvements to query execution in a parallel elastic database management system
US11379492B2 (en) Internal resource provisioning in database systems
EP2932370B1 (en) System and method for performing a transaction in a massively parallel processing database
US20120096103A1 (en) Location updates for a distributed data store
US12292899B2 (en) Method for scheduling multi-node cluster of K-DB database, device, and medium thereof
CN103617276A (en) Method for storing distributed hierarchical RDF data
CN113127441B (en) A method for dynamically selecting database components and a self-assembling database management system
Fang et al. Integrating workload balancing and fault tolerance in distributed stream processing system
CN115562676B (en) Triggering method of graph calculation engine
CN115237885A (en) Parameter adjustment method and device for data storage system
Chao et al. Accelerating apache hive with mpi for data warehouse systems
US11907255B2 (en) Access-frequency-based entity replication techniques for distributed property graphs with schema
Dai et al. GraphTrek: asynchronous graph traversal for property graph-based metadata management
Reinefeld et al. A scalable, transactional data store for future internet services
Gog Dron: An Integration Job Scheduler
Wang et al. The optimization of parallel frequent pattern growth algorithm based on mahout in cloud manufacturing environment
Kakantousis Scaling yarn: A distributed resource manager for hadoop
Zhao et al. An Overview of the NoSQL World.
Ni Comparative Evaluation of Spark andStratosphere

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载