Graph database control method and related equipment thereof
By monitoring the capacity and usage time of the graph database, the status determination results are generated to control the read operation, which solves the overload crash problem of the graph database when used beyond the standard, and improves the stability and resource utilization of the system.
Patent Information
- Application Number
- CN202411759055.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2024-12-31
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The overload crash caused by the over-regulated capacity and usage time limit of the graph database is difficult to operate effectively and stably.
By monitoring the capacity usage and usage time of the graph database, comparing with the set threshold value, generating the status determination result. If the value is not exceeded, the read operation will be performed, and the reading will be prohibited, so as to realize the control of the graph database.
It effectively reduces the overuse of graph database resources, improves the stability and operational reliability of the system, and prevents overload and crashes.
Smart Images

Figure CN119226298A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of graph databases, and in particular to a graph database control method and related equipment. Background Art
[0002] Graph Database is an open source distributed non-relational database. It uses nodes and edges as basic storage units and is a data management system designed with the principle of efficient storage and query of graph data, such as Neo4j, JanusGraph, ArangoDB and OrientDB.
[0003] Graph databases differ significantly from relational databases in terms of data storage, query, and data structure. Graph data structures directly store dependencies between nodes, while relational databases and other types of non-relational databases represent relationships between data in an indirect way. Compared to traditional relational databases, graph databases can adapt to various business scenarios in a more flexible form, namely, a combination of vertices and edges, and can implement analysis of complex relational networks with an efficient and concise graph query language.
[0004] Currently, due to the excessive use of the graph database's capacity, the graph database is unable to operate stably. Summary of the invention
[0005] The present application provides a graph database control method and related equipment for managing and controlling the reading of a graph database to reduce excessive use of graph database resources and thereby improve the stability of the graph database.
[0006] A first aspect of the present application provides a method for controlling a graph database, comprising: Obtain a graph database access request sent by a terminal, the graph database access request including a read request for reading the graph database; obtain a status determination result of the graph database, the status determination result including a capacity determination result and a usage time determination result of the graph database; in response to at least a portion of the status determination result not exceeding a value, execute a read operation on the graph database; in response to the status determination result exceeding a value, prohibit executing a read operation on the graph database.
[0007] In some embodiments, before obtaining the state determination result of the graph database, the control method of the graph database further includes: comparing the usage capacity of the graph database with a capacity threshold, and comparing the usage time of the graph database with a usage time threshold, so as to generate the state determination result; In some embodiments, before obtaining the status determination result of the graph database, the graph database control method further includes: caching the generated status determination result so that when a graph database access request sent by the terminal is received, the status determination result of the cache status is obtained.
[0008] In some embodiments, the status determination result also includes a usage duration determination result. Before forming the status determination result, the control method of the graph database also includes: comparing the usage duration of the graph database with a usage duration threshold to obtain the usage duration determination result.
[0009] In some implementations, the capacity threshold, the usage duration threshold, and the continued usage duration threshold are adjustable thresholds.
[0010] In some implementations, the status determination result is generated according to a preset period and is cached synchronously, so that when a graph database access request sent by the terminal is received, the status determination result of the cache status is obtained.
[0011] In some embodiments, the responding that at least part of the state determination result is not exceeded includes: responding that the usage time determination result, the continued usage time determination result, and the capacity determination result are not exceeded; or responding that the usage time determination result and the continued usage time determination result are not exceeded, responding that the capacity determination result is exceeded; A second aspect of the present application provides a method for controlling a graph database, comprising: sending a graph database access request to a server for requesting to read data of the graph database, so that the server obtains a status determination result of the graph database, and then, based on the status determination result, determines whether to perform a read operation on the graph database, wherein the status determination result includes a capacity determination result and a usage time determination result of the graph database.
[0012] The third aspect of the present application provides an electronic device, comprising a processor and a memory connected to the processor, wherein the memory stores program instructions; the processor is used to execute the program instructions stored in the memory to implement the method of any implementation of the first aspect or / and the second aspect.
[0013] A fourth aspect of the present application provides a computer-readable storage medium, comprising instructions, which, when executed on a computer, enables the computer to execute a method of any one of the embodiments of the first aspect or / and the second aspect.
[0014] Compared with the prior art, the technical solution of the present application is as follows: after receiving the graph database reading request sent by the terminal, the status determination result of the graph database including the capacity determination result and the usage time determination result is obtained, and then if the response status determination result is at least partially within the value range, the reading operation on the graph database is executed; if the response status determination result exceeds the value range, the reading operation on the graph database is prohibited, thereby realizing effective management and control of the graph database, reducing excessive use of graph database resources, and thereby improving the stability of the graph database. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0016] Figure 1 It is a schematic diagram of a control method of a graph database in an embodiment of the present application; Figure 2 This is a schematic diagram of a state determination result generation process of a graph database in an embodiment of the present application; Figure 3a This is a timing diagram of a state determination result generation process of a graph database in an embodiment of the present application; Figure 3b This is a timing diagram of another graph database state determination result generation process in an embodiment of the present application; Figure 4 It is a schematic diagram of a method of performing an operation based on a state determination result of a graph database according to an embodiment of the present application; Figure 5 It is a schematic diagram of a method of performing an operation based on a state determination result of a graph database according to an embodiment of the present application; Figure 6 This is a schematic diagram of the interaction process between a terminal and a server in an embodiment of the present application; Figure 7 It is a schematic diagram of a graph database control device according to an embodiment of the present application; Figure 8 is a schematic diagram of another graph database control device according to an embodiment of the present application; Fig. 9 It is an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0017] The scheme of the embodiment of the present application is described in detail below in conjunction with the drawings of the specification.
[0018] In the following description, for the purpose of explanation rather than limitation, specific details such as specific system structures, interfaces, and technologies are provided to facilitate a thorough understanding of the present application.
[0019] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0020] The terms "first", "second" and "third" in this application are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined as "first", "second" and "third" can explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "multiple" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined. All directional indications (such as up, down, left, right, front, back...) in the embodiments of this application are only used to explain the relative position relationship, movement, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication also changes accordingly. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices.
[0021] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0022] Graph Database is a new type of NoSQL database based on graph theory. Its data storage structure and data query method are based on graph theory. The basic elements of a graph in graph theory are nodes and edges, which correspond to nodes and relationships in a graph database. Common graph databases include neo4j, JanusGraph, ArangoDB, OrientDB, etc.
[0023] Currently, the overload and crash of graph databases due to overuse of the capacity limit and / or overuse of the usage time limit of graph databases often occurs. In this regard, this application monitors whether the capacity usage and usage time of graph databases during access are in compliance with the usage limit, thereby achieving control over graph databases. JanusGraph graph database is now used as an example, which is referred to as graph database in the following. This application does not limit this.
[0024] See also Figure 1 , Figure 1 It shows whether to perform a read operation on the graph database based on the state determination result of the graph database, including: 101: receiving a graph database access request sent by a terminal, wherein the graph database access request includes a read request for reading the graph database; After the terminal sends a graph database access request to the server, the server receives the graph database access request.
[0025] In some implementations, the graph database access request includes a read request to read the graph database and / or a write request to write to the graph database.
[0026] In some implementations, the server may separate an independent write request and an independent read request from a graph database access request that includes a write request and a read request.
[0027] 102: Obtaining a state determination result of the graph database, where the state determination result includes a capacity determination result and a usage time determination result of the graph database; After obtaining the read request, the server obtains the state determination result of the graph data. The state determination result includes the capacity determination result and the usage time determination result. The capacity determination result is the determination result of whether the value is exceeded based on the usage capacity and capacity threshold of the graph database. The usage time determination result is the determination result of whether the value is exceeded based on the usage time of the graph database and the usage time threshold.
[0028] It can be understood that the used capacity is the capacity of the graph database that has been used under the total capacity, and the used duration is the time that the graph database has been used under the total used duration. The capacity threshold and the used duration threshold are used to determine whether the corresponding used capacity and used duration exceed the value.
[0029] 103: If at least part of the response status determination result does not exceed the value, a read operation on the graph database is performed; In some implementations, the server determines that the capacity determination result is not exceeded based on the state determination result, and then performs a read operation on the graph data.
[0030] In some implementations, the server determines that the usage duration determination result has not exceeded the value based on the status determination result, and then performs a read operation on the graph data.
[0031] In some implementations, the server determines based on the status determination result that the usage time determination result has not exceeded the value and the capacity determination result has not exceeded the value, and then performs a read operation on the graph data.
[0032] 104: If the response status is judged to be excessive, the read operation on the graph database is prohibited.
[0033] If the server determines based on the status determination result that the capacity determination result exceeds the value and the usage time determination result exceeds the value, the read operation on the graph database is prohibited.
[0034] In some implementations, when a prohibition on executing a read operation on a graph database occurs, a corresponding prompt message is generated and returned to the terminal.
[0035] It can be understood that by determining whether the status of the graph database exceeds the value and executing permission or prohibition of reading operations, not only the monitoring of the graph database status is achieved, but also the effective control of the reading operations of the graph database is achieved, reducing the excessive use of graph database resources, and thus improving the stability of the graph data.
[0036] In some implementations, the state determination result of the graph database further includes a usage duration determination result, which is a determination result of whether the usage duration of the graph database and the usage duration threshold are exceeded based on the usage duration of the graph database.
[0037] The determination process is described based on the status determination results, including the extended duration determination results, the usage duration determination results, and the capacity determination results. Please refer to Figure 2 , including: 201: Compare the usage time with the usage time threshold to generate a usage time determination result; The server obtains the usage time of the graph database, and then compares the usage time with the usage time threshold. When it is determined that the usage time is greater than or equal to the usage time threshold, the generated result is a usage time determination result of exceeding the value; when it is determined that the usage time is less than the usage time threshold, the generated result is a usage time determination result of not exceeding the value.
[0038] 202: Compare the usage duration with the usage duration threshold to generate a usage duration determination result; The server obtains the usage duration of the graph database, and then compares the usage duration with the usage duration threshold. When it is determined that the usage duration is greater than or equal to the usage duration threshold, a result is generated as a usage duration determination result of exceeding the value; when it is determined that the usage duration is less than the usage duration threshold, a result is generated as a usage duration determination result of not exceeding the value.
[0039] 203: Compare the used capacity with the capacity threshold to generate a capacity determination result.
[0040] The server obtains the used capacity of the graph database, and then compares the used capacity with the capacity threshold. When it is determined that the used capacity is greater than or equal to the capacity threshold, the generated result is an over-valued capacity determination result; when it is determined that the used capacity is less than the capacity threshold, the generated result is a non-exceeded capacity determination result.
[0041] In some implementations, the capacity threshold, the duration threshold, and the usage duration threshold are adjustable.
[0042] In some implementations, the capacity determination result, the continuous use time determination result, and the usage time determination result may be performed simultaneously or sequentially.
[0043] For timing, see Figure 3a , which shows a schematic diagram of a timing flow, specifically, first executing step 201, and when the usage duration determination result of step 201 is not exceeded, then executing step 202. After executing step 202, if it is determined that the continued usage duration determination result of step 202 is exceeded, then executing step 203; if it is determined that the continued usage duration determination result of step 202 is not exceeded, then stopping executing step 203. Optionally, please refer to Figure 3b , which shows another timing flow diagram, specifically, first executing step 201, and when the usage duration determination result of step 201 is not exceeded, then executing step 202. After executing step 202, if it is determined that the continued usage duration determination result of step 202 is exceeded, then stopping executing step 203.
[0044] It should be pointed out that Figure 2 The timing of the implementation method may be before, after or at the same time as step 101.
[0045] It can be understood that, compared with generating the status determination results simultaneously, generating the status determination results in a time-series manner not only reduces the power consumption of the server, but also increases the running speed of the entire reading operation, thereby enhancing the user experience.
[0046] Furthermore, when the status determination result includes the capacity determination result, the usage time determination result and the extended usage time determination result, please refer to Figure 4 and Figure 5 , Figure 4 The following shows the processing method for the case where all three items in step 103 do not exceed the value. Figure 5 The method of handling the situation in which some of the three items do not exceed the value and some exceed the value in step 103 is shown. Figure 4 Specifically include: 401: If the usage time determination result, the extended usage time determination result, and the capacity determination result do not exceed the value, the read operation on the graph database is performed.
[0047] After obtaining the usage time determination result, the renewal time determination result and the capacity determination result, the server determines that all three are within the value range, and then performs a read operation on the graph database.
[0048] Figure 5 Specifically include: 501: If the usage duration determination result and the renewal duration determination result do not exceed the value, and the capacity determination result exceeds the value, a read operation on the graph database is performed.
[0049] After obtaining the usage time determination result, the continued usage time determination result and the capacity determination result, the server determines that the usage time determination result and the continued usage time determination result are not exceeded, and the capacity determination result exceeds the value, and then performs a read operation on the graph database.
[0050] In some implementations, the state determination result of the graph database may be generated according to a preset period, wherein the preset period may also be adjustable.
[0051] It should be noted that since the state determination result of the graph database is generated periodically, when the server receives the graph database access request sent by the terminal, it is not necessary to directly trigger the execution of the aforementioned Figure 2 The execution process of the implementation method in the embodiment can directly obtain the status determination result that the server may have generated, that is, Figure 2 The implementation method does not have a strict time sequence relationship with the server receiving the graph data access request. The state determination result of the graph database can be generated before, after, or simultaneously with the server receiving the graph database access request sent by the terminal.
[0052] It can be understood that by setting the periodic generation of the graph database status determination results, the elastic operation of the graph database can be improved before or at the same time as the server receives the graph database access request sent by the terminal, and the situation of insufficient graph database resource utilization caused by repeated queries of the graph database status determination results during the period of explosive access by a large number of users is reduced.
[0053] In order to further reduce the user waiting time and reduce the period of explosive access by a large number of users, there may be insufficient resource utilization caused by repeated queries on the status determination results of the graph database. In some embodiments, the status determination results of the graph database generated according to a preset period are cached, so that after receiving the graph database access request sent by the terminal, the status determination results in the cached state are obtained, thereby improving the response speed.
[0054] Furthermore, the state determination result of the graph database may also be cached according to a cache period. In some implementations, the cache period may be adjustable, and the cache period may be the same as or different from the preset period.
[0055] In some implementations, in order to reduce server power consumption, after the state determination result of the graph database is generated according to a preset period, it is cached synchronously so that when a graph database access request sent by the terminal is received, the state determination result of the cache state is obtained.
[0056] It can be understood that the present application reduces user waiting time and reduces downtime caused by graph database overload due to exceeding the capacity limit of the graph database and / or exceeding the usage time limit of the graph database during explosive access by a large number of users through the dual settings of periodically generating the status determination results of the graph database and caching them. This not only enhances the user experience, but also improves the stable operation of the graph database.
[0057] See also Figure 6 , Figure 6 The diagram shows the interaction process between the terminal and the server, including: 601: The terminal sends a graph database access request to the server; In response to the user's instruction operation, the terminal sends a graph database access request to the server for requesting to read the data of the graph database, so that the server obtains the status determination result of the graph database, and then executes whether to perform a read operation on the graph database according to the status determination result, wherein the status determination result includes the capacity determination result and the usage time determination result of the graph database.
[0058] 602: The server obtains the state determination result of the graph database; After receiving the graph database access request, the server obtains the graph database status determination result, wherein the graph database status determination result may be generated before, after, or simultaneously with receiving the graph database access request sent by the terminal. For the generation method, please refer to Figure 2 The implementation method will not be described in detail here.
[0059] 603: Execute a read operation of allowing or prohibiting reading of graph data according to the status determination result.
[0060] Please refer to the aforementioned steps 102, 103, 401 and 501 for details, which will not be repeated here.
[0061] See also Figure 7 , Figure 7 A schematic diagram of a graph database control device is shown, comprising: A first acquisition module 701 is used to acquire a graph database access request sent by a terminal, wherein the graph database access request includes a read request for reading the graph database; The second acquisition module 702 is used to obtain the state determination result of the graph database, wherein the state determination result includes the capacity determination result and the usage time determination result of the graph database; The execution module 703 is used to execute the reading operation on the graph database in response to the state determination result at least partially not exceeding the value; and to prohibit the reading operation on the graph database in response to the state determination result exceeding the value.
[0062] This application also includes a library control device, see Figure 8 ,include: The sending module 801 is used to send a graph database access request to the server for requesting to read the data of the graph database, so that the server obtains the status determination result of the graph database, and then executes whether to perform a read operation on the graph database according to the status determination result, wherein the status determination result includes the capacity determination result and the usage time determination result of the graph database.
[0063] This application also includes an electronic device, see Fig. 9 The method comprises: a memory 901 and a processor 902; wherein the memory is used to store programs; and the processor is used to execute the programs in the memory, including executing any one of the aforementioned embodiments; In some implementations, a bus system is further provided, which is used to connect the memory and the processor so that the memory and the processor can communicate with each other.
[0064] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0065] In some embodiments, the memory may be an internal storage unit of the cloud device, for example, a hard disk or memory of the cloud device. In other embodiments, the memory may also be an external storage device of the cloud device, for example, a plug-in hard disk equipped on the cloud device, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. Furthermore, the memory may also include both an internal storage unit of the cloud device and an external storage device. The memory is used to store an operating system, an application, a boot loader (BootLoader), data, and other programs, such as program code of a computer program. The memory may also be used to temporarily store data that has been output or is to be output.
[0066] The present application also includes a computer-readable storage medium, comprising instructions, which, when executed on a computer, enable the computer to perform any one of the aforementioned embodiments.
[0067] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of each of the above-mentioned method embodiments can be implemented.
[0068] The computer program includes computer program code, which may be in source code form, object code form, executable file or some intermediate form. The computer readable medium may at least include: any entity or device capable of carrying the computer program code to the camera device / terminal device, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk.
[0069] The above are only implementation methods of the present application, and are not intended to limit the patent protection scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A control method for a graph database, characterized in that: The control method of the graph database includes: Obtaining a graph database access request sent by a terminal, wherein the graph database access request includes a read request for reading the graph database; Obtaining a state determination result of the graph database, wherein the state determination result includes a capacity determination result and a usage time determination result of the graph database; In response to the state determination result being at least partially not exceeding the value, performing a read operation on the graph database; In response to the state determination result exceeding the value, the read operation on the graph database is prohibited.
2. The control method of the graph database according to claim 1, characterized in that: Before obtaining the state determination result of the graph database, the control method of the graph database further includes: The usage capacity of the graph database is compared with a capacity threshold, and the usage time of the graph database is compared with a usage time threshold to generate the status determination result.
3. The control method of the graph database according to claim 2, characterized in that: Before obtaining the state determination result of the graph database, the control method of the graph database further includes: The generated status determination result is cached so that upon receiving a graph database access request sent by the terminal, the status determination result of the cache status is obtained.
4. The control method of the graph database according to claim 2 or 3, characterized in that: The state determination result also includes a use duration determination result, and before generating the state determination result, the following is further included: The usage duration of the graph database is compared with a usage duration threshold to obtain the usage duration determination result.
5. The control method of the graph database according to claim 4, characterized in that: The capacity threshold, the usage duration threshold, and the continued usage duration threshold are adjustable thresholds.
6. The control method of the graph database according to claim 4, characterized in that: The status determination result is generated according to a preset period and cached synchronously, so that when a graph database access request sent by the terminal is received, the status determination result of the cache status is obtained.
7. The control method of the graph database according to claim 4, characterized in that: The responding that at least part of the state determination result does not exceed the value includes: In response to the usage time determination result, the continued usage time determination result, and the capacity determination result not exceeding the value; or, In response to the usage time determination result and the continued usage time determination result not exceeding the value, in response to the capacity determination result exceeding the value.
8. A control method for a graph database, characterized in that: The control method of the graph database includes: A graph database access request for reading data of the graph database is sent to a server, so that the server obtains a status determination result of the graph database, and then determines whether to perform a read operation on the graph database based on the status determination result, wherein the status determination result includes a capacity determination result and a usage time determination result of the graph database.
9. An electronic device, characterized in that: The invention comprises a processor and a memory connected to the processor, wherein: The memory stores program instructions; The processor is configured to execute the program instructions stored in the memory to implement the method according to any one of claims 1 to 8.
10. A computer-readable storage medium comprising instructions, characterized in that: When the method is executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Method, device and system for controlling access to database resources
CN102915374A
Method, device and system for requesting data
CN104408110A
Database access control method and apparatus
CN106650501A
Database access method and device, computer equipment and storage medium
CN110727698A
Data request processing method and device and computing equipment
CN118885509A
