Processing engine selection method and device, computer equipment and storage medium

By receiving database access statements and automatically selecting and updating processing engines according to their types, the problems of resource waste and low efficiency in big data processing are solved, and more efficient utilization of computing resources is achieved.

CN118708608APending Publication Date: 2024-09-27SUZHOU LANGDONG NET TEC CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411027311.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-30
Publication Date
2024-09-27

AI Technical Summary

Technical Problem

In the process of big data processing, users need to choose an appropriate processing engine. Using an inappropriate engine will lead to a waste of computing resources and reduced efficiency.

Method used

By receiving database access statements, obtain keywords to determine the statement type, and send it to the corresponding processing engine according to the statement type, monitor the engine running status, automatically update to other engines according to the preset engine stability sequence in case of failure, and optimize the syntax tree to adapt New engine.

Benefits of technology

It improves query efficiency, reduces resource waste, rationally utilizes computing resources, and improves the overall efficiency of data processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118708608A
    Figure CN118708608A
Patent Text Reader

Abstract

The invention relates to a selection method of a processing engine. The method comprises the following steps: receiving a database access statement; obtaining keywords in the database access statement, and determining the type of the database access statement based on the keywords in the database access statement; sending the database access statement to a corresponding first processing engine based on the type of the database access statement; and monitoring the running state of a first processing engine, performing updating processing according to a preset engine stability sequence under the condition that the first processing engine fails, and updating the first processing engine into a second processing engine. The method can improve the processing efficiency and save resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of big data processing, and in particular to a method, device, computer equipment, and storage medium for selecting a processing engine. Background Art

[0002] In the process of big data analysis, from the beginning, queries could only be performed through the clients of each processing engine, but now it has developed to be integrated into the client and accessed on a unified platform, which makes data development and analysis more convenient. However, with the increasing number of big data processing engines, users need to choose processing engines when developing and analyzing data on big data platforms. When using inappropriate processing engines to process data, it will cause a certain amount of waste of computing resources. Summary of the invention

[0003] Based on this, it is necessary to provide a method, device, computer equipment, and storage medium for selecting a processing engine to address the above technical issues, which can improve processing efficiency and save resources.

[0004] In a first aspect, the present application provides a method for selecting a processing engine. The method comprises:

[0005] Receive database access statements;

[0006] Obtaining keywords in the database access statement, and determining the type of the database access statement based on the keywords in the database access statement;

[0007] Sending the database access statement to a corresponding first processing engine based on the type of the database access statement;

[0008] The operating state of the first processing engine is monitored, and in the case of a failure of the first processing engine, an update process is performed according to a preset engine stability sequence to update the first processing engine to a second processing engine.

[0009] In one of the embodiments, the updating process according to the preset engine stability sequence to replace the first processing engine with the second processing engine includes: obtaining resource information of each processing engine, the processing engines are sorted according to the resource information to form an engine stability sequence;

[0010] In the event of a failure of the first processing engine, the next computing engine is automatically updated according to the engine stability sequence.

[0011] In one embodiment, performing the update process according to the preset engine stability sequence to update the first processing engine to the second processing engine includes:

[0012] Obtaining an error log of the first processing engine, and determining a fault type of the first processing engine based on the error log;

[0013] Obtaining resource information of each processing engine, wherein the processing engines are sorted according to the resource information to form an engine stability sequence;

[0014] A target processing engine in the engine stability sequence is determined based on the fault type, wherein the target processing engine is a processing engine that is ranked first in the engine stability sequence and matches the fault type.

[0015] In one embodiment, when the type of the database access statement is a query language, after sending the database access statement to the corresponding first processing engine based on the type of the database access statement, the method further includes:

[0016] Obtaining the processing steps of the database access statement in the first processing engine, and obtaining the operation type based on the keywords in the processing steps;

[0017] Acquire resource information of the first processing resource and historical processing data of the first processing resource;

[0018] Allocating a weight corresponding to the operation type and a complexity reference value of the first processing engine based on the resource information of the first processing resource and the historical processing data of the first processing resource;

[0019] Based on the operation type and the weight corresponding to the operation type, the complexity of the database access statement in the first processing engine is calculated, and when the calculation result is greater than the complexity reference value, the first processing engine is replaced with a second processing engine.

[0020] In one embodiment, the method further comprises:

[0021] Parsing a database access statement to obtain an abstract syntax tree of the database access statement;

[0022] Comparing database grammar rules of the first processing engine and the second processing engine, and if the comparison result shows that the grammar is different, obtaining a relationship mapping table, wherein the relationship mapping table is used to characterize a database grammar conversion relationship between the first processing engine and the second processing engine;

[0023] Optimizing the abstract syntax tree based on the relationship mapping table to obtain an optimized syntax tree;

[0024] The optimized syntax tree is rewritten to obtain a database access statement that matches the second processing engine.

[0025] In one embodiment, optimizing the abstract syntax tree based on the relationship mapping table to obtain an optimized syntax tree includes:

[0026] Traversing all parent nodes in the abstract syntax tree, obtaining child nodes associated with the parent nodes to determine grammatical information composed of the parent nodes and the child nodes;

[0027] Based on the relationship mapping table, the grammatical information is optimized to update the parent node and the child node to obtain the optimized grammar tree.

[0028] In a second aspect, the present application further provides a device for selecting a processing engine, the device comprising:

[0029] A receiving module, used for receiving a database access statement;

[0030] An acquisition module, configured to acquire keywords in the database access statement, and determine the type of the database access statement based on the keywords in the database access statement;

[0031] A sending module, configured to send the database access statement to a corresponding first processing engine based on the type of the database access statement;

[0032] The selection module is used to monitor the running status of the first processing engine, and in case of failure of the first processing engine, perform update processing according to a preset engine stability sequence to update the first processing engine to a second processing engine.

[0033] In one of the embodiments, the updating process according to the preset engine stability sequence to replace the first processing engine with the second processing engine includes: obtaining resource information of each processing engine, the processing engines are sorted according to the resource information to form an engine stability sequence;

[0034] In the event of a failure of the first processing engine, the next computing engine is automatically updated according to the engine stability sequence.

[0035] In one embodiment, performing the update process according to the preset engine stability sequence to update the first processing engine to the second processing engine includes:

[0036] Obtaining an error log of the first processing engine, and determining a fault type of the first processing engine based on the error log;

[0037] Obtaining resource information of each processing engine, wherein the processing engines are sorted according to the resource information to form an engine stability sequence;

[0038] A target processing engine in the engine stability sequence is determined based on the fault type, wherein the target processing engine is a processing engine that is ranked first in the engine stability sequence and matches the fault type.

[0039] In one embodiment, when the type of the database access statement is a query language, after sending the database access statement to the corresponding first processing engine based on the type of the database access statement, the apparatus further includes:

[0040] Obtaining the processing steps of the database access statement in the first processing engine, and obtaining the operation type based on the keywords in the processing steps;

[0041] Acquire resource information of the first processing resource and historical processing data of the first processing resource;

[0042] Allocating a weight corresponding to the operation type and a complexity reference value of the first processing engine based on the resource information of the first processing resource and the historical processing data of the first processing resource;

[0043] Based on the operation type and the weight corresponding to the operation type, the complexity of the database access statement in the first processing engine is calculated, and when the calculation result is greater than the complexity reference value, the first processing engine is replaced with a second processing engine.

[0044] In one embodiment, the device further comprises:

[0045] Parsing a database access statement to obtain an abstract syntax tree of the database access statement;

[0046] Comparing database grammar rules of the first processing engine and the second processing engine, and if the comparison result shows that the grammar is different, obtaining a relationship mapping table, wherein the relationship mapping table is used to characterize a database grammar conversion relationship between the first processing engine and the second processing engine;

[0047] Optimizing the abstract syntax tree based on the relationship mapping table to obtain an optimized syntax tree;

[0048] The optimized syntax tree is rewritten to obtain a database access statement that matches the second processing engine.

[0049] In one embodiment, optimizing the abstract syntax tree based on the relationship mapping table to obtain an optimized syntax tree includes:

[0050] Traversing all parent nodes in the abstract syntax tree, obtaining child nodes associated with the parent nodes to determine grammatical information composed of the parent nodes and the child nodes;

[0051] Based on the relationship mapping table, the grammatical information is optimized to update the parent node and the child node to obtain the optimized grammar tree.

[0052] In a third aspect, the present disclosure further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the method for selecting a processing engine are implemented.

[0053] In a fourth aspect, the present disclosure further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the method for selecting a processing engine when executed by a processor.

[0054] In a fifth aspect, the present disclosure further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the method for selecting a processing engine are implemented.

[0055] The above processing engine selection method has at least the following beneficial effects:

[0056] The embodiment scheme provided by the present disclosure can send the database access statement to the corresponding processing engine according to the type of the database access statement when executing the database access statement. When the processing engine fails to query the fault, it will automatically transfer to other engines with higher priority for execution, thereby improving query efficiency, reducing learning costs, and rationally utilizing resources.

[0057] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure or the conventional technology, the drawings required for use in the embodiments or the conventional technology descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0059] FIG1 is an application environment diagram of a method for selecting a processing engine in one embodiment;

[0060] Figure 2 A flowchart of a method for selecting a processing engine in one embodiment;

[0061] Figure 3 A flowchart of a method for selecting a processing engine in one embodiment;

[0062] Figure 4is a structural block diagram of a device for selecting a processing engine in one embodiment;

[0063] Figure 5 is a structural block diagram of a device for selecting a processing engine in one embodiment;

[0064] FIG6 is a diagram showing the internal structure of a computer device in one embodiment;

[0065] FIG. 7 is a diagram showing the internal structure of a server in an embodiment. DETAILED DESCRIPTION

[0066] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0067] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific sequence or order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described here can be implemented in a sequence other than those illustrated or described here. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. On the contrary, they are only examples of devices and methods consistent with some aspects of the present disclosure as detailed in the attached claims. The terms "include", "comprises", or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, product or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, product or device. In the absence of more restrictions, it is not excluded that there are other identical or equivalent elements in the process, method, product or device including the elements. For example, if the words first, second, etc. are used to represent the name, they do not represent any specific sequence.

[0068] The embodiment of the present disclosure provides a method for selecting a processing engine, which can be applied in an application environment as shown in FIG. 1 . Among them, the terminal 102 communicates with the server 104 through a network. The data storage system can store data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented with an independent server or a server cluster consisting of multiple servers.

[0069] In some embodiments of the present disclosure, Figure 2 As shown, a method for selecting a processing engine is provided, and the method is applied to the server in FIG1 to process a database access statement as an example for explanation. It can be understood that the method can be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In a specific embodiment, the method can include the following steps:

[0070] S202: Receive a database access statement.

[0071] S204: Acquire keywords in the database access statement, and determine the type of the database access statement based on the keywords in the database access statement.

[0072] Database access statements (SQL, Structured Query Language) are database languages ​​with multiple functions such as data manipulation and data definition. This language is interactive and can provide great convenience for users. Database management systems should make full use of SQL language to improve the work quality and efficiency of computer application systems.

[0073] Database access statements can include the following language types:

[0074] DDL (Data Definition Language): DDL is used to define the database structure, including creating, modifying, and deleting database objects (such as tables, views, etc.). Keywords may include CREATE (create database objects), ALTER (modify the structure of database objects), DROP: delete database objects) and TRUNCATE (quickly delete all data in a table).

[0075] DML (Data Manipulation Language): DML is used to manipulate data in a database. Keywords may include INSERT (insert new data into a table), UPDATE (update existing data in a table), and DELETE (delete data from a table).

[0076] DCL (Data Control Language): DCL is used to control database access rights and security. Keywords can include GRANT (grant user access rights) and REVOKE (revoke user access rights).

[0077] DQL (Data Query Language): DQL is used to retrieve data from a database. Keywords can include SELECT (retrieve data from one or more tables).

[0078] Some keywords can be combined with the SELECT keyword. In this case, most of the time is spent on query calculation during execution, which can be classified as DQL type.

[0079] The keywords in the database access statement are obtained, and the type of the database access statement can be determined according to the keywords in the database access statement.

[0080] S206: Send the database access statement to the corresponding first processing engine based on the type of the database access statement.

[0081] According to the type of SQL obtained through parsing, it is routed to different computing engines. The following uses three common engines as examples, namely Hive, Spark, and Trino. These three engines have their own scenarios. Spark is more suitable for complex and large-scale data processing scenarios, with a wide range of functions and the use of memory and disk. Trino is more suitable for AD-HOC (ad hoc query) scenarios that require fast interaction, supports multiple data sources, and mainly uses memory computing. Hive is also suitable for large-scale data processing scenarios, is more stable, and uses memory and disk. If the SQL type is DDL and DML, it is routed to Hive for execution. Hive is relatively efficient in executing such SQL.

[0082] S208: Monitor the running status of the first processing engine, and in case of a failure of the first processing engine, perform an update process according to a preset engine stability sequence to update the first processing engine to a second processing engine.

[0083] Continuously monitor the running status of the first processing engine, define a list of processing engines sorted by stability, and when the first processing engine fails, automatically select the next available processing engine as the second processing engine according to the stability sequence and transfer the processing task to it. Monitoring indicators can include CPU usage, memory usage, task execution status, task execution time, etc.

[0084] In the above-mentioned processing engine selection method, when executing database access statements, the database access statements can be sent to the corresponding processing engine according to the type of database access statements. When the processing engine fault query fails, it is automatically transferred to other engines with higher priorities for execution, thereby improving query efficiency, reducing learning costs, and rationally utilizing resources.

[0085] In some embodiments of the present disclosure, the updating process according to the preset engine stability sequence to replace the first processing engine with the second processing engine includes: obtaining resource information of each processing engine, the processing engines are sorted according to the resource information to form an engine stability sequence;

[0086] In the event of a failure of the first processing engine, the next computing engine is automatically updated according to the engine stability sequence.

[0087] Regularly collect resource information of each processing engine, sort the processing engines based on the resource information to form an engine stability sequence, continuously monitor the operating status of the first processing engine, and automatically update to the next computing engine according to the preset stability sequence when the first processing engine fails.

[0088] For example, you can downgrade based on the stability of the engine. The stability is from high to low, Hive-Spark-Trino. If the route is to Trino, it means Trino has the highest priority. When Trino fails, it is downgraded to Spark with lower priority but higher stability. Similarly, if Spark fails, it is downgraded to Hive.

[0089] In some embodiments of the present disclosure, performing update processing according to a preset engine stability sequence to update the first processing engine to the second processing engine includes:

[0090] Obtaining an error log of the first processing engine, and determining a fault type of the first processing engine based on the error log;

[0091] Obtaining resource information of each processing engine, wherein the processing engines are sorted according to the resource information to form an engine stability sequence;

[0092] A target processing engine in the engine stability sequence is determined based on the fault type, wherein the target processing engine is a processing engine that is ranked first in the engine stability sequence and matches the fault type.

[0093] Monitor the running status of the first processing engine and obtain the error log when a fault occurs. Determine the fault type of the first processing engine based on the error log. Regularly collect resource information of all processing engines. Sort the processing engines according to the resource information to form an engine stability sequence. At the same time, select the most appropriate second processing engine for failover based on the fault type and stability sequence.

[0094] In some embodiments of the present disclosure, when the type of the database access statement is a query language, after sending the database access statement to the corresponding first processing engine based on the type of the database access statement, the method further includes:

[0095] Obtaining the processing steps of the database access statement in the first processing engine, and obtaining the operation type based on the keywords in the processing steps;

[0096] Acquire resource information of the first processing resource and historical processing data of the first processing resource;

[0097] Allocating a weight corresponding to the operation type and a complexity reference value of the first processing engine based on the resource information of the first processing resource and the historical processing data of the first processing resource;

[0098] Based on the operation type and the weight corresponding to the operation type, the complexity of the database access statement in the first processing engine is calculated, and when the calculation result is greater than the complexity reference value, the first processing engine is replaced with a second processing engine.

[0099] The resource information of the first processing engine may include CPU, network, memory, disk resources, etc. The historical processing data of the first processing resources may include historical resource information and processing results of database access statements in the first processing engine.

[0100] The detailed execution plan of Spark can be obtained through EXPLAIN EXTENDED. The complexity is evaluated mainly from the dimensions of Join type, Join times, subquery times, window times, and aggregation times. This information can be extracted through the keywords in each stage of the execution plan. The corresponding relationship is as follows:

[0101] Join count: The number of Join operations involved in a query. You can count the number of Join operations by searching for the Join keyword in the Parsed Logical Plan.

[0102] Join type: Join type refers to the specific Join strategy used in the query. In the physical plan (PhysicalPlan), there are the following Join types: BroadcastHashJoin, SortMergeJoin, ShuffledHashJoin, BroadcastNestedLoopJoin, CartesianProduct.

[0103] Subquery count: Subquery count refers to the number of subqueries used in a query. You can count the number of subqueries by searching for SubqueryAlias ​​in the Parsed Logical Plan.

[0104] Window opening times: Window opening times refers to the number of window functions (such as ROW_NUMBER(), RANK(), etc.) used in a query. You can count the number of window opening times by searching for Windows in the Analyzed Logical Plan.

[0105] Aggregation count: Aggregation count refers to the number of times an aggregate function (such as SUM(), COUNT(), GROUPBY, etc.) is used in a query. You can count the number of aggregations by searching for Aggregate in the Parsed Logical Plan.

[0106] Aggregation, windowing, and join will generate resource-consuming shuffle operations. The join type can obtain more information.

[0107] ShuffledHashJoin, SortMergeJoin, and CartesianProduct are three types of scenarios for processing large amounts of data. The difference is that ShuffledHashJoin consumes more memory resources because it needs to build a hash table on each node. SortMergeJoin sorting operations consume more CPU and disk I / O resources, especially when processing large tables. CartesianProduct generates the Cartesian product of two tables, so resource consumption is usually very large, requiring sufficient CPU, memory, disk, and network resources to process large amounts of data. The relevant weights and complexity benchmark values ​​of the above dimensions can be obtained based on the specific conditions of the CPU, network, memory, disk resources and historical execution tasks of the big data cluster to quantitatively evaluate the complexity of the execution plan and obtain a complexity coefficient. This coefficient is used to determine which engine to route to. The following is a simple example of complex coefficient calculation:

[0108] Assume that the cluster memory resources are not sufficient, and there is a query that includes 2 Join operations (1 ShuffledHashJoin and 1 SortMergeJoin), 1 subquery, 1 window operation, and 2 aggregation operations. We can assign weights to each operation based on its resource consumption characteristics and calculate the complexity coefficient.

[0109] For example, the complexity baseline value is 50, the basic weight of each Join operation is 10, the additional weight of ShuffledHashJoin is 5, the additional weight of SortMergeJoin is 8, the subquery weight is 3, the window operation weight is 7, and the aggregation operation weight is 6. Because the cluster's shortcoming is memory, the additional weight of SortMergeJoin is increased to increase the probability of routing to Spark.

[0110] The complexity coefficient is calculated as follows:

[0111] Complexity coefficient = (2*10)+(1*10+5)+(1*10+8)+(1*3)+(1*7)+(2*6)

[0112] =20+15+18+3+7+12

[0113] =75

[0114] If the complexity coefficient is greater than the baseline value of 50, it is routed to Spark, otherwise it is routed to Trino. This complexity coefficient is just a simple weighted sum. If a more precise evaluation is required, more complex models and algorithms can be used. In addition, different business scenarios and performance requirements may also require adjustment of weight distribution.

[0115] In some embodiments of the present disclosure, Figure 3 : is a flow chart of a method for selecting a processing engine in one embodiment, wherein the method further includes:

[0116] S302: Parse the database access statement to obtain an abstract syntax tree of the database access statement;

[0117] Comparing database grammar rules of the first processing engine and the second processing engine, and if the comparison result shows that the grammar is different, obtaining a relationship mapping table, wherein the relationship mapping table is used to characterize a database grammar conversion relationship between the first processing engine and the second processing engine;

[0118] Optimizing the abstract syntax tree based on the relationship mapping table to obtain an optimized syntax tree;

[0119] The optimized syntax tree is rewritten to obtain a database access statement that matches the second processing engine.

[0120] The system uses a parser to read and parse database access statements. The parser converts text strings into a structured data representation - the Abstract Syntax Tree (AST). The Abstract Syntax Tree is a tree-shaped data structure that captures the grammatical structure of database access statements, including various elements in the query (such as selection, connection, grouping, filtering conditions, etc.) and the relationships between them. Each node represents a part of the grammatical structure, and the edge represents the relationship between the nodes.

[0121] Different database processing engines (such as Spark SQL and Trino) may have different SQL implementation and syntax details. Therefore, the system needs to compare the SQL syntax differences between the two engines.

[0122] Check the SQL syntax documents or specifications of the two processing engines to find out the differences between them. These differences may include differences in specific syntax structures, keywords, function support, etc. Relationship mapping table A table or data structure used to record the syntax conversion rules between the two processing engines. For example, if the first processing engine supports a specific JOIN type, and the second processing engine uses different keywords or structures to express the same JOIN operation, you need to define this conversion rule in this table. The mapping rule can help the system automatically convert the syntax structure in the database access statement to meet the requirements of the target processing engine. The system will traverse the abstract syntax tree and apply the rules in the relationship mapping table to modify the part of the abstract syntax tree that does not conform to the syntax of the target processing engine. The converted abstract syntax tree is called an optimized syntax tree, which contains the syntax structure suitable for the target processing engine.

[0123] In some embodiments of the present disclosure, optimizing the abstract syntax tree based on the relationship mapping table to obtain an optimized syntax tree includes:

[0124] Traversing all parent nodes in the abstract syntax tree, obtaining child nodes associated with the parent nodes to determine grammatical information composed of the parent nodes and the child nodes;

[0125] Based on the relationship mapping table, the grammatical information is optimized to update the parent node and the child node to obtain the optimized grammar tree.

[0126] For example, to perform syntax conversion on SQL routed to Trino

[0127] Use Apache Calcite to parse the user's SQL and generate an AST (Abstract Syntax Tree). Based on the syntax differences between HiveSQL and TrinoSQL, determine whether syntax conversion is required. For example, the lateral view explode syntax in HiveSQL needs to be replaced with cross join unnest, and the rlike function in HiveSQL needs to be replaced with regexp_like. Rewrite the relational nodes that need to be converted into HiveSQL relational nodes, and generate the converted HiveSQL based on the rewritten AST (Abstract Syntax Tree).

[0128] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the sequence indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict sequence restriction, and these steps can be executed in other sequences. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0129] Based on the same inventive concept, the embodiment of the present disclosure also provides a device for selecting a processing engine for implementing the method for selecting a processing engine involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiment of the device for selecting a processing engine provided below can refer to the limitations of the method for selecting a processing engine above, and will not be repeated here.

[0130] The device may include a system (including a distributed system), software (application), module, component, server, client, etc. that uses the method described in the embodiments of this specification and is combined with necessary implementation hardware. Based on the same innovative concept, the device in one or more embodiments provided in the embodiments of the present disclosure is as described in the following embodiments. Since the implementation scheme and method of the device to solve the problem are similar, the implementation of the specific device in the embodiments of this specification can refer to the implementation of the aforementioned method, and the repetitions will not be repeated. As used below, the term "unit" or "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.

[0131] In one embodiment, Figure 4 As shown, a processing engine selection device 400 is provided, and the device may be the aforementioned server, or a module, component, device, unit, etc. integrated in the server. The device 400 may include:

[0132] A receiving module 402, used for receiving a database access statement;

[0133] An acquisition module 404 is used to acquire keywords in the database access statement and determine the type of the database access statement based on the keywords in the database access statement;

[0134] A sending module 406, configured to send the database access statement to a corresponding first processing engine based on the type of the database access statement;

[0135] The selection module 408 is used to monitor the running status of the first processing engine, and in case of failure of the first processing engine, perform update processing according to a preset engine stability sequence to update the first processing engine to a second processing engine.

[0136] In one embodiment, the updating process according to the preset engine stability sequence to replace the first processing engine with the second processing engine includes: obtaining resource information of each processing engine, and the processing engines are sorted according to the resource information to form an engine stability sequence;

[0137] In the event of a failure of the first processing engine, the next computing engine is automatically updated according to the engine stability sequence.

[0138] In one embodiment, performing the update process according to the preset engine stability sequence to update the first processing engine to the second processing engine includes:

[0139] Obtaining an error log of the first processing engine, and determining a fault type of the first processing engine based on the error log;

[0140] Obtaining resource information of each processing engine, wherein the processing engines are sorted according to the resource information to form an engine stability sequence;

[0141] A target processing engine in the engine stability sequence is determined based on the fault type, wherein the target processing engine is a processing engine that is ranked first in the engine stability sequence and matches the fault type.

[0142] In one embodiment, when the type of the database access statement is a query language, after sending the database access statement to the corresponding first processing engine based on the type of the database access statement, the apparatus further includes:

[0143] Obtaining the processing steps of the database access statement in the first processing engine, and obtaining the operation type based on the keywords in the processing steps;

[0144] Acquire resource information of the first processing resource and historical processing data of the first processing resource;

[0145] Allocating a weight corresponding to the operation type and a complexity reference value of the first processing engine based on the resource information of the first processing resource and the historical processing data of the first processing resource;

[0146] Based on the operation type and the weight corresponding to the operation type, the complexity of the database access statement in the first processing engine is calculated, and when the calculation result is greater than the complexity reference value, the first processing engine is replaced with a second processing engine.

[0147] In one embodiment, Figure 5 : is a structural block diagram of a device for selecting a processing engine in an embodiment, wherein the device further comprises:

[0148] An optimization module 502 is used to parse a database access statement to obtain an abstract syntax tree of the database access statement;

[0149] Comparing database grammar rules of the first processing engine and the second processing engine, and if the comparison result shows that the grammar is different, obtaining a relationship mapping table, wherein the relationship mapping table is used to characterize a database grammar conversion relationship between the first processing engine and the second processing engine;

[0150] Optimizing the abstract syntax tree based on the relationship mapping table to obtain an optimized syntax tree;

[0151] The optimized syntax tree is rewritten to obtain a database access statement that matches the second processing engine.

[0152] In one embodiment, optimizing the abstract syntax tree based on the relationship mapping table to obtain an optimized syntax tree includes:

[0153] Traversing all parent nodes in the abstract syntax tree, obtaining child nodes associated with the parent nodes to determine grammatical information composed of the parent nodes and the child nodes;

[0154] Based on the relationship mapping table, the grammatical information is optimized to update the parent node and the child node to obtain the optimized grammar tree.

[0155] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0156] Each module in the above-mentioned selection device for the processing engine can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0157] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG6 . The computer device includes a processor, a memory, and a network interface connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store database access statements. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a method for selecting a processing engine is implemented.

[0158] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be shown in FIG7. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a method for selecting a processing engine is implemented. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covered on the display screen, or a key, a trackball or a touch pad provided on the housing of the computer device, or an external keyboard, touch pad or mouse, etc.

[0159] Those skilled in the art will understand that the structures shown in FIG. 6 and FIG. 7 are merely block diagrams of partial structures related to the scheme of the present disclosure, and do not constitute a limitation on the computer device to which the scheme of the present disclosure is applied. The specific computer device may include more or fewer components than those shown in the figures, or combine certain components, or have a different arrangement of components.

[0160] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method described in any embodiment of the present disclosure is implemented.

[0161] In one embodiment, a computer program product is provided, including a computer program, which implements the method described in any embodiment of the present disclosure when executed by a processor.

[0162] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided by the present disclosure can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided by the present disclosure may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided by the present disclosure may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, etc., but are not limited to this.

[0163] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0164] The above-described embodiments only express several implementation methods of the present disclosure, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present invention. It should be pointed out that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present disclosure, and these all belong to the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the attached claims.

Claims

1. A method for selecting a processing engine, It is characterized in that The method comprises: Receive database access statements; Obtaining keywords in the database access statement, and determining the type of the database access statement based on the keywords in the database access statement; Sending the database access statement to a corresponding first processing engine based on the type of the database access statement; The operating state of the first processing engine is monitored, and in the case of a failure of the first processing engine, an update process is performed according to a preset engine stability sequence to update the first processing engine to a second processing engine.

2. The method according to claim 1, It is characterized in that The updating process of replacing the first processing engine with the second processing engine according to the preset engine stability sequence includes: Obtaining resource information of each processing engine, wherein the processing engines are sorted according to the resource information to form an engine stability sequence; In the event of a failure of the first processing engine, the next computing engine is automatically updated according to the engine stability sequence.

3. The method according to claim 1, It is characterized in that The updating process of updating the first processing engine to the second processing engine according to the preset engine stability sequence includes: Obtaining an error log of the first processing engine, and determining a fault type of the first processing engine based on the error log; Obtaining resource information of each processing engine, wherein the processing engines are sorted according to the resource information to form an engine stability sequence; A target processing engine in the engine stability sequence is determined based on the fault type, wherein the target processing engine is a processing engine that is ranked first in the engine stability sequence and matches the fault type.

4. The method according to claim 1, It is characterized in that In the case where the type of the database access statement is a query language, after sending the database access statement to the corresponding first processing engine based on the type of the database access statement, the method further includes: Obtaining the processing steps of the database access statement in the first processing engine, and obtaining the operation type based on the keywords in the processing steps; Obtain resource information of the first processing engine and historical processing data of the first processing resource; Based on the resource information of the first processing engine and the historical processing data of the first processing resource, allocating a weight corresponding to the operation type and a complexity reference value of the first processing engine; Based on the operation type and the weight corresponding to the operation type, the complexity of the database access statement in the first processing engine is calculated, and when the calculation result is greater than the complexity reference value, the first processing engine is replaced with a second processing engine.

5. The method according to claim 1, It is characterized in that The method further comprises: Parsing a database access statement to obtain an abstract syntax tree of the database access statement; Comparing database grammar rules of the first processing engine and the second processing engine, and if the comparison result shows that the grammar is different, obtaining a relationship mapping table, wherein the relationship mapping table is used to characterize a database grammar conversion relationship between the first processing engine and the second processing engine; Optimizing the abstract syntax tree based on the relationship mapping table to obtain an optimized syntax tree; The optimized syntax tree is rewritten to obtain a database access statement that matches the second processing engine.

6. The method according to claim 5, It is characterized in that The optimizing the abstract syntax tree based on the relationship mapping table to obtain an optimized syntax tree comprises: Traversing all parent nodes in the abstract syntax tree, obtaining child nodes associated with the parent nodes to determine grammatical information composed of the parent nodes and the child nodes; Based on the relationship mapping table, the grammatical information is optimized to update the parent node and the child node to obtain the optimized grammar tree.

7. A device for selecting a processing engine, It is characterized in that The device comprises: A receiving module, used for receiving a database access statement; An acquisition module, configured to acquire keywords in the database access statement, and determine the type of the database access statement based on the keywords in the database access statement; A sending module, configured to send the database access statement to a corresponding first processing engine based on the type of the database access statement; The selection module is used to monitor the running status of the first processing engine, and in case of failure of the first processing engine, perform update processing according to a preset engine stability sequence to update the first processing engine to a second processing engine.

8. The device according to claim 7, It is characterized in that The updating process of replacing the first processing engine with the second processing engine according to the preset engine stability sequence includes: Obtaining resource information of each processing engine, wherein the processing engines are sorted according to the resource information to form an engine stability sequence; In the event of a failure of the first processing engine, the next computing engine is automatically updated according to the engine stability sequence.

9. The device according to claim 7, It is characterized in that The updating process of updating the first processing engine to the second processing engine according to the preset engine stability sequence includes: Obtaining an error log of the first processing engine, and determining a fault type of the first processing engine based on the error log; Obtaining resource information of each processing engine, wherein the processing engines are sorted according to the resource information to form an engine stability sequence; A target processing engine in the engine stability sequence is determined based on the fault type, wherein the target processing engine is a processing engine that is ranked first in the engine stability sequence and matches the fault type.

10. The device according to claim 7, It is characterized in that In the case where the type of the database access statement is a query language, after sending the database access statement to the corresponding first processing engine based on the type of the database access statement, the apparatus further includes: Obtaining the processing steps of the database access statement in the first processing engine, and obtaining the operation type based on the keywords in the processing steps; Acquire resource information of the first processing resource and historical processing data of the first processing resource; Allocating a weight corresponding to the operation type and a complexity reference value of the first processing engine based on the resource information of the first processing resource and the historical processing data of the first processing resource; Based on the operation type and the weight corresponding to the operation type, the complexity of the database access statement in the first processing engine is calculated, and when the calculation result is greater than the complexity reference value, the first processing engine is replaced with a second processing engine.

11. The device according to claim 7, It is characterized in that The device also includes: An optimization module, used for parsing a database access statement to obtain an abstract syntax tree of the database access statement; Comparing database grammar rules of the first processing engine and the second processing engine, and if the comparison result shows that the grammar is different, obtaining a relationship mapping table, wherein the relationship mapping table is used to characterize a database grammar conversion relationship between the first processing engine and the second processing engine; Optimizing the abstract syntax tree based on the relationship mapping table to obtain an optimized syntax tree; The optimized syntax tree is rewritten to obtain a database access statement that matches the second processing engine.

12. The device according to claim 11, It is characterized in that The optimizing the abstract syntax tree based on the relationship mapping table to obtain an optimized syntax tree comprises: Traversing all parent nodes in the abstract syntax tree, obtaining child nodes associated with the parent nodes to determine grammatical information composed of the parent nodes and the child nodes; Based on the relationship mapping table, the grammatical information is optimized to update the parent node and the child node to obtain the optimized grammar tree.

13. A computer device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

14. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

15. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Cited By

  • Robot voice processing method and system

    CN120564721A