Data access method, device, scheduling equipment and storage medium
By obtaining and parsing the database operation request in the scheduling device, selecting the target node based on the historical statistical data of the candidate node, and assigning the request to the node for processing, the problem of low success rate of database operation actions in the existing technology is solved, and the More efficient allocation of database operation requests.
Patent Information
- Application Number
- CN202010101051.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-02-19
- Publication Date
- 2025-01-21
- Estimated Expiration
- 2040-02-19
AI Technical Summary
In the prior art, the allocation method of the remaining computer resource of the database cluster node cannot truly reflect the actual situation of the node processing database operation requests, resulting in a low success rate of database operation operations.
By obtaining the database operation request initiated by the client, parsing the request to obtain the database operation action, determining the candidate nodes according to the preset load balancing conditions, obtaining the historical statistical data of each candidate node performing the operation action, and selecting the node with the smallest failure rate as the target node , and assign the request to the target node for processing.
By referring to the historical statistical data of database operation actions performed by each candidate node for allocation, database operation requests can be allocated more reasonably and the success rate of operation actions can be improved.
Smart Images

Figure CN113282565B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a data access method, apparatus, scheduling device and storage medium. Background Art
[0002] In order to cope with the growing user access needs, the server's processing capacity for user data operation requests is often increased through database clustering, and the scheduling device allocates the acquired database operation requests to each node in the cluster. At present, the commonly used scheduling method is mainly based on the remaining computer resources of each node. However, the remaining computer resources of each node cannot truly reflect the actual processing status of the data operation request at the processing node.
[0003] For example, a software or hardware failure of a node may cause the node to be unable to process user data operation requests, resulting in a large number of remaining computer resources.
[0004] Alternatively, in addition to being configured with database software, each node in the database cluster may also be configured with other software that is different according to other uses of each node. Based on this, even if the same database operation is executed on different nodes, different results may be produced.
[0005] For example, for node A and node B, for a database operation A with a large amount of computation, due to other software running in node A occupying a large amount of computer resources, node A has fewer remaining computer resources, which may cause node A to fail to execute the database operation A. Since node B has more remaining computer resources than node A, node B can successfully execute the database operation A.
[0006] Similarly, for a database operation B with a small amount of calculation, both node A and node B can successfully execute the database operation B due to the small amount of calculation.
[0007] Alternatively, different database operations have different levels of sensitivity to computer resource requirements. Some database operations are sensitive to remaining CPU (Central Processing Unit) resources, while others are more sensitive to remaining memory resources. However, the allocation method based on computer resources is not very reasonable, as computer resources are a collection of multiple resources in multiple computers (such as CPU, memory, and hard disk). Summary of the invention
[0008] In order to overcome at least one shortcoming in the prior art, one of the purposes of an embodiment of the present application is to provide a data access method, which is applied to a scheduling device that communicates with a client and multiple nodes in a database cluster, and the method includes:
[0009] Obtaining a database operation request initiated by the client;
[0010] Parsing the database operation request to obtain a database operation action corresponding to the database operation request;
[0011] Determine a candidate node from the multiple nodes according to a preset load balancing condition;
[0012] Obtain historical statistical data on whether each candidate node successfully executes the database operation action;
[0013] Selecting a target node from the candidate nodes according to the historical statistical data;
[0014] The database operation request is assigned to the target node for processing to improve the success rate of executing the database operation action.
[0015] Optionally, the database operation action includes a database operation type and an operation object, and the step of parsing the database operation request to obtain the database operation action corresponding to the database operation request includes:
[0016] Parsing the database operation request to obtain the database operation type and the operation object;
[0017] The step of obtaining historical statistical data of whether each candidate node successfully executes the database operation action comprises:
[0018] Obtain historical statistical data on whether each candidate node successfully executes the database operation type on the operation object.
[0019] Optionally, the method further comprises:
[0020] Obtaining a processing result of whether the target node successfully processes the database operation request;
[0021] The historical statistical data of whether the target node successfully executes the database operation action is updated according to the processing result.
[0022] Optionally, the method further comprises:
[0023] Compare the updated historical statistical data of the target node with the preset alarm conditions;
[0024] If the updated historical statistical data meets the preset alarm condition, alarm information is provided to the user.
[0025] Optionally, the scheduling device is configured with a monitoring code for monitoring a database operation code, and the step of obtaining the database operation request initiated by the client includes:
[0026] When the database operation code is executed, the monitoring code is triggered;
[0027] The database operation request is obtained through the monitoring code.
[0028] Optionally, the monitoring code is configured through a tool AspectJ weaver.
[0029] Optionally, the historical statistical data is a failure rate of each candidate node in executing the database operation action, and the step of selecting a target node from the candidate nodes according to the historical statistical data includes:
[0030] A node with the smallest failure rate is selected from the candidate nodes according to the failure rate as the target node.
[0031] One of the purposes of the embodiments of the present application is to provide a data access device, which is applied to a scheduling device that communicates with a client and multiple nodes in a database cluster, wherein the data access device includes a request acquisition module, a request parsing module, a data acquisition module, a candidate node module, a target node module, and a request allocation module;
[0032] The request acquisition module is used to acquire the database operation request initiated by the client;
[0033] The request parsing module is used to parse the database operation request and obtain the database operation action corresponding to the database operation request;
[0034] The candidate node module is used to determine a candidate node from the multiple nodes according to a preset load balancing condition;
[0035] The data acquisition module is used to obtain historical statistical data on whether each candidate node successfully executes the database operation action;
[0036] The target node module is used to select a target node from the candidate nodes according to the historical statistical data;
[0037] The request allocation module is used to allocate the database operation request to the target node for processing, so as to improve the success rate of executing the database operation action.
[0038] The third purpose of an embodiment of the present application is to provide a scheduling device, which includes a processor and a memory, wherein the memory stores a machine executable program that can be executed by the processor, and when the machine executable program is executed by the processor, the data access method is implemented.
[0039] A fourth objective of an embodiment of the present application is to provide a storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the data access method is implemented.
[0040] Compared with the prior art, this application has the following beneficial effects:
[0041] The embodiments of the present application provide a data access method, apparatus, scheduling device and storage medium. When allocating database operation requests, the scheduling device makes the allocation with reference to the historical statistical data of whether each candidate node successfully executes the database operation action. Since the historical statistical data of whether each candidate node successfully executes the database operation action can truly reflect the actual situation of each candidate node processing the database operation action, the allocation result of the scheduling device allocating the database operation request according to the historical statistical data of whether each candidate node successfully executes the database operation action is more reasonable, thereby being able to improve the success rate of executing the database operation action. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0043] Figure 1 A schematic diagram of a scenario provided for an embodiment of the present application;
[0044] Figure 2 A schematic diagram of the hardware structure provided for an embodiment of the present application;
[0045] Figure 3 A flowchart of the steps of the data access method provided in the embodiment of the present application;
[0046] Figure 4 A schematic diagram of the structure of a data access device provided in an embodiment of the present application.
[0047] Icons: 100 - scheduling device; 110 - data access device; 120 - memory; 130 - processor; 140 - communication unit; 200 - client; 300 - database cluster; 310 - node; 1101 - request acquisition module; 1102 - request parsing module; 1103 - data acquisition module; 1104 - candidate node module; 1105 - target node module; 1106 - request allocation module. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.
[0049] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0050] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0051] As introduced in the background technology, currently, the commonly used scheduling method is mainly based on the remaining computer resources of each node for allocation. However, the remaining computer resources of each node cannot truly reflect the actual processing status of user requests in the processing node, making the allocation method based on computer resources not very reasonable.
[0052] In view of this, the embodiment of the present application provides a data access method, which is applied to a scheduling device. Figure 1 , is a schematic diagram of a scenario in which the scheduling device provided in an embodiment of the present application communicates with the client 200 and multiple nodes 310 in the database cluster 300. The scheduling device may be, but is not limited to, a personal computer or a professional server, and the multiple nodes 310 in the database cluster 300 are all configured with database software.
[0053] For this dispatch device, please refer to Figure 2 , is a schematic diagram of the hardware structure of the scheduling device 100 , and the scheduling device 100 includes a data access device 110 , a memory 120 , a processor 130 and a communication unit 140 .
[0054] Among them, the memory 120, the processor 130 and the communication unit 140 are directly or indirectly connected to each other in communication to realize data transmission or interaction. For example, these elements can be electrically connected to each other through one or more communication buses or signal lines. The data access device 110 includes at least one software function module that can be stored in the memory 120 in the form of software or firmware or solidified in the operating system (OS) of the scheduling device 100. The processor 130 is used to execute the executable modules stored in the memory 120, such as the software function modules and computer programs included in the data access device 110.
[0055] The memory 120 may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electric erasable programmable read-only memory (EEPROM), etc. The memory 120 is used to store a program, and the processor 130 executes the program after receiving an execution instruction. The communication unit 140 is used to send and receive data through a network.
[0056] The processor 130 may be an integrated circuit chip with signal processing capabilities. The above-mentioned processor may be a general-purpose processor, including a central processing unit, a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application may be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0057] Please refer to Figure 3 , which is provided in the embodiments of the present application and is applied to Figure 1 The flowchart of a data access method of the scheduling device 100 is shown, and the various steps of the method will be described in detail below.
[0058] Step S100, obtaining a database operation request initiated by the client 200.
[0059] The database operation request mainly includes a new addition request for adding a new action to the database, an insert request for inserting an action, an update request for updating an action, a query request for querying an action, and a delete request for deleting an action.
[0060] Step S200: parse the database operation request to obtain a database operation action corresponding to the database operation request.
[0061] Step S300 , determining a candidate node from the plurality of nodes 310 according to a preset load balancing condition.
[0062] The load balancing condition may be, but is not limited to, taking a node 310 whose remaining computer resources are greater than a preset first resource threshold as a candidate node, or taking a node 310 whose number of allocated tasks is less than a preset task number threshold as a candidate node.
[0063] Step S400: Obtain historical statistical data on whether each candidate node successfully executes the database operation action.
[0064] If the database operation is an insert operation, the historical statistical data may be historical statistical data of whether each candidate node successfully performs the insert operation. The statistical cycle of the historical statistical data may be adjusted by the user according to actual needs.
[0065] For example, if the system is relatively stable, the statistical period can be adjusted to a longer range so that the scheduling server can collect as much historical statistics as possible within one statistical period; if the system is not very stable, the statistical period can be adjusted to a smaller range so that the scheduling server can perceive the actual status of each node 310 in a timely manner.
[0066] The historical statistical data can truly reflect the success and failure of each candidate node in executing the database operation action from a statistical perspective.
[0067] Step S500: selecting a target node from candidate nodes according to historical statistical data.
[0068] Step S600: assigning the database operation request to the target node for processing to improve the success rate of executing the database operation action.
[0069] Through the above method, the scheduling device 100 allocates database operation requests with reference to the historical statistical data of whether each candidate node successfully executes the database operation action. Since the historical statistical data of whether each candidate node successfully executes the database operation action can truly reflect the actual situation of each candidate node processing the database operation action, the scheduling device 100 allocates the database operation request according to the historical statistical data of whether each candidate node successfully executes the database operation action. The allocation result is more reasonable, and then the success rate of executing the database operation action can be improved.
[0070] Optionally, the accuracy of the historical statistical data on whether the database operation action is successful can be adjusted according to actual needs. As a possible implementation, the database operation action includes a database operation type and an operation object. Based on this, when acquiring historical statistical data, the scheduling device 100 acquires historical statistical data on whether each candidate node successfully performs the database operation type on the operation object. Among them, the operation object is a data table in the database.
[0071] As another possible implementation, the database operation action includes a database operation type, an operation object, and a field in the operation object. Based on this, when acquiring historical statistical data, the scheduling device 100 acquires historical statistical data of whether each candidate node successfully executes the database operation type on the field of the operation object.
[0072] It should be understood that the higher the statistical accuracy of the historical statistical data, the more reasonable the allocation result based on the historical statistical data, and the higher the success rate of executing the database operation action.
[0073] Optionally, the scheduling device 100 obtains a processing result of whether the target node successfully processes the database operation request; and updates historical statistical data of whether the target node successfully executes the database operation action according to the processing result.
[0074] Among them, when the historical statistical data is updated, as a possible implementation method, the historical statistical data is the failure rate of each candidate node in executing the database operation action, then the scheduling device 100 obtains the processing result of whether the target node successfully processes the database operation request, and updates the failure rate of whether the target node successfully executes the database operation action according to the processing result.
[0075] As another possible implementation, the historical statistical data is the average time interval of each candidate node failing to execute the database operation action. The scheduling device 100 obtains the processing result of whether the target node successfully processes the database operation request, and updates the average time interval of whether the target node successfully executes the database operation action according to the time when the processing result is generated.
[0076] It is worth noting that the historical statistical data used to reflect the actual situation of each candidate node executing the database operation action is not limited to the above examples, but may also include other types, and the embodiments of the present application do not make specific limitations.
[0077] Among them, when selecting a target node from the candidate nodes based on the historical statistical data, the historical statistical data takes the failure rate of each candidate node in executing the database operation action as an example. As a possible implementation method, the scheduling device 100 selects the candidate node with the smallest failure rate from multiple candidate nodes 310 as the target node.
[0078] As another possible implementation, the scheduling device 100 selects any one candidate node as the target node from a plurality of candidate nodes whose failure rates are less than a preset first failure rate threshold value.
[0079] Optionally, in order to promptly inform the user of the status of the target node 310 when executing the database operation, the scheduling device 100 compares the updated historical statistical data with the preset alarm condition; if the updated historical statistical data meets the preset alarm condition, the user is provided with alarm information.
[0080] Taking the historical statistical data as the failure rate of each node 310 executing the database operation action as an example, in a possible example, the preset alarm condition is to provide an alarm message to the user if the failure rate of each node 310 executing the database operation action exceeds 30%.
[0081] Based on this, the scheduling device 100 updates the failure rate of the target node executing the database operation action according to the processing result of whether the target node successfully processes the database operation request, and obtains the updated failure rate. If the updated failure rate exceeds 30%, the failure rate of the target node when executing the database operation action is high, which is an abnormal phenomenon, and an alarm information is provided to the user.
[0082] Among them, the cause of this abnormal phenomenon may be, but is not limited to, hardware failure of node 310, failure of database software configured by node 310, unreasonable design of data tables in the database, grammatical problems in database operation statements written by users for operating the database, or insufficient remaining computing resources of node 310.
[0083] Taking the unreasonable design of the data table in the database as an example, the database operation action includes the database operation type and the operation object. When the scheduling device 100 obtains the operation result of whether the target node successfully executes the database operation action, it also obtains the remaining computer resources of the target node when executing the database operation action.
[0084] If the operation result shows that the target node fails to perform the database operation, and the remaining computer resources are greater than the preset second resource threshold, the total number of failures of the operation object is increased. The total number of failures of the operation object is used to count the total number of times all nodes fail to perform the database operation when the remaining computer resources are greater than the preset second resource threshold.
[0085] It is worth noting that if the remaining computer resources are greater than the preset second resource threshold, it indicates that the remaining computer resources of the node 310 are sufficient, thereby eliminating the impact caused by insufficient remaining computer resources as much as possible.
[0086] The abnormal phenomenon of high failure rate caused by unreasonable data table design is not closely related to the computer resources of each node itself. Therefore, during the statistical period, the scheduling device calculates the failure rate of all nodes executing the database operation action based on the number of failures of the operation object and the total number of times all nodes execute the database operation action. If the failure rate is greater than the preset second failure rate threshold, it means that the operation object operated by the database operation action may have an unreasonable data table.
[0087] It should be understood that if the data table of the operation object is not designed properly, it will cause excessive time to be consumed when operating the operation object, which will lead to operation failure.
[0088] In order to obtain the database operation request initiated by the client 200, as a possible implementation, a monitoring code for monitoring the database operation code is configured in the scheduling device 100. When the database operation code is executed, the monitoring code is triggered, and the scheduling device 100 obtains the database operation request through the monitoring code.
[0089] The monitoring code is configured by using the tool AspectJ weaver. It should be understood that the tool AspectJ weaver allows developers to avoid writing monitoring code for each code that accesses the database, which is convenient for developers and also beneficial for code maintenance.
[0090] For example, in the Spring framework developed based on Java, the library jdbc is used to access the database. Among them, the commonly used functions when accessing the database include "boolen execute()", "ResultSet executeQurey()", "intexecuteUpdate", etc. When the above functions are executed, the monitoring code will be triggered, and the database operation request will be obtained through the monitoring code.
[0091] Please refer to Figure 4 This embodiment further provides a data access device 110, which is applied to a scheduling device 100 that communicates with a client 200 and a plurality of nodes 310 in a database cluster 300. The data access device 110 includes at least one functional module that can be stored in a memory 120 in the form of software. Functionally, the data access device 110 may include a request acquisition module 1101, a request parsing module 1102, a data acquisition module 1103, a candidate node module 1104, a target node module 1105, and a request allocation module 1106.
[0092] The request acquisition module 1101 is used to acquire the database operation request initiated by the client 200 .
[0093] In the embodiment of the present application, the request acquisition module 1101 is used to execute Figure 3 For the detailed description of step S100 in the request acquisition module 1101, please refer to the detailed description of step S100.
[0094] The request parsing module 1102 is used to parse the database operation request and obtain the database operation action corresponding to the database operation request.
[0095] In the embodiment of the present application, the request parsing module 1102 is used to execute Figure 3 For the detailed description of step S200 in the request parsing module 1102, please refer to the detailed description of step S200.
[0096] The candidate node module 1104 is used to determine a candidate node from the multiple nodes according to a preset load balancing condition.
[0097] In the embodiment of the present application, the candidate node module 1104 is used to execute Figure 3For the detailed description of step S300 in the embodiment, reference may be made to the detailed description of step S300 for the detailed description of the candidate node module 1104.
[0098] The data acquisition module 1103 is used to obtain historical statistical data on whether each candidate node successfully executes the database operation action.
[0099] In the embodiment of the present application, the data acquisition module 1103 is used to execute Figure 3 For the detailed description of the data acquisition module 1103 , please refer to the detailed description of step S400 .
[0100] The target node module 1105 is used to select a target node from the candidate nodes according to the historical statistical data.
[0101] In the embodiment of the present application, the target node module 1105 is used to execute Figure 3 For step S500 in the embodiment, for a detailed description of the target node module 1105, please refer to the detailed description of step S500.
[0102] The request allocation module 1106 is used to allocate the database operation request to the target node for processing, so as to improve the success rate of executing the database operation action.
[0103] In the embodiment of the present application, the request allocation module 1106 is used to execute Figure 3 For the detailed description of step S600 in the request allocation module 1106, please refer to the detailed description of step S600.
[0104] An embodiment of the present application also provides a scheduling device 100, which includes a processor 130 and a memory 120, wherein the memory 120 stores a machine executable program that can be executed by the processor 130, and when the machine executable program is executed by the processor 130, the data access method is implemented.
[0105] The embodiment of the present application further provides a storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by the processor 130, the data access method is implemented.
[0106] In summary, the embodiments of the present application provide a data access method, apparatus, scheduling device, and storage medium. When allocating database operation requests, the scheduling device makes allocations with reference to historical statistical data of whether each candidate node successfully executes the database operation action. Since the historical statistical data of whether each candidate node successfully executes the database operation action can truly reflect the actual situation of each candidate node processing the database operation action, the allocation result of the scheduling device allocating the database operation request based on the historical statistical data of whether each candidate node successfully executes the database operation action is more reasonable, thereby being able to improve the success rate of executing the database operation action.
[0107] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to the multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of boxes in the block diagram and / or the flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0108] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0109] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several 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 methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0110] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article 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, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0111] The above are only various implementations of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A data access method, characterized in that: A scheduling device for communicating with a client and multiple nodes in a database cluster, the method comprising: Obtaining a database operation request initiated by the client; Parsing the database operation request to obtain a database operation action corresponding to the database operation request, wherein the database operation action includes a database operation type and an operation object, and the operation object is a data table; Determine a candidate node from the multiple nodes according to a preset load balancing condition; Obtain historical statistical data on whether each candidate node successfully executes the database operation action; Selecting a target node from the candidate nodes according to the historical statistical data; Allocating the database operation request to the target node for processing to improve the success rate of executing the database operation action; If the operation result shows that the target node fails to perform the database operation action, and the remaining computer resources are greater than the preset second resource threshold, the total number of failures of the operation object is increased, wherein the total number of failures of the operation object is used for statistics, and when the remaining computer resources are greater than the preset second resource threshold, the total number of failures of all nodes to perform the database operation action; Calculate the failure rate of all nodes executing the database operation action according to the total number of failures of the operation object and the total number of times all nodes execute the database operation action; If the failure rate is greater than a preset second failure rate threshold, it is determined that the operation object operated by the database operation action may have an unreasonable data table.
2. The data access method according to claim 1, characterized in that: The step of parsing the database operation request to obtain a database operation action corresponding to the database operation request includes: Parsing the database operation request to obtain the database operation type and the operation object; The step of obtaining historical statistical data of whether each candidate node successfully executes the database operation action comprises: Obtain historical statistical data on whether each candidate node successfully executes the database operation type on the operation object.
3. The data access method according to claim 1, characterized in that: The method further comprises: Obtaining a processing result of whether the target node successfully processes the database operation request; The historical statistical data of whether the target node successfully executes the database operation action is updated according to the processing result.
4. The data access method according to claim 3, characterized in that: The method further comprises: Compare the updated historical statistical data of the target node with the preset alarm conditions; If the updated historical statistical data meets the preset alarm condition, alarm information is provided to the user.
5. The data access method according to claim 1, characterized in that: The scheduling device is configured with a monitoring code for monitoring the database operation code, and the step of obtaining the database operation request initiated by the client includes: When the database operation code is executed, the monitoring code is triggered; The database operation request is obtained through the monitoring code.
6. The data access method according to claim 5, characterized in that: The monitoring code is configured through the tool AspectJweaver.
7. The data access method according to claim 1, characterized in that: The historical statistical data is a failure rate of each candidate node executing the database operation action, and the step of selecting a target node from the candidate nodes according to the historical statistical data includes: A node with the smallest failure rate is selected from the candidate nodes according to the failure rate as the target node.
8. A data access device, characterized in that: A scheduling device for communicating with a client and multiple nodes in a database cluster, wherein the data access device includes a request acquisition module, a request parsing module, a data acquisition module, a candidate node module, a target node module, and a request allocation module; The request acquisition module is used to acquire the database operation request initiated by the client; The request parsing module is used to parse the database operation request to obtain a database operation action corresponding to the database operation request, wherein the database operation action includes a database operation type and an operation object, and the operation object is a data table; The candidate node module is used to determine a candidate node from the multiple nodes according to a preset load balancing condition; The data acquisition module is used to obtain historical statistical data on whether each candidate node successfully executes the database operation action; The target node module is used to select a target node from the candidate nodes according to the historical statistical data; The request allocation module is used to allocate the database operation request to the target node for processing, so as to improve the success rate of executing the database operation action; The data access device is further used to increase the total number of failures of the operation object if the operation result shows that the target node fails to perform the database operation action and the remaining computer resources are greater than a preset second resource threshold, wherein the total number of failures of the operation object is used to count the total number of times that all nodes fail to perform the database operation action when the remaining computer resources are greater than the preset second resource threshold; The scheduling device calculates the failure rate of all nodes executing the database operation action according to the total number of failures of the operation object and the total number of times all nodes execute the database operation action; If the failure rate is greater than a preset second failure rate threshold, it is determined that the operation object operated by the database operation action may have an unreasonable data table.
9. A scheduling device, characterized in that: The scheduling device includes a processor and a memory, wherein the memory stores a machine executable program that can be executed by the processor, and when the machine executable program is executed by the processor, the data access method according to any one of claims 1 to 7 is implemented.
10. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the data access method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Clustered database system dynamic loading balancing method
CN101169785A
Resource processing platform confirmation method and device, electronic equipment and medium
CN110351327A