Data query method and device, electronic equipment and computer storage medium
By using gateway devices to parse query requests in the cloud service platform and performing data queries in the cache service of the registry center, the problem of low processing efficiency caused by frequent interactions between microservices and the registry center is solved, achieving more efficient data processing and reducing the development cost of the cache service.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INDUSTRIAL AND COMMERCIAL BANK OF CHINA
- Filing Date
- 2023-07-25
- Publication Date
- 2026-04-28
AI Technical Summary
Frequent data calls and caching operations between microservices and the registry center result in low processing efficiency of the cloud service platform, and the development and code review costs of caching services are high.
The gateway device parses the query request to determine whether the service parameters enable the caching service of the registry center. If enabled, the query operation is performed in the caching service; otherwise, it is forwarded to the target application service to execute the query, and the query results or data are stored in the caching service to reduce the number of interactions.
It improves the processing efficiency and data volume of the cloud service platform, and reduces the development and code review costs of caching services.
Smart Images

Figure CN116860806B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of cloud computing technology, and more specifically to a data query method, apparatus, electronic device, and computer storage medium. Background Technology
[0002] With the continuous development of cloud computing technology, enterprises can leverage cloud service platforms to provide users with a variety of application services, also known as microservices. In related technologies, a registry center within the cloud service platform typically manages and schedules multiple microservices. For example, the registry center forwards user requests to microservices, which then execute the corresponding functions and provide feedback to the user with the results.
[0003] In the process of realizing the above-mentioned inventive concept, the inventors discovered that the related technology has at least the following technical problems: frequent data calls and caching operations between microservices and the registry center lead to low processing efficiency of the cloud service platform. Summary of the Invention
[0004] In view of the above problems, this disclosure provides a data query method, apparatus, electronic device and computer storage medium.
[0005] According to the first aspect of this disclosure, a data query method is provided, comprising:
[0006] In response to receiving a query request forwarded by the gateway device, the query request is parsed to obtain a query identifier. The gateway device is used to receive and forward query requests initiated by users.
[0007] Determine the service parameters that match the query identifier. The service parameters are used to characterize whether the application service enables the caching service of the registry center. The registry center is used to schedule multiple application services, and the caching service is used to store the operation information of the registry center.
[0008] In response to the target application service having enabled caching services since the service parameters match the query identifier, a query operation is performed in the cache service based on the query identifier to determine the query result; and
[0009] Based on the query results, determine the data to be queried.
[0010] According to embodiments of this disclosure, determining the query data based on the query results includes:
[0011] In response to the query result indicating that no target data corresponding to the query request exists, the access address of the target application service matching the query identifier is determined from the registry center;
[0012] Forward the query request to the access address so that the target application service can perform the query operation; and
[0013] Receive query data returned from the access address and store the query data in the cache service.
[0014] According to embodiments of this disclosure, it further includes:
[0015] While storing the query data in the cache service, the query data is returned to the address that initiated the query request through the gateway device.
[0016] According to embodiments of this disclosure, determining the query data based on the matching results further includes:
[0017] In response to the query result indicating the existence of target data corresponding to the query request, the target data is used as query data, and the query data is returned to the address that initiated the query request through the gateway device.
[0018] According to embodiments of this disclosure, the query identifier includes a user identifier and a business data identifier; in response to a service parameter indicating that a target application service matching the query identifier has enabled caching, a query operation is performed in the caching service based on the query identifier to determine the query result, including:
[0019] In response to the fact that the target application service whose service parameter representation matches the query identifier has enabled caching service, the storage area for the target application service is determined in the caching service based on the business data identifier;
[0020] Perform a query operation in the storage area based on the user identifier and determine the query results.
[0021] According to embodiments of this disclosure, after parsing the query request to obtain the query identifier, the method further includes:
[0022] Determine the time parameter that matches the query identifier, where the time parameter is used to characterize the data storage duration of the application service corresponding to the query identifier in the cache service.
[0023] According to embodiments of this disclosure, performing a query operation in the storage area based on a user identifier to determine the query result includes:
[0024] Based on the user identifier, determine the candidate query data in the storage area and the storage time for storing the candidate query data;
[0025] Calculate the time difference between the current time and the stored time; and
[0026] The query results are determined based on the comparison between the time difference and the time parameter.
[0027] According to embodiments of this disclosure, the query result includes query success and query failure; the query result is determined based on a comparison between the time difference and a time parameter, including:
[0028] If the time difference is less than or equal to the time parameter, the alternative query data will be determined as the target data corresponding to the query request, and the query result will be determined as a successful query.
[0029] If the time difference is greater than the time parameter, the query result is determined to be a query failure.
[0030] A second aspect of this disclosure provides a data query apparatus, comprising:
[0031] The parsing module is used to respond to a query request forwarded by the gateway device, parse the query request to obtain a query identifier, wherein the gateway device is used to receive and forward the query request initiated by the user;
[0032] The first determining module is used to determine the service parameters that match the query identifier. The service parameters are used to characterize whether the application service enables the caching service of the registry center. The registry center is used to schedule multiple application services, and the caching service is used to store the operation information of the registry center.
[0033] The second determining module is used to, in response to the fact that the target application service matching the service parameter representation and the query identifier has enabled caching service, perform a query operation in the caching service based on the query identifier and determine the query result; and
[0034] The third module is used to determine the query data based on the query results.
[0035] A third aspect of this disclosure provides an electronic device comprising: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors perform the data query method described above.
[0036] A fourth aspect of this disclosure also provides a computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, cause the processor to perform the data query method described above.
[0037] The fifth aspect of this disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described data query method.
[0038] In embodiments of this disclosure, in response to receiving a query request forwarded by a gateway device, the query request is parsed to obtain a query identifier; service parameters matching the query identifier are determined; in response to the service parameters indicating that the target application service matching the query identifier has enabled caching, a query operation is performed in the caching service based on the query identifier to determine the query result; and the query data is determined based on the query result, thus realizing a data query operation. Since the business data of the application service can be stored in the caching service within the registry center, after the gateway device forwards the query request to the registry center, the registry center can determine whether to perform a query operation in the caching service by judging the service parameters. This at least partially reduces the number of interactions between the application service and the registry center, thereby improving the overall processing efficiency and data processing volume of the cloud service platform. Attached Figure Description
[0039] The foregoing contents, as well as other objects, features, and advantages of this disclosure, will become clearer from the following description of embodiments with reference to the accompanying drawings, in which:
[0040] Figure 1 This illustration illustrates an application scenario of the data query method according to an embodiment of the present disclosure;
[0041] Figure 2 A flowchart illustrating a data query method according to an embodiment of the present disclosure is shown schematically;
[0042] Figure 3 This illustration schematically shows a flowchart of a method for obtaining query data when the query results indicate that no target data corresponding to the query request exists, according to an embodiment of the present disclosure.
[0043] Figure 4 A flowchart illustrating a method for determining query data according to a specific embodiment of the present disclosure is shown schematically.
[0044] Figure 5 This illustration schematically depicts an application scenario for determining query data according to a specific embodiment of the present disclosure;
[0045] Figure 6 This illustration illustrates an application scenario for determining query data according to another embodiment of the present disclosure;
[0046] Figure 7 A schematic block diagram of a data query apparatus according to an embodiment of the present disclosure is shown; and
[0047] Figure 8 A block diagram schematically illustrates an electronic device suitable for a data query method according to an embodiment of the present disclosure. Detailed Implementation
[0048] The embodiments of the present disclosure will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the disclosure. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of the present disclosure for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concepts of the present disclosure.
[0049] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0050] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.
[0051] When using expressions such as "at least one of A, B, and C", they should generally be interpreted in accordance with the meaning that is commonly understood by a person skilled in the art (e.g., "a system having at least one of A, B, and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B, and C, etc.).
[0052] In the technical solutions disclosed herein, the collection, storage, use, processing, transmission, provision, disclosure, and application of data (including but not limited to user personal information) comply with the provisions of relevant laws and regulations, necessary confidentiality measures have been taken, and they do not violate public order and good morals.
[0053] In related technologies, multiple microservices are typically managed and scheduled by a registry center within a cloud service platform. For example, the registry center forwards user requests to microservices, which then execute the corresponding functions and provide feedback to the user. The multiple microservices in a cloud service platform generally originate from multiple service providers, with each microservice having its service functions developed or improved by its respective service provider.
[0054] When developing microservices, service providers need to write code blocks in the microservice's business logic to implement caching functionality. Therefore, when a user initiates a query request, the gateway device forwards the request to the registry center, which then forwards it to the corresponding microservice. The microservice responds to the query request by retrieving the relevant data from the cache or database and returning it.
[0055] When performing the above query operations, the query request needs to pass through the gateway device, the registry center, and the microservices sequentially. If there is no data in the microservice's cache, it also needs to pass through the microservice's corresponding database to complete the data query operation. Since each microservice can perform query operations, there are frequent data query operations between multiple microservices and the registry center. Because the amount of data that the gateway and registry center can handle is limited, frequent data query operations will reduce the network request rate between microservices, thereby affecting the overall processing efficiency and throughput of the microservice system.
[0056] Furthermore, each microservice can perform data retrieval through caching. However, the code logic used to implement caching is quite complex, and the coding capabilities of each service provider vary. Therefore, having each service provider develop its own caching service would result in high development and code review costs.
[0057] Embodiments of this disclosure provide a data query method, including: in response to receiving a query request forwarded by a gateway device, parsing the query request to obtain a query identifier, wherein the gateway device is used to receive and forward query requests initiated by users; determining service parameters matching the query identifier, wherein the service parameters are used to characterize whether the application service has enabled the caching service of the registry center, the registry center is used to schedule multiple application services, and the caching service is used to store the operation information of the registry center; in response to the service parameters indicating that the target application service matching the query identifier has enabled the caching service, performing a query operation in the caching service according to the query identifier to determine the query result; and determining the query data according to the query result.
[0058] Figure 1 The illustration depicts an application scenario of the data query method according to an embodiment of the present disclosure.
[0059] like Figure 1 As shown, application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 105, a gateway device 105, and a server 106. The network 104 serves as a medium for providing communication links between the first terminal device 101, the second terminal device 102, the third terminal device 103, the gateway device 105, and the server 106. The network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0060] Users can interact with gateway device 105 via network 104 using at least one of the first terminal device 101, the second terminal device 102, and the third terminal device 103; gateway device 105 can forward user-initiated requests to server 106 to perform data operations, etc.
[0061] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be equipped with various communication client applications, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (for example only).
[0062] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0063] Gateway device 105, also known as an internetwork connector or protocol converter, is a computer system or device that performs the crucial task of conversion. It typically enables network interconnection at the network layer or higher, and is a complex network interconnection device used only for interconnecting two networks with different high-level protocols.
[0064] Server 106 can be a single server or a server cluster, used to host a cloud service platform. For example, each server in a server cluster can act as a node in the cloud service platform, providing corresponding services.
[0065] It should be noted that the data query method provided in this embodiment can generally be executed by server 106. Correspondingly, the data query device provided in this embodiment can generally be located in server 106. The data query method provided in this embodiment can also be executed by a server or server cluster that is different from server 106 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, the gateway device 105, and / or server 106. Correspondingly, the data query device provided in this embodiment can also be located in a server or server cluster that is different from server 106 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, the gateway device 105, and / or server 106.
[0066] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0067] The following will be based on Figure 1 The described scene, through Figures 2-6 The data query method of the disclosed embodiments will be described in detail.
[0068] Figure 2 A flowchart illustrating a data query method according to an embodiment of the present disclosure is shown schematically.
[0069] like Figure 2 As shown, the method 200 includes operations S210 to S240.
[0070] In operation S210, in response to receiving a query request forwarded by the gateway device, the query request is parsed to obtain the query identifier.
[0071] According to embodiments of this disclosure, a gateway device is used to receive and forward query requests initiated by a user. As the sole channel for interaction between the cloud service platform and the user, the gateway device forwards various types of user-initiated requests to the registry center and returns execution results obtained from the registry center or application services to the user.
[0072] According to embodiments of this disclosure, the types of requests initiated by users include query requests, data processing requests, etc. Query requests are used to perform query operations, while data processing requests are used to perform multiple types of data processing operations.
[0073] For example, query request A is used to query a user's basic information, data processing request B is used to perform a transfer operation, data processing request C is used to perform an interactive operation, and data processing request D is used to perform a financial management operation, etc.
[0074] According to embodiments of this disclosure, a query request includes a query identifier, which is used to determine the data to be queried.
[0075] In operation S220, service parameters matching the query identifier are determined, where the service parameters are used to characterize whether the application service enables the caching service of the registry center.
[0076] According to embodiments of this disclosure, a registry center is used to schedule multiple application services, i.e., microservices.
[0077] According to embodiments of this disclosure, an application service can only provide services normally after it has been registered in the registry center.
[0078] According to embodiments of this disclosure, the registry center includes a caching service for storing operational information of the registry center. For example, the caching service may store requests sent and received by the registry center, and may also store data returned by application services.
[0079] According to embodiments of this disclosure, a target application service matching the query identifier can be determined, and then service parameters related to the target application service can be determined. Each application service can correspond to a service parameter, which is used to characterize whether the application service enables the caching service of the registry center.
[0080] According to the embodiments of this disclosure, when the application service has enabled the caching service of the registry center, the caching service of the registry center can cache some of the business data in the application service; when the application service has not enabled the caching service of the registry center, the business data in the application service cannot be stored in the caching service of the registry center, and can only be stored in the local cache of the application service or the database of the application service.
[0081] According to embodiments of this disclosure, business data refers to specific services related to the services provided by the application service, such as querying basic user information.
[0082] In operation S230, in response to the fact that the target application service that matches the query identifier has enabled the caching service, a query operation is performed in the caching service according to the query identifier to determine the query result.
[0083] According to embodiments of this disclosure, when the target application service whose service parameter characterization matches the query identifier has enabled caching service, since the target application service can use the caching service in the registry center, a query can be performed in the caching service based on the parsed query identifier to obtain the query result.
[0084] According to embodiments of this disclosure, the query result is used to indicate whether the target data corresponding to the query request was found. If the target data corresponding to the query request can be found, the query result includes "query successful" indicating the execution result and the retrieved target data. If the target data corresponding to the query request cannot be found, the query result only includes "query failed" indicating the execution result.
[0085] In operation S240, the query data is determined based on the query results.
[0086] According to embodiments of this disclosure, since the query results may include query data, the query data can be directly obtained from the query results after the query results are determined.
[0087] In embodiments of this disclosure, in response to receiving a query request forwarded by a gateway device, the query request is parsed to obtain a query identifier; service parameters matching the query identifier are determined; in response to the service parameters indicating that the target application service matching the query identifier has enabled caching, a query operation is performed in the caching service based on the query identifier to determine the query result; and the query data is determined based on the query result, thus realizing a data query operation. Since the business data of the application service can be stored in the caching service within the registry center, after the gateway device forwards the query request to the registry center, the registry center can determine whether to perform a query operation in the caching service by judging the service parameters. This at least partially reduces the number of interactions between the application service and the registry center, thereby improving the overall processing efficiency and data processing volume of the cloud service platform.
[0088] Furthermore, since the registry center can integrate the caching services of at least one application service, the embodiments of this disclosure can at least partially solve the problems of high development costs and code review costs of caching services, and reduce the development costs and code review costs of caching functions in application services.
[0089] Figure 3 The flowchart illustrates a method for obtaining query data when the query results indicate that no target data corresponding to the query request exists, according to an embodiment of the present disclosure.
[0090] like Figure 3 As shown, the method 300 for obtaining query data when the query result indicates that there is no target data corresponding to the query request includes operations S341 to S343, which can be used as a specific embodiment of operation S240.
[0091] In operation S341, in response to the query result indicating that there is no target data corresponding to the query request, the access address of the target application service that matches the query identifier is determined from the registry center.
[0092] In operation S342, the query request is forwarded to the access address so that the target application service can perform the query operation.
[0093] In operation S343, the query data returned by the access address is received and the query data is stored in the cache service.
[0094] According to embodiments of this disclosure, if the target application service matching the query identifier has enabled caching, and the query result indicates that there is no target data corresponding to the query request, then the target application service matching the query identifier will perform a query operation to obtain the corresponding query data.
[0095] According to embodiments of this disclosure, when an application service is launched, it needs to complete a registration operation within the registry center, that is, establish a mapping relationship between the registry center and the application service. When the query result indicates that no target data corresponding to the query request exists, the access address of the target application service matching the query identifier can be determined from the registry center based on the mapping relationship between the registry center and the application service.
[0096] According to embodiments of this disclosure, the access address includes an Internet Protocol address (IP address) and a port.
[0097] According to embodiments of this disclosure, after determining the access address of the target application service, the query request is forwarded to the aforementioned access address so that the target application service can perform a query operation based on the received query request.
[0098] According to the embodiments of this disclosure, since the target application service has enabled the caching service of the registry center, after the target application service performs a query operation, it returns the queried query data to the caching service of the registry center so that when querying the above query data for the second time, the corresponding query data can be directly obtained from the caching service.
[0099] In the embodiments of this disclosure, the target data is first queried in the cache service. If the target data is found, it is returned directly without forwarding the request to the downstream application service, which reduces the number of interactions between the registry center and the application service. If the queried data is not found in the cache service, the corresponding application service performs the query operation and stores the queried data in the cache service. This ensures that the corresponding target data is found while facilitating future queries and reducing the number of interactions for subsequent queries.
[0100] According to embodiments of this disclosure, while storing query data in a cache service, the query data is returned to the address that initiated the query request via a gateway device.
[0101] According to embodiments of this disclosure, since the target application service has enabled the caching service of the registry center, the queried data is retrieved after the query operation is performed. Simultaneously, the query data is returned to the address that initiated the query request via the gateway device, eliminating the need for the caching service to send the query data through the gateway device, thus reducing the time required to return the query data and improving processing efficiency.
[0102] According to embodiments of this disclosure, determining the query data based on the matching result further includes: in response to the query result indicating the existence of target data corresponding to the query request, using the target data as query data, and returning the query data to the address that initiated the query request through a gateway device.
[0103] For example, a user sends a query request A to the gateway device. Query request A is used to query "data C" in application service B for the first time. Application service B has enabled the registry's caching service.
[0104] The gateway device forwards query request A to the registry center. The registry center parses query request A to obtain query identifier D and determines the service parameters that match query identifier D. Since application service B has enabled the registry center's caching service, the service parameters indicate that application service B has enabled the caching service. At this time, the registry center performs a query operation in the cache service based on query identifier D to determine the query result. Since query request A is used to query "data C" in application service B for the first time, "data C" is not in the cache service. At this time, the query result indicates that "data C" corresponding to query request A does not exist in the cache service. The registry center forwards query request A to application service B, which performs the query operation and obtains "data C". After obtaining "data C", application service B returns "data C" to the user through the gateway device; at the same time, it also returns "data C" to the cache service.
[0105] After sending query request A and retrieving "data C", the user sends another query request A' to the gateway device. Query request A' is also used to query "data C" in application service B. At this point, query request A' is used to query "data C" for the second time.
[0106] The gateway device forwards query request A' to the registry center. The registry center parses query request A' to obtain query identifier D' and determines the service parameters that match query identifier D'. These service parameters indicate that application service B has enabled caching. The registry center can then query "data C" in the cache service based on query identifier D'. After finding "data C" in the cache service, the registry center directly returns "data C" to the user through the gateway, without needing to forward the query request to application service B again.
[0107] According to embodiments of this disclosure, the query identifier includes a user identifier and a business data identifier.
[0108] According to embodiments of this disclosure, in response to the service parameter indicating that the target application service matching the query identifier has enabled caching service, a query operation is performed in the caching service based on the query identifier to determine the query result, including: in response to the service parameter indicating that the target application service matching the query identifier has enabled caching service, determining a storage area for the target application service in the caching service based on the business data identifier; and performing a query operation in the storage area based on the user identifier to determine the query result.
[0109] According to embodiments of this disclosure, a user identifier is used to uniquely identify a user. For example, a user identifier may be an identifier obtained by combining the access address and port of the user terminal device that initiated the query request with the user's identity information.
[0110] According to embodiments of this disclosure, the caching service of the registry center can store business data for multiple application services, which provide various business functions. Therefore, the caching service can store business data according to the business function type. A business identifier is used to characterize the function type of the business data to be queried.
[0111] According to embodiments of this disclosure, a user can subscribe to multiple application services, and an application service can provide services to multiple users simultaneously. The user's identifier can uniquely identify the data the user wants to query.
[0112] According to embodiments of this disclosure, in response to a target application service whose service parameter representation matches the query identifier having enabled caching, a storage region for the target application service is determined in the caching service based on the business data identifier. Subsequently, a query operation can be performed in the storage region based on the user identifier to determine the target data to be queried.
[0113] According to embodiments of this disclosure, since at least one application service can enable the caching service of the registry center, partitioning and storing data in the caching service according to business function type, and determining the target data in the corresponding storage area based on the user identifier can improve query efficiency.
[0114] Figure 4 A flowchart illustrating a method for determining query data according to a specific embodiment of the present disclosure is shown.
[0115] like Figure 4 As shown, the method 400 for determining the query data includes operations S401 to S409.
[0116] In operation S401, the query request is parsed to obtain the query identifier.
[0117] In operation S402, determine the service parameters that match the query identifier.
[0118] In operation S403, the question is whether to enable the caching service of the registry center. Specifically, if the target application service whose service parameters match the query identifier has enabled the caching service, the process proceeds to operation S404; if the target application service whose service parameters match the query identifier has not enabled the caching service, the process proceeds to operation S406, so that the query operation can be performed in the application service.
[0119] In operation S404, a query operation is performed in the cache service based on the query identifier to determine the query result.
[0120] In operation S405, the query is checked for success. Specifically, if the query is successful, operation S409 is initiated, directly returning the query data retrieved from the cache service to the address that initiated the query request. If the query fails, operation S406 is initiated to execute the query operation in the application service.
[0121] In operation S406, the access address of the target application service that matches the query identifier is determined from the registry center.
[0122] In operation S407, the query request is forwarded to the access address so that the target application service can perform the query operation.
[0123] In operation S408, the query data returned by the access address is received and the query data is stored in the cache service.
[0124] When operating S409, the query data is returned to the address that initiated the query request through the gateway device.
[0125] According to embodiments of this disclosure, after parsing the query request to obtain the query identifier, the method further includes: determining a time parameter that matches the query identifier, wherein the time parameter is used to characterize the data storage duration of the application service corresponding to the query identifier in the cache service.
[0126] According to embodiments of this disclosure, performing a query operation in a storage area based on a user identifier and determining the query result includes: determining candidate query data and the storage time of storing the candidate query data in the storage area based on the user identifier; calculating the time difference between the current time and the storage time; and determining the query result based on the comparison relationship between the time difference and time parameters.
[0127] According to embodiments of this disclosure, when an application service registers in a registry center, it can store time parameters and service parameters as registration data in the registry center. After receiving and parsing a query request to obtain a query identifier, the service parameters and time parameters can be directly retrieved based on the query identifier.
[0128] According to embodiments of this disclosure, the time parameter can be the effective storage duration.
[0129] According to embodiments of this disclosure, candidate query data can be understood as data that has already been retrieved from the storage area, but it is uncertain whether the data has exceeded the valid storage duration. It is understood that, because the data stored by the application service has a time limit, only data that has not exceeded the valid storage duration can be used as target data.
[0130] According to embodiments of this disclosure, the caching service synchronously saves the storage time of the stored data when storing data. While determining candidate query data in the storage area based on the user identifier, it can also determine the storage time of the candidate query data, so as to calculate the storage duration of the candidate query data based on the storage time and the current time. For example, the time difference between the current time and the storage time can be used as the storage duration, and then the query result can be determined based on the comparison between the time difference and time parameters.
[0131] According to embodiments of this disclosure, the query result includes query success and query failure; determining the query result based on the comparison between the time difference and the time parameter includes: if the time difference is less than or equal to the time parameter, determining the candidate query data as the target data corresponding to the query request, and determining the query result as query success; if the time difference is greater than the time parameter, determining the query result as query failure.
[0132] According to embodiments of this disclosure, when the time difference is less than or equal to the time parameter, it indicates that the candidate query data has not exceeded the data storage duration and is considered valid query data. Therefore, the candidate query data can be used as the target data, and the query result can be determined as a successful query.
[0133] If the time difference is greater than the time parameter, it indicates that the candidate query data has exceeded the data storage time and the query data needs to be retrieved and updated from the application service again.
[0134] In the embodiments of this disclosure, the data stored in the cache service can be updated at any time by adding a time parameter to ensure the timeliness of the data.
[0135] Figure 5 This illustration depicts an application scenario for determining query data according to a specific embodiment of the present disclosure.
[0136] like Figure 5 As shown, application scenario 500 describes the process of obtaining query data when the application service 1 has enabled the caching service of the registry center.
[0137] User 1 can send a query request to the gateway device. The gateway device forwards the query request to the management node in the registry center. The management node parses the query request to obtain a query identifier and determines the service parameters based on the query identifier. In response to the service parameters indicating that application service 1, which matches the query identifier, has enabled caching service, the management node initiates a request to the caching service to push the cached data, in order to determine the query data corresponding to the query request.
[0138] After obtaining the query data from the cache service, the cache service returns the query data to the gateway device so that the query data can be returned to user 1 through the gateway device.
[0139] A query operation is performed in the caching service. If the query result indicates that the target data corresponding to the query request does not exist, the caching service returns the query result to the management node, which then determines the access address of application service 1 that matches the query identifier. The management node then forwards the query request to the access address of application service 1, which performs the query operation. After performing the query operation, application service 1 synchronously sends the query data to both the caching service and the gateway device, so that the query data can be returned to user 1 through the gateway device.
[0140] According to embodiments of this disclosure, users can also send service processing requests, such as transaction requests, to the gateway device, whereby the application service executes the corresponding transaction operation and returns the transaction result.
[0141] Figure 6 The illustration depicts an application scenario for determining query data according to another embodiment of this disclosure.
[0142] like Figure 6 As shown, application scenario 600 describes the process of obtaining query data when the application service 2 does not enable the caching service of the registry center.
[0143] User 1 can send a query request to the gateway device. The gateway device forwards the query request to the management node of the registry center. The management node parses the query request to obtain a query identifier and determines the service parameters based on the query identifier. Since the service parameters indicate that application service 2, which matches the query identifier, has not enabled caching, the management node determines the access address of application service 2 that matches the query identifier. Then, the management node forwards the query request to the access address of application service 2, and application service 2 executes the query operation. Specifically, application service 2 performs a query operation in the database to obtain the query data corresponding to the query request. Because application service 2 has not enabled caching, application service 2 only sends the query data to the gateway device, which then returns the query data to user 1.
[0144] According to embodiments of this disclosure, caching of query data can be achieved through the caching service of the registry center, enabling caching of query data even when the application service does not include caching functionality code. Furthermore, the caching service of the registry center allows for unified management of cached query data from application services, reducing the cost of subsequent development and upgrades to caching functionality, and decreasing the amount of application service code required for development.
[0145] Furthermore, it should be noted that the embodiments of this disclosure implement caching of query data through the caching service of the registration center, and can also transfer some of the requests to be executed by the application service to the caching center, thereby increasing the number of requests to be processed by the application service and improving the overall data throughput of the cloud service platform.
[0146] Figure 7 A schematic block diagram of a data query apparatus according to an embodiment of the present disclosure is shown.
[0147] like Figure 7 As shown, the data query device 700 of this embodiment includes a parsing module 710, a first determining module 720, a second determining module 730 and a third determining module 740.
[0148] The parsing module 710 is used to parse the query request to obtain a query identifier in response to receiving a query request forwarded by the gateway device. The gateway device is used to receive and forward the query request initiated by the user. In one embodiment, the parsing module 710 can be used to perform the operation S210 described above, which will not be repeated here.
[0149] The first determining module 720 is used to determine service parameters that match the query identifier. These service parameters characterize whether the application service enables the registry center's caching service. The registry center is used to schedule multiple application services, and the caching service stores the registry center's operation information. In one embodiment, the first determining module 720 can be used to execute the operation S220 described above, which will not be repeated here.
[0150] The second determining module 730 is configured to, in response to the fact that the target application service matching the service parameter representation has enabled caching service, perform a query operation in the caching service based on the query identifier to determine the query result. In one embodiment, the second determining module 730 may be used to perform the operation S230 described above, which will not be repeated here.
[0151] The third determining module 740 is used to determine the query data based on the query results. In one embodiment, the third determining module 740 can be used to perform the operation S240 described above, which will not be repeated here.
[0152] According to embodiments of this disclosure, the third determining module 740 includes a first determining submodule, a first forwarding submodule, and a receiving submodule.
[0153] The first determining submodule is used to determine the access address of the target application service that matches the query identifier from the registry center in response to the query result indicating that no target data corresponding to the query request exists. In one embodiment, the first determining submodule can be used to perform the operation S341 described above, which will not be repeated here.
[0154] The first forwarding submodule is used to forward the query request to the access address so that the target application service can perform the query operation. In one embodiment, the first forwarding submodule can be used to perform the operation S342 described above, which will not be repeated here.
[0155] The receiving submodule is used to receive query data returned by the access address and store the query data in the cache service. In one embodiment, the receiving submodule can be used to perform the operation S343 described above, which will not be repeated here.
[0156] According to embodiments of this disclosure, the third determining module 740 further includes a second forwarding submodule, used to return the query data to the address that initiated the query request through a gateway device while storing the query data in a cache service.
[0157] According to an embodiment of this disclosure, the third determining module 740 further includes a second determining submodule, which is used to, in response to the query result indicating the existence of target data corresponding to the query request, use the target data as query data and return the query data to the address that initiated the query request through the gateway device.
[0158] According to embodiments of this disclosure, the query identifier includes a user identifier and a business data identifier. The second determining module 730 includes a third determining submodule and a fourth determining submodule.
[0159] The third determination submodule is used to determine the storage area for the target application service in the cache service based on the business data identifier when the target application service whose service parameter representation matches the query identifier has enabled caching service.
[0160] The fourth determination submodule is used to perform query operations in the storage area based on the user identifier and determine the query results.
[0161] According to an embodiment of this disclosure, the data query device 700 further includes a fourth determining module, used to determine a time parameter matching the query identifier, wherein the time parameter is used to characterize the data storage duration of the application service corresponding to the query identifier in the cache service.
[0162] According to embodiments of this disclosure, the fourth determining submodule includes a first determining unit, a second determining unit, and a third determining unit.
[0163] The first determining unit is used to determine the alternative query data in the storage area and the storage time of storing the alternative query data based on the user identifier.
[0164] The second determining unit is used to calculate the time difference between the current time and the stored time.
[0165] The third determining unit is used to determine the query result based on the comparison relationship between the time difference and the time parameter.
[0166] According to embodiments of this disclosure, the third determining unit includes a first determining subunit and a second determining subunit.
[0167] The first determining subunit is used to determine the candidate query data as the target data corresponding to the query request when the time difference is less than or equal to the time parameter, and to determine the query result as a successful query.
[0168] The second determining subunit is used to determine that the query result is a query failure when the time difference is greater than the time parameter.
[0169] According to embodiments of this disclosure, any plurality of modules among the parsing module 710, the first determining module 720, the second determining module 730, and the third determining module 740 may be combined into one module, or any one of these modules may be split into multiple modules. Alternatively, at least some of the functionality of one or more of these modules may be combined with at least some of the functionality of other modules and implemented in one module.
[0170] According to embodiments of this disclosure, at least one of the parsing module 710, the first determining module 720, the second determining module 730, and the third determining module 740 can be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or implemented in hardware or firmware by any other reasonable means of integrating or packaging the circuitry, or implemented in any one of software, hardware, and firmware methods, or in a suitable combination of any of these. Alternatively, at least one of the parsing module 710, the first determining module 720, the second determining module 730, and the third determining module 740 can be at least partially implemented as a computer program module, which, when run, can perform corresponding functions.
[0171] Figure 8 A block diagram schematically illustrates an electronic device suitable for a data query method according to an embodiment of the present disclosure.
[0172] like Figure 8 As shown, an electronic device 800 according to an embodiment of this disclosure includes a processor 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage portion 808 into a random access memory (RAM) 803. The processor 801 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 801 may also include onboard memory for caching purposes. The processor 801 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of this disclosure.
[0173] RAM 803 stores various programs and data required for the operation of electronic device 800. Processor 801, ROM 802, and RAM 803 are interconnected via bus 804. Processor 801 performs various operations of the method flow according to embodiments of the present disclosure by executing programs in ROM 802 and / or RAM 803. It should be noted that the programs may also be stored in one or more memories other than ROM 802 and RAM 803. Processor 801 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in said one or more memories.
[0174] According to embodiments of this disclosure, the electronic device 800 may further include an input / output (I / O) interface 805, which is also connected to a bus 804. The electronic device 800 may also include one or more of the following components connected to the input / output I / O interface 805: an input section 806 including a keyboard, mouse, etc.; an output section 807 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 810 as needed so that computer programs read from it can be installed into the storage section 808 as needed.
[0175] This disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs that, when executed, implement the method according to the embodiments of this disclosure.
[0176] According to embodiments of this disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, such as including, but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to embodiments of this disclosure, the computer-readable storage medium may include ROM 802 and / or RAM 803 and / or one or more memories other than ROM 802 and RAM 803 described above.
[0177] Embodiments of this disclosure also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowchart. When the computer program product is run on a computer system, the program code is used to cause the computer system to implement the methods provided in the embodiments of this disclosure.
[0178] When the computer program is executed by the processor 801, it performs the functions defined in the system / apparatus of this disclosure embodiments. According to embodiments of this disclosure, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0179] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and may be downloaded and installed via the communication section 809, and / or installed from a removable medium 811. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.
[0180] In such an embodiment, the computer program can be downloaded and installed from a network via communication section 809, and / or installed from removable medium 811. When the computer program is executed by processor 801, it performs the functions defined in the system of this disclosure embodiment. According to embodiments of this disclosure, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0181] According to embodiments of this disclosure, program code for executing the computer programs provided in embodiments of this disclosure can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, languages such as Java, C++, Python, "C", or similar programming languages. The program code can execute entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0182] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0183] Those skilled in the art will understand that the features described in the various embodiments and / or claims of this disclosure can be combined or combined in various ways, even if such combinations or combinations are not explicitly described in this disclosure. In particular, the features described in the various embodiments and / or claims of this disclosure can be combined or combined in various ways without departing from the spirit and teachings of this disclosure. All such combinations and / or combinations fall within the scope of this disclosure.
[0184] The specific embodiments described above further illustrate the purpose, technical solutions, and beneficial effects of this disclosure. It should be understood that the above descriptions are merely specific embodiments of this disclosure and are not intended to limit this disclosure. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this disclosure should be included within the protection scope of this disclosure.
Claims
1. A data query method, comprising: In response to receiving a query request forwarded by a gateway device, the query request is parsed to obtain a query identifier, wherein the gateway device is used to receive and forward query requests initiated by users; the query identifier includes a user identifier and a service data identifier; Determine service parameters that match the query identifier, wherein the service parameters are used to characterize whether the application service enables the caching service of the registry center, the registry center is used to schedule multiple application services, and the caching service is integrated into the registry center and used to store the query data obtained by the registry center after scheduling multiple application services; In response to the service parameter indicating that the target application service matching the query identifier has enabled caching service, a storage area for the target application service is determined in the caching service based on the business data identifier; Perform a query operation in the storage area based on the user identifier to determine the query result; Determine a time parameter that matches the query identifier, wherein the time parameter characterizes the data storage duration of the application service corresponding to the query identifier in the cache service; and Based on the query results, determine the query data; The step of determining the query data based on the query results also includes: In response to the query result indicating the existence of target data corresponding to the query request, the target data is used as the query data, and the query data is returned to the address that initiated the query request through the gateway device.
2. The method according to claim 1, wherein, The step of determining the query data based on the query results includes: In response to the query result indicating that no target data corresponding to the query request exists, the access address of the target application service matching the query identifier is determined from the registry center; Forward the query request to the access address so that the target application service can perform the query operation; and Receive query data returned by the access address and store the query data in the cache service.
3. The method according to claim 2, further comprising: While storing the query data in the cache service, the gateway device returns the query data to the address that initiated the query request.
4. The method according to claim 1, wherein, The step of performing a query operation in the storage area based on the user identifier and determining the query result includes: Based on the user identifier, determine the candidate query data and the storage time for storing the candidate query data in the storage area; Calculate the time difference between the current time and the stored time; and The query result is determined based on the comparison between the time difference and the time parameter.
5. The method according to claim 4, wherein, The query results include query success and query failure; determining the query results based on the comparison between the time difference and the time parameter includes: If the time difference is less than or equal to the time parameter, the alternative query data is determined as the target data corresponding to the query request, and the query result is determined to be a successful query. If the time difference is greater than the time parameter, the query result is determined to be a query failure.
6. A data query device, comprising: The parsing module is used to respond to a query request forwarded by the gateway device, parse the query request to obtain a query identifier, wherein the gateway device is used to receive and forward the query request initiated by the user; the query identifier includes a user identifier and a business data identifier; The first determining module is used to determine service parameters that match the query identifier, wherein the service parameters are used to characterize whether the application service enables the caching service of the registry center, the registry center is used to schedule multiple application services, and the caching service is used to store the operation information of the registry center; The third determining submodule is used to determine, in the cache service, a storage area for the target application service based on the business data identifier, in response to the service parameter indicating that the target application service matching the query identifier has enabled caching service; The fourth determination submodule is used to perform a query operation in the storage area based on the user identifier and determine the query result; The fourth determining module is used to determine a time parameter matching the query identifier, wherein the time parameter characterizes the data storage duration of the application service corresponding to the query identifier in the cache service; and The third determining module is used to determine the query data based on the query results; The third determining module includes: The second determining submodule is used to respond to the query result indicating the existence of target data corresponding to the query request, to use the target data as the query data, and to return the query data to the address that initiated the query request through the gateway device.
7. An electronic device, comprising: One or more processors; Storage device for storing one or more programs. Wherein, when the one or more programs are executed by the one or more processors, the one or more processors perform the method according to any one of claims 1 to 5.
8. A computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, cause the processor to perform the method according to any one of claims 1 to 5.
9. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Query system and method for accessing data centers through cloud platform
CN103559306A
Management system, terminal, management method, and storage medium
CN114900559A