A GraphQL Query Overhead Optimization Method Based on Graph Model
By building a directed graph model and a cache construction method based on syntax structure in the GraphQL system, the problem of excessive overhead of GraphQL query is solved, and efficient query and data consistency are achieved.
Patent Information
- Application Number
- CN202210530499.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-16
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2042-05-16
AI Technical Summary
GraphQL query has problems with excessive overhead, especially because the number of data source accesses and query results caused by nested queries have increased exponentially, which seriously affects query efficiency.
Using a graph model-based method, the entity cache data is managed by building a directed graph, and a cache dictionary is built based on the syntax structure characteristics of the GraphQL query statement, path information and filter condition information are extracted, cache keys are constructed, and query results are optimized.
It effectively reduces the overhead of GraphQL query, improves query efficiency, improves cache hit rate, and solves data consistency problems at a lower cost when data is updated.
Smart Images

Figure CN114896470B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method for optimizing GraphQL query overhead based on a graph model, belonging to the technical field of web system overhead optimization. Background Art
[0002] GraphQL was proposed by Facebook in 2012 and has been widely used in web application development in recent years. According to the official definition, GraphQL is an API query language and also a server-side runtime that can perform query operations on data based on a user-defined type system. GraphQL does not depend on any specific database or storage engine, but is supported by the user's existing code and data. Compared with Restful API, GraphQL has the advantages of reducing network communication overhead, reducing over-fetching of attributes, and facilitating front-end and back-end connectivity. However, the flexibility of queries also brings corresponding overhead costs.
[0003] There is a problem of excessive overhead in GraphQL queries. GraphQL supports the syntax of nested queries and can parse GraphQL query statements into a multi-way tree. As the number of nested levels increases, the number of accesses to the data source will increase exponentially (access to the data source is considered a time-consuming operation), and the size of the query result will also increase exponentially, which will cause great pressure on the server and seriously affect the query efficiency of GraphQL.
[0004] Existing methods reduce query overhead through methods such as overhead analysis, optimization based on development scenarios, and data caching. The core of overhead evaluation is to statically analyze the hierarchical structure information of the query statement before the GraphQL query statement enters the GraphQL runtime system, so as to estimate the actual execution overhead of the query statement and filter out query statements with excessive overhead. Although this method can filter out some query statements with excessive overhead, it cannot reduce the running overhead of query statements that can enter the system and be actually executed. The core of optimization based on development scenarios is that users optimize queries according to specific scenario applications during specific application development. The main methods include using the batch processing interface of the database to integrate a large number of similar single query operations (such as the batch interface of mongodb, etc.). This optimization method is coupled with the actual running scenario of the system and cannot be integrated into a general framework. Developers cannot use it out of the box and more rely on the actual experience of developers.
[0005] Traditional data caching methods store a dictionary of a certain number of query statements and query results in a caching medium. However, this approach has problems of low cache hit rate and excessive overhead during data updates in GraphQL query scenarios. Since the syntax definition of GraphQL query statements will be refined to the declaration of specific attribute items of the data entities to be queried, there are a large number of different query statement instances with the same query statement structure, thus resulting in a low cache hit rate. And during data updates, because GraphQL supports nested queries, it is necessary to traverse the cache and analyze the entity relationship model information of the cache keys one by one to determine whether the cache is affected by the data update. This traditional caching method will bring huge overhead to the system when data updates occur. Summary of the Invention
[0006] Object of the Invention: Aiming at the problem of excessive query overhead in GraphQL applications, the present invention provides a method for optimizing GraphQL query overhead based on a graph model to optimize GraphQL query overhead and improve GraphQL query efficiency.
[0007] Technical Solution: A method for optimizing GraphQL query overhead based on a graph model, which supports a system implemented based on the GraphQL framework to perform overhead optimization through data caching during query operations and improve data query efficiency; including 1) constructing a directed graph based on the entity relationship model description file in the GraphQL system to manage entity cache data; 2) constructing a cache dictionary based on the syntax structure characteristics of GraphQL query statements, extracting path information and filtering condition information in the query statements, and constructing cache keys based on the path information and filtering condition information; 3) storing query results into the directed graph according to the entity relationship model, constructing node caches, and improving the cache hit rate during the matching process of GraphQL query instance caches; 4) performing cache updates based on update statements and the data cache directed graph model to ensure data consistency.
[0008] In the above 1), a data cache directed graph is constructed based on an instance of TypeDefinitionRegistry (type definition registry), and the entity relationship model defined based on GraphQL SDL (GraphQL schema definition language) is uniformly parsed and organized into a directed graph model in memory, and cache data of entities are stored in each graph node.
[0009] The data cache directed graph model constructed based on the TypeDefinitionRegistry instance is a system independent of the GraphQL framework implementation. The data types of the entity relationship model include string, int, float, boolean, and array. The association information between entities and entity cache information are globally managed based on the data cache directed graph model. The construction of the data cache directed graph model is generated after the initialization of the system implemented by the GraphQL framework is completed. When the GraphQL framework parses the entity relationship model defined by the GraphQL SDL to obtain the TypeDefinitionRegistry instance, the entity directed graph model is constructed based on the information in the TypeDefinitionRegistry instance.
[0010] This method uses data caching to reduce the query overhead of the GraphQL system and uses the directed graph model of data caching to organize and manage the data caching of GraphQL. For the construction of the data cache directed graph model, a globally unique directed acyclic graph is constructed based on the adjacency list. The entity node contains entity attribute information, node id, entity association node information list, and entity cache instance:
[0011] For the entity attribute information, it is consistent with the attribute information defined in the GraphQL SDL, which only contains attribute information of string, int, float, boolean, and array types, and is saved in dictionary form. In addition, the source file of the attribute information is backed up.
[0012] For the entity association node information list, the attribute information that is not of string, int, float, boolean, and array types is parsed, and it is verified whether the entity model corresponding to the attribute is a defined entity model. If it is confirmed as a defined entity model and the verification is successful, the entity model is stored in the association node list as an association node. If it is not a defined entity model, then the verification fails, and the verification error information is recorded.
[0013] For the node id, the entity model is globally unique in the running system, and the node id is a globally unique identifier.
[0014] For the entity cache instance, it is implemented using the open-source cache framework caffine. Each entity node in the directed graph has a cache instance, and the cache size can be dynamically adjusted.
[0015] In the construction of the cache dictionary based on the syntactic structure characteristics of the GraphQL query statement in 2), by parsing the nested hierarchical structure of the query statement, the complete path information and complete filtering condition information of each layer of entities are obtained. A globally unified query path information is constructed for each layer of entities as the cache key, and the complete query entity result is used as the cache value. The combination of the cache key and the cache value is the cache key-value pair.
[0016] Both the cache key and the cache value of the cache instance are implemented based on the query statement structure; cache key-value pairs are constructed for each layer of entities in the query statement. When traversing each layer of entity nodes based on the parsing result, the cache key-value pairs of this layer of entities are stored in the corresponding entity nodes in the data directed graph model; the cache key of the cache instance is constructed based on the path information and filtering conditions of the query statement. Caches are constructed for the entities defined in each layer of the query statement. Each layer of entities traverses upward in a loop through the associated parent node information until the root node is reached. During the traversal process, the path information of each layer is combined to obtain the complete path information, and the filtering conditions of each layer are combined to construct the complete filtering condition information. The path information and filtering conditions of the entity are matched and combined layer by layer to obtain the globally unified query path information; in order to reduce the space occupancy of the globally unified query path information as the cache key, the query path information is encrypted through an encryption algorithm, and the first several bits are intercepted as the cache key. A symmetric encryption algorithm can be used as long as the uniqueness of the query path information is not damaged, and the actual size of the cache key is less than the query path information; for the cache result, the complete entity data corresponding to the query result of each layer should be used as the cache value.
[0017] In 3), for the cache key-value pairs constructed in 2), the query results are stored in the cache instance of the entity model node in the directed graph according to the entity relationship model, so as to improve the cache hit rate during the GraphQL query instance cache matching process.
[0018] In 4), for the updated statement structure obtained after parsing by the GraphQL parser, all affected entity nodes are traversed and determined in the directed graph model. In order to solve the data inconsistency problem, the caches of the affected entity nodes are cleared.
[0019] Based on the update statement and the data cache directed graph model, cache updates are performed. The cache update strategy consists of two scenarios: cache replacement when the cache space of the entity node is full and adjustment of the entity node cache when data is updated in the system.
[0020] For the cache replacement scenario when the cache space of the entity node is full, it is implemented by using the Least Recently Used (LRU) cache replacement algorithm combined with the timed cache cleaning strategy. That is, when the cache of the entity node is called, the cache of the entity node is adjusted to the top cache slot through the LRU algorithm. Therefore, over time, the caches that are not frequently accessed will appear in the lower cache slots. When the cache space is full, the caches that are not frequently accessed will be eliminated. The so-called "not frequently accessed" means that the number of accesses is less than the threshold set by the user. In addition, the strategy also combines the method of timed cache cleaning, that is, globally cleaning the caches that have not been accessed within the set time.
[0021] For the scenario of adjusting the entity node cache when the system has data updates, the strategy will determine the list of entity nodes affected by the update statement based on the structure of the update statement and the model association information of the data cache directed graph model, and clear the caches of the entity node list.
[0022] For the parsing process of the update statement structure, it is implemented based on a publicly available parser or a parser implemented by the user. The parsing result only needs to conform to the description information of the data update statement. For the parsed data update statement, extract the list of entity models directly declared in the statement. For the entity model information directly declared in the extracted statement, based on the directed graph model, find the downstream node information of the directly declared entity model. The downstream node refers to all successor nodes of the associated node, and clear the cache content of the above entity nodes to ensure data consistency.
[0023] 1) Build a directed graph to manage entity cache data according to the entity relationship model description file in the GraphQL system. The implementation process is as follows:
[0024] 101) When the GraphQL system starts, the GraphQL framework parses the entity relationship model description file to generate a TypeDefinitionRegistry instance;
[0025] 102) Obtain the entity relationship model in the GraphQL framework from the TypeDefinitionRegistry;
[0026] 103) Based on the adjacency list, construct a global directed graph instance of the entity relationship model. The directed graph nodes describe the attribute information of the entity model and the associated entity list;
[0027] 104) Initialize a cache instance for each node in the directed graph instance.
[0028] 2) Build a cache dictionary based on the syntactic structure characteristics of the GraphQL query statement. The implementation process is as follows:
[0029] 201) Analyze the GraphQL query statement instance layer by layer to obtain a query statement parse tree. Obtain the entity model information of each layer in the GraphQL query statement parse tree and the entity model information of its parent node, and traverse upward in a loop until the root node of the query statement parse tree, so as to construct the complete path information from the root node to the node of this layer; Analyze the query statement to obtain a parse tree, and the nodes on the tree describe the entity model information of the node. Each node will construct a cache key-value pair, so the entire tree needs to be traversed;
[0030] 202) Obtain the current filtering condition information of the query instance from the dataFetcherEnvironment (context information) of each node in the query statement parse tree, and traverse upward in a loop until the root node of the query statement instance, and integrate the filtering condition information from the root node to the node of this layer. Because the query data of the current path is affected by the query data of the upper layer nodes, the complete path information combined with the filtering condition information of each layer can ensure the uniqueness of this query path;
[0031] 203) Integrate the complete path information and the complete filtering condition information, and connect the path information and the filtering condition information of each layer to form the unique query path information as the cache key;
[0032] 204) As the parsing goes deeper, the space occupied by the query path information becomes larger. To reduce the storage space of the cache key, this method encrypts the query path information using the sha-256 algorithm, and intercepts the first 8 bits as the cache key on the premise of ensuring the uniqueness of the cache key;
[0033] 205) Obtain the query result under this path from the data source as the cache value, and the cache value is the query data entity information (a single data instance or a list of data instances) corresponding to the current path;
[0034] 206) Repeat the process of 201) to 205) until the query is completed.
[0035] 3) Store the cache key-value pairs constructed in the process of 201) to 206) into the cache instance of the entity model node in the directed graph:
[0036] 301) Store the cache key-value pairs into the cache instance of the entity model node in the directed graph;
[0037] 302) Update the cache based on the least recently used (LRU) cache eviction policy and the timed cache cleaning policy. When the cache is full, delete the data with the earliest access time, and when the cache has not been hit for a long time, clear the cache regularly.
[0038] 303) Construct unique query path information based on the GraphQL query instance to generate cache key information;
[0039] 304) Parse the GraphQL query instance to obtain the entity model information in the query instance. Match the entity model nodes in the directed graph according to the entity model information, and traverse and match the keys in the cache dictionary according to the cache key information to obtain the cache value;
[0040] 305) If the cache key information in 401) is the same as the cache key of the node, the match is successful, and the cache result is directly returned without querying the data source; if the match fails, obtain the query result from the data source, form a cache key-value pair, and store it in the cache instance of the corresponding node.
[0041] 4) GraphQL cache data update:
[0042] 401) Parse the content of the update statement to obtain the information of the entity model directly described in the update statement;
[0043] 402) Obtain the list A of entity model nodes directly associated with the updated data from the directed graph;
[0044] 403) Obtain the list B of downstream nodes of the entity model nodes associated in list A according to the adjacency list. The downstream nodes refer to all successor nodes of the associated nodes. Note that the upstream nodes of the associated nodes are not affected;
[0045] 404) Clear all caches in list A and list B to eliminate the impact of data updates on the cache, thereby eliminating data consistency problems.
[0046] A computer device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the above computer program, it implements the above-described GraphQL query overhead optimization method based on the graph model.
[0047] A computer-readable storage medium stores a computer program for executing the above-described GraphQL query overhead optimization method based on the graph model.
[0048] Compared with the existing technical solutions, the present invention has the following characteristics:
[0049] 1) Organize and manage GraphQL cache data with a directed graph model to optimize the query overhead of GraphQL;
[0050] 2) Construct a cache based on the query statement structure information, which improves the cache hit rate on the premise of ensuring the cache correctness;
[0051] 3) When data is updated, the entity association information maintained based on the directed graph solves the data consistency problem at a low cost;
[0052] 4) This method is universal, decoupled from system implementation, can adapt to the GraphQL system to improve GraphQL query efficiency and reduce query overhead. Brief Description of the Drawings
[0053] Figure 1 It is the overall execution flowchart of the method according to the embodiment of the present invention.
[0054] Figure 2 It is the working flowchart of the cache building process according to the embodiment of the present invention. Detailed Embodiments
[0055] The present invention will be further clarified below in conjunction with specific embodiments. It should be understood that these embodiments are only used to illustrate the present invention and not to limit the scope of the present invention. After reading the present invention, those skilled in the art's various equivalent forms of modification of the present invention all fall within the scope defined by the appended claims of this application.
[0056] Figure 1 The overall execution flowchart of the present invention is described, including three parts: system initialization, query execution process, and data update process.
[0057] Specific implementation will be described below. First, the system initialization and construction part is described:
[0058] Step 1: During the initialization process of the GraphQL system, according to the entity relationship model definition file defined by the user in the.graphql, the corresponding model information is parsed through a parser to generate an instance of TypeDefinitionRegistry; the information of the entity relationship model is extracted from the instance of TypeDefinitionRegistry. The data types of the entity relationship model include string, int, float, boolean, and array.
[0059] Step 2: Based on the information of the entity relationship model extracted in Step 1, a directed graph instance of the entity relationship model is globally generated, and each entity model is used as a graph node in the directed graph. The type information of the entity model and the associated entity models are declared in the graph node and stored in the form of a list.
[0060] Step 3: A globally unique directed graph instance is constructed based on the adjacency list, and the constructed graph nodes are organized and managed in the form of an adjacency list. The information of the entity models associated with the entity model can be obtained according to the entity relationship model information.
[0061] The entity node contains entity attribute information, node ID, entity associated node information list, and entity cache instance:
[0062] For the entity attribute information, it is consistent with the attribute information defined in GraphQL SDL. It only contains attribute information of types string, int, float, boolean, and array, and is saved in dictionary form. In addition, the source file of the attribute information is backed up;
[0063] For the entity associated node information list, for the attribute information parsed that is not of types string, int, float, boolean, and array, it will be confirmed whether the entity model corresponding to the attribute is a defined entity model, and the verified entity model will be stored as an associated node in the associated node list;
[0064] For the node ID, the entity model is globally unique in the running system, and the node ID is the global unique identifier;
[0065] For the entity cache instance, it is implemented using the open-source cache framework Caffeine. Each entity node in the directed graph has a cache instance, and the cache size can be dynamically adjusted.
[0066] Next is the execution process part of the query process:
[0067] Step Four: Parse the GraphQL query statement, Figure 2 shows the parsing process of the GraphQL query statement. Through the parser of the query statement, the GraphQL query statement can be parsed into a complete query syntax tree, so as to obtain the types of each layer of nodes in the syntax tree and query variable information.
[0068] Step Five: Based on the query syntax tree generated in Step Four, put forward relevant type and variable information. For example, Figure 2 in, according to the query syntax tree, the first-layer entity model User and its query variable are empty can be obtained, and the second-layer entity model Event and its query variable "id : joey" can be obtained. Each layer of entity model needs to traverse loop to the parent node until the root node to obtain the entity model and query variable of each layer, so as to construct a unique query path, such as Figure 2 in "{ user(id:\"joey\"){ events ( ) {}}}".
[0069] Step Six: Based on the query path generated in Step Five, encrypt it through the sha-256 algorithm, and extract the first 8 bits as the cache key. Because using the query path directly as the cache key will waste cache space, the sha-256 algorithm reduces the space occupancy while ensuring the global uniqueness of the cache key.
[0070] Step Seven: Traverse the data cache instances in the directed graph according to the entity type and cache key to find the cache. If the cache exists, update the cache slot position and directly return the cache value. If the cache does not exist, after obtaining the query result, store the complete entity of the cache result and the cache key into the cache of the corresponding entity model node in the directed graph instance. The cache instance is implemented based on the lightweight cache framework caffeine. In this embodiment, the Least Recently Used (LRU) cache replacement policy is adopted, and a policy of periodically clearing the cache is combined. When the cache is full, the LRU cache replacement policy will delete the data with the earliest access time. And when the cache is not hit for the set time, in order to reduce memory occupancy, the policy of periodically clearing the cache is used to clean the cache. The number of cache slots of the entity model node can be dynamically set by the user.
[0071] Next is the execution process part of the data update process:
[0072] Step Eight: When data update occurs, to solve the data inconsistency problem, first identify the data update statement, parse the data update statement, and extract the entity model information directly affected in the data update statement. For example Figure 2 the User model is parsed out in
[0073] Step Nine: Based on the entity model information obtained in Step Eight, such as Figure 2 the User model in Figure 2 obtain the entity models associated with the User model in the directed graph instance. The associated entity models refer to the downstream nodes of the nodes in the directed graph, such as
[0074] the Event model and the A model in Figure 2 Because the upstream nodes in the directed graph will not be affected by the data update (for example, the data update of the Event node cannot affect the cache result of the User node), but when the User node has a data update, and the Event node has query path information such as "user(id:\"joey\"){ events ( ) {}}}", the cache key-value pair may be affected by the data update of the User node.
[0075] Through the above method, the present invention realizes a GraphQL query overhead optimization method based on a graph model, which adopts the method of constructing a directed graph of an entity model and constructing a cache based on GraphQL query syntax.
[0076] Obviously, those skilled in the art should understand that each step of the above-described GraphQL query overhead optimization method according to the embodiments of the present invention can be implemented by a general-purpose computing device. They can be concentrated on a single computing device or distributed on a network composed of multiple computing devices. Optionally, they can be implemented by program code executable by the computing device. Thus, they can be stored in a storage device and executed by the computing device. And in some cases, the steps shown or described can be executed in a different order than here, or they can be separately made into individual integrated circuit modules, or multiple modules or steps among them can be made into a single integrated circuit module to implement. In this way, the embodiments of the present invention are not limited to any specific combination of hardware and software.
Claims
1. A method for optimizing GraphQL query overhead based on a graph model, characterized in that, it includes: 1) Construct a directed graph based on the entity relationship model description file in the GraphQL system to manage entity cache data; 2) Construct a cache dictionary based on the syntactic structure characteristics of the GraphQL query statement, extract the path information and filtering condition information in the query statement, construct a cache key based on the path information and filtering condition information, and store the query result in the directed graph according to the entity relationship model to construct a node cache; 3) Perform cache update based on the update statement and the data cache directed graph model; In the above 1), construct a data cache directed graph based on the TypeDefinitionRegistry instance, uniformly parse and organize the entity relationship model defined based on GraphQL SDL into a directed graph model in memory, and store the cache data of the entity in each graph node; The data cache directed graph model constructed based on the TypeDefinitionRegistry instance is independent of the system implemented by the GraphQL framework. The data types of the entity relationship model include string, int, float, boolean, and array. The association information between entities and entity cache information are globally managed based on the data cache directed graph model; The construction of the data cache directed graph model is generated after the initialization of the system implemented by the GraphQL framework is completed. When the GraphQL framework parses the entity relationship model defined by GraphQL SDL to obtain the TypeDefinitionRegistry instance, construct the entity directed graph model based on the information in the TypeDefinitionRegistry instance; For the construction of the data cache directed graph model, construct a globally unique directed acyclic graph based on the adjacency list. The entity node contains entity attribute information, node id, entity associated node information list, and entity cache instance: For the entity attribute information, it is consistent with the attribute information defined in GraphQL SDL, which includes attribute information of string, int, float, boolean, and array types, and is saved in dictionary form. In addition, the source file of the attribute information is backed up; For the entity associated node information list, parse the attribute information that is not of string, int, float, boolean, and array types, and verify whether the entity model corresponding to this attribute is a defined entity model. If the verification is successful, store this entity model as an associated node in the associated node list; Otherwise, if the verification fails, record the verification error information; For the node id, the entity model is globally unique in the running system, and the node id is a globally unique identifier; For the entity cache instance, it is implemented using the open-source cache framework caffine. Each entity node in the directed graph has a cache instance, and the cache size can be dynamically adjusted.
2. The method for optimizing GraphQL query overhead based on a graph model according to claim 1, characterized in that, In the step 2) of constructing the cache dictionary based on the syntactic structure characteristics of the GraphQL query statement, by parsing the nested hierarchical structure of the query statement, the complete path information and complete filtering condition information of each layer of entities are obtained. A globally unified query path information is constructed for each layer of entities as the cache key, and the complete query entity result is used as the cache value; Both the cache key and cache value of the cache instance are implemented based on the query statement structure; Cache key-value pairs are constructed for each layer of entities in the query statement. When traversing each layer of entity nodes based on the parsing result, the cache key-value pairs of the layer of entities are stored in the corresponding entity nodes in the data directed graph model; The cache key of the cache instance is constructed based on the path information and filtering conditions of the query statement. Caches are constructed for each layer of entities defined in the query statement. Each layer of entities traverses upward in a loop through the associated parent node information until the root node ends. During the traversal process, the complete path information is obtained by combining the path information of each layer, and the complete filtering condition information is constructed by combining the filtering conditions of each layer. The path information and filtering conditions of the entity are matched and combined layer by layer to obtain the globally unified query path information.
3. The GraphQL query overhead optimization method based on the graph model according to claim 2, characterized in that, The query path information is encrypted by an encryption algorithm, and the first several bits are intercepted as the cache key. The symmetric encryption algorithm is used to ensure the uniqueness of the query path information. The actual size of the cache key is smaller than the query path information; for the cache result, the complete entity data corresponding to each layer of query results should be used as the cache value.
4. The GraphQL query overhead optimization method based on the graph model according to claim 1, characterized in that, In the step 3), according to the parsed update statement structure, all affected entity nodes are traversed and determined in the directed graph model, and the caches of the affected entity nodes are cleared; Cache update is performed based on the update statement and the data cache directed graph model. The cache update strategy consists of two scenarios: cache replacement when the cache space of the entity node is full and adjustment of the entity node cache when the system has data updates: For the cache replacement scenario when the cache space of the entity node is full, it is implemented by combining the least recently used cache replacement algorithm with the timed cache cleaning strategy. That is, when the cache of the entity node is called, the cache of the entity node is adjusted to the top cache slot through the LRU algorithm. As time goes by, the caches that are not frequently accessed will appear in the lower cache slots. When the cache space is full, the caches that are not frequently accessed will be eliminated. The "not frequently accessed" means that the access times are less than the threshold set by the user; in addition, the strategy also combines the method of timed cache cleaning, that is, globally cleaning the caches that have not been accessed within the set time regularly; For the scenario of adjusting the entity node cache when the system has data updates, the strategy will determine the list of entity nodes affected by the update statement based on the structure of the update statement and the model association information of the data cache directed graph model, and clear the caches of the entity node list.
5. The GraphQL query overhead optimization method based on the graph model according to claim 1, It is characterized in that For the parsing process of the update statement structure, it is implemented based on a publicly available parser or a parser implemented by the user. The parsing result only needs to conform to the description information of the data update statement. For the parsed data update statement, extract the list of entity models directly declared in the statement. For the entity model information directly declared in the extracted statement, find the downstream node information of the directly declared entity model based on the directed graph model. The downstream node refers to all successor nodes of the associated node, and clear the cached content of the entity node to ensure data consistency.
6. A computer device It is characterized in that: The computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the GraphQL query overhead optimization method based on the graph model as described in any one of claims 1-5.
7. A computer-readable storage medium It is characterized in that: The computer-readable storage medium stores a computer program for executing the GraphQL query overhead optimization method based on the graph model as described in any one of claims 1-5.
Citation Information
Patent Citations
Parallel processing framework supporting large-scale dynamic data query and design method
CN107807983A
Subgraph isomorphism-based web data automatic visualization method
CN110059073A