Parameter configuration method, server and readable storage medium

By centrally managing cache parameters through cache declaration files and controlling worker nodes using monitoring nodes, the problem of low database access performance is solved, and efficient and reliable cache data management is achieved.

CN119960844BActive Publication Date: 2026-02-06HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311435572.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-30
Publication Date
2026-02-06
Estimated Expiration
2043-10-30

AI Technical Summary

Technical Problem

In existing technologies, the interaction between the database and low-speed storage media leads to poor access performance, and the configuration of cache-related parameters is complicated and error-prone, affecting system efficiency and reliability.

Method used

By centrally managing cache-related parameters through cache declaration files and using monitoring nodes to control worker nodes to perform cache operations, data consistency and communication effectiveness are ensured, and configuration errors are reduced.

Benefits of technology

It improves the efficiency of cached data access, reduces configuration errors, enhances system reliability and consistency, and simplifies the cache parameter management process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119960844B_ABST
    Figure CN119960844B_ABST
Patent Text Reader

Abstract

The application provides a parameter configuration method, a server and a readable storage medium, wherein the method can be applied to a processor for processing cache services. In the method, parameters in cache configuration information corresponding to a first service are collectively declared through a cache declaration file, so that the cache-related parameters are collectively managed. In specific application, the server can first acquire the cache declaration file, and then load first cache configuration information corresponding to the first service based on the first cache declaration file, so that the cache operation on cache data of the first service can be triggered based on the first cache configuration information, for example, the cache data of the first service is queried, added, deleted, modified, etc. Through the scheme, the cache-related parameters can be collectively managed, and the management efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of computers, and particularly relates to a parameter configuration method, a server and a readable storage medium. BACKGROUND

[0002] When a client performs some business, each request of the client needs to interact with a database in a server. Since the data in the database is usually stored on a disk, each request needs to interact with the disk, and the disk is a low-speed storage medium, and the performance of the disk is low, so that access delay is caused.

[0003] In view of this, when a high-performance interface is designed on the server side, a technical personnel usually uses a high-speed storage medium as a cache to replace a low-speed storage medium for storage and reading. That is, if the data corresponding to a business is stored in the cache, the client can directly read the data corresponding to the business from the high-speed storage medium when processing the business, so that the data interaction between the client and the server is reduced, and the performance of the program is greatly improved. SUMMARY

[0004] The embodiments of the present application provide a parameter configuration method, a server and a readable storage medium, and the parameters related to the cache can be centrally managed, and the management efficiency is improved.

[0005] In a first aspect, a parameter configuration method is provided, which can be applied to a server processing a cache business, and the method comprises: obtaining a first cache declaration file, then loading first cache configuration information corresponding to a first business based on the first cache declaration file, and triggering a cache operation on cache data of the first business based on the first cache configuration information, such as querying the cache data of the first business, or adding the cache data of the first business, or deleting the cache data of the first business, or modifying the cache data of the first business. The first cache declaration file is used for centrally declaring parameters in the first cache configuration information.

[0006] Therefore, in the above scheme, the parameters related to the cache corresponding to the first business are centrally managed through the first cache declaration file. Since the parameters related to the cache are usually coded based on the characteristics of each business (code writing), the related codes are usually scattered in each code of the business, so that configuring the parameters related to the cache is a relatively complicated work. Based on the scheme provided in the embodiments of the present application, the parameters related to the cache corresponding to the first business can be centrally managed, so that the cache configuration can be conveniently and quickly loaded based on the first cache declaration file, which can not only improve the efficiency, but also reduce the operation errors in the configuration process.

[0007] Further, the cache data of the first service can be operated based on the first cache configuration information, so that the cache service can be completed, the low-speed cache can be replaced by the high-speed cache, and the data access efficiency can be improved.

[0008] Optionally, the first cache configuration information includes one or more of the following parameters: cache type, cache memory, cache description information, cache key, description information of the cache key, example of the cache key, cache value, description information of the cache value, example of the cache value, cache monitoring prompt, expiration time of the cache configuration information, and service custom data loading path information.

[0009] Optionally, after the first cache declaration file is obtained, the method further includes: in a case where the change prompt information is received, obtaining a second cache declaration file, and loading second cache configuration information corresponding to a second service based on the second cache declaration file, wherein the change prompt information is used to indicate that the first cache configuration information is updated to the second cache configuration information, the second service is the first service or a service after the first service is updated and iterated, and the second cache declaration file is used to centrally declare parameters in the second cache configuration information; and triggering a cache operation on cache data of the second service based on the second cache configuration information.

[0010] Based on the above scheme, in the process of service iteration and update, only the cache declaration file corresponding to the service needs to be modified, and the server needs to be triggered to reload the new cache declaration file, without having to modify the cache feature-related code scattered in each service code one by one, thereby improving the configuration update efficiency and reducing the situation of missing cache configuration parameter modification.

[0011] Optionally, triggering the cache operation on the cache data of the first service based on the first cache configuration information includes: determining the node type of the server according to the first cache configuration information; in a case where the server is a monitoring node, obtaining a worker node list, the worker node list including one or more internet protocol (IP) addresses of worker nodes, the monitoring node corresponding to the one or more worker nodes, and the monitoring node being used to control the one or more worker nodes to perform the cache operation; and triggering an i-th worker node in the one or more worker nodes to perform the cache operation on the cache data of the first service, i being a positive integer greater than or equal to 1.

[0012] Based on the above scheme, the node type of the server can be configured as a monitoring node through the cache configuration information, and the worker nodes can be controlled to perform the cache operation through the monitoring node. That is, the worker nodes can be uniformly monitored and managed through the monitoring node, so that the efficiency and reliability of the cache system are improved.

[0013] Optionally, the method further comprises: detecting the reachability of the i-th worker node; and in the case that the i-th worker node is unreachable, sending an alarm message, the alarm message being used to indicate that the i-th worker node is unreachable.

[0014] In the above scheme, the monitoring node can discover the offline worker node through reachability detection and issue an alarm, thereby alleviating the problem of communication effectiveness between the monitoring node and the worker node and reducing the situation of inconsistent cache data caused by the failure of sending a control instruction.

[0015] Optionally, the detection of the reachability of the i-th worker node comprises: receiving a notification message from the i-th worker node, the notification message being used to indicate that the i-th worker node is offline; and in response to the notification message, stopping the detection of the reachability of the i-th worker node. In other words, the monitoring node periodically sends a heartbeat detection message to the i-th worker node; and in the case that no response message to the heartbeat detection message is received within a preset reach period, it is determined that the i-th worker node is unreachable.

[0016] Based on the above scheme, the monitoring node can periodically detect the reachability of the worker node through the heartbeat detection process, so that the unreachable worker node can be discovered more timely and the monitoring efficiency can be improved.

[0017] Optionally, the method further comprises: receiving a notification message from the i-th worker node, the notification message being used to indicate that the i-th worker node is offline; and in response to the notification message, stopping the detection of the reachability of the i-th worker node.

[0018] Therefore, in the scheme of the embodiments of the present application, if a worker node is offline, the worker node can notify the monitoring node, and at this time, the monitoring node can stop detecting whether the worker node is reachable, thereby saving resources.

[0019] Optionally, the triggering of the i-th worker node in the one or more worker nodes to perform the cache operation on the cache data of the first service comprises: in the case that the cache data of the first service stored on the i-th worker node is inconsistent with the cache data in the persistent database of the first service, triggering the i-th worker node to clear the locally stored cache data of the first service and re-download the cache data of the first service from the persistent database.

[0020] Based on the above scheme, the monitoring node can monitor whether the cache data of the worker node is consistent with the data in the database, and in the case that the cache data is inconsistent, the worker node can be triggered to update the cache data in a timely manner, thereby improving the consistency of the cache data and reducing system errors or business execution errors caused by data inconsistency.

[0021] Optionally, triggering the i-th working node of the one or more working nodes to perform the cache operation on the cache data of the first service comprises: receiving a cache operation request message, the cache operation request message being used to request to perform the cache operation on the cache data of the first service; and in response to the cache operation request message, triggering the i-th working node to perform the cache operation.

[0022] Optionally, triggering the cache operation on the cache data of the first service based on the first cache configuration information comprises: determining a node type of the server according to the first cache configuration information; in a case where the server is a working node, determining a monitoring node corresponding to the working node according to the first cache configuration information, the monitoring node being used to control the working node to perform the cache operation; receiving a cache operation request message from the monitoring node; and in response to the cache operation request message, performing the cache operation on the cache data of the first service.

[0023] Therefore, in the above scheme, the monitoring node can trigger the working node to perform the cache operation according to the cache request message of the service system, so as to meet the service demand of the related service.

[0024] Optionally, the method further comprises: reporting the service identifier of the first service and the IP address of the working node to the monitoring node in a timely manner.

[0025] Through the scheme, the monitoring node can obtain the information of the active (i.e., not offline) working node, so as to perform the corresponding operation (such as detecting reachability or triggering the cache operation) on the active working node, without triggering the non-active (i.e., offline) working node to perform the corresponding operation, thereby saving resources.

[0026] Optionally, the method further comprises: in a case where the first cache configuration information indicates that the cache type corresponding to the first service is jvm, and the cache operation comprises deleting the cache data of the first service, sending a cache synchronization message to other nodes, the cache synchronization message being used to instruct the other nodes to delete the cache data of the first service, the working node and the other nodes belonging to the same cluster, and the other nodes corresponding to the monitoring node.

[0027] Therefore, in the above scheme, the cache operation can be performed based on the first cache configuration information loaded in advance, so as to improve the use efficiency of data. Meanwhile, for the jvm cache type, when the cache deletion operation is performed, other servers in the cluster can be notified to perform the same operation, so as to guarantee the consistency of the cache data in different servers in the cluster.

[0028] Optionally, the method further comprises: in a case where it is determined that the working node is offline, sending a notification message to the monitoring node, the notification message being used to indicate that the working node is offline.

[0029] Therefore, in the solution of this application embodiment, if a worker node goes offline, the worker node can notify the monitoring node, at which point the monitoring node can stop detecting whether the worker node is reachable, thereby saving resources.

[0030] Optionally, loading the first cache configuration information corresponding to the first service based on the first cache declaration file includes: parsing the first cache declaration file to obtain the first cache configuration information and storing the first cache configuration information in memory; generating a session factory according to the file type of the first cache declaration file; creating a cache session object using the session factory, the cache session object being used to perform cache operations; determining the cache storage type according to the first cache configuration information; determining the cache execution object and generating the corresponding synchronization listener according to the cache storage type.

[0031] In a second aspect, a server is provided, including a memory and a processor, wherein the memory stores a computer program that can run on the processor, and when the processor executes the computer program, it causes an electronic device to perform the steps of the face feature detection method as described in either the first or second aspect above.

[0032] Thirdly, a computer-readable storage medium is provided that stores a computer program, which, when executed by a processor, implements the steps of the face feature detection method as described in any one of the first or second aspects above.

[0033] Fourthly, a computer program product is provided, which, when run on an electronic device, causes the electronic device to execute the face feature detection method described in either the first or second aspect.

[0034] Fifthly, a chip system is provided, the chip system including a processor coupled to a memory, the processor executing a computer program stored in the memory to implement the face feature detection method described in either the first or second aspect above.

[0035] The chip system can be a single chip or a chip module composed of multiple chips.

[0036] It is understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description

[0037] Figure 1 This illustration shows a schematic diagram of a caching architecture provided in an embodiment of this application;

[0038] Figure 2 A schematic block diagram of a parameter configuration method provided in an embodiment of this application is shown;

[0039] Figure 3 A schematic flowchart for loading cache configuration information is shown according to an embodiment of the present application;

[0040] Figure 4 An execution flowchart of cache operation is shown according to an embodiment of the present application;

[0041] Figure 5 A service cluster architecture schematic diagram is shown according to an embodiment of the present application;

[0042] Figure 6 A node startup flowchart is shown according to an embodiment of the present application;

[0043] Figure 7 A heartbeat detection flowchart is shown according to an embodiment of the present application;

[0044] Figure 8 A service destruction flowchart is shown according to an embodiment of the present application;

[0045] Figure 9 A cache framework schematic structural diagram is shown according to an embodiment of the present application;

[0046] Figure 10 A schematic diagram of various cache operations is shown according to an embodiment of the present application;

[0047] Figure 11 A schematic flowchart for generating a policy object is shown according to an embodiment of the present application;

[0048] Figure 12 A server structural diagram is shown according to an embodiment of the present application. DETAILED DESCRIPTION

[0049] The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings.

[0050] Cache is a kind of high-speed storage medium for temporarily storing data, which can store frequently accessed or calculated data to quickly obtain in subsequent access, reduce the access times to underlying data sources (such as databases, network interfaces), and thus improve the response speed and throughput of the system. For example, in a web server, the cache can store the results of a database query, so that the server can quickly respond to the same query without accessing the database again. Figure 1For example, assume that data A is data frequently accessed by an application in a client, and data B is rarely accessed by the application, so data A can be obtained from a disk (where a persistent database is stored) and stored in a cache, and data B is only kept in the disk. When the application accesses data A, the corresponding value can be directly obtained from the memory, without going to the disk, and since the cache is a high-speed storage medium, the access speed is fast; in contrast, when the application accesses data B, since data B is not cached in advance, the application needs to obtain the corresponding value from the disk, and the speed is slow.

[0051] That is, frequently accessed data can be stored in the cache, so that for a request from a client, if corresponding data is matched in the cache, the result in the cache can be directly returned; if corresponding data is not matched in the cache, the database is queried again. In this way, the number of interactions between the client and the database can be reduced, the efficiency of data access can be improved, and the traffic bottleneck between the client and the database can be alleviated.

[0052] In order to implement the above cache technology, it is usually necessary to configure cache-related parameters, such as cache type, cache storage, cache key, cache value, and the like. However, the configuration process of the related parameters is relatively complicated, and errors are prone to occur, resulting in that the server does not conform to the business characteristics when performing cache operations.

[0053] In view of this, an embodiment of the present application provides a parameter configuration method, in which the server directly loads cache-related configuration information through a cache declaration file, and the cache declaration file is used for centralized declaration of cache-related parameters. That is, the user only needs to adjust the parameters in the cache declaration file to complete the configuration of the cache-related parameters, without the need to find and modify the code corresponding to each parameter one by one in the business code, which not only improves the efficiency of parameter configuration, but also reduces the situation of parameter configuration errors or missing configurations.

[0054] At the same time, since the cache-related configuration information is designed based on the business characteristics, configuring the related parameters based on the above cache declaration file and performing cache operations for the corresponding business based on the related parameters can improve the running efficiency of the business. The specific implementation of the parameter configuration method provided by the embodiment of the present application will be exemplarily described below in combination with the method 100 in the embodiment. Figure 2

[0055] Before introducing the method 100, it should be first noted that the method provided by the embodiment of the present application can be applied to a server, can be applied to a certain execution module in the server, or can be applied to other devices for executing cache business, and the present application does not make any limitation. For the sake of convenience, the server executing the method in the present application is taken as an example for description in the following. ​

[0056] It should also be noted that the method provided in this application embodiment can be applied to a distributed caching architecture, which includes multiple servers, each of which executes a similar scheme. Therefore, for convenience, the method in this application will be described using one of the servers as an example.

[0057] S110: Obtain the first cache declaration file and load the first cache configuration information corresponding to the first service based on the first cache declaration file.

[0058] For example, the server first obtains the first cache declaration file. This first cache declaration file is used to centrally declare the parameters in the first cache configuration information corresponding to the first service; that is, the parameters in the first cache configuration information can be centrally managed through the first cache declaration file. Therefore, the first cache declaration file can be understood as a configuration file customized for the first service. The first service could be, for example, an e-commerce service or a promotional service.

[0059] For example, the first cache declaration file marks and declares parameters such as cache type and cache dataset corresponding to the first business through annotations or other means. Through this declaration, it can tell the caching framework or library which data needs to be cached and how to perform caching operations.

[0060] As an example, a distributed configuration center (such as Nacos) can be used to manage the first cache declaration file, which can be associated with the identification information of the first service. A distributed configuration center is a tool for managing service configuration information. In distributed systems, due to the large number of nodes and the dispersed nature of configuration information, management is difficult. A distributed configuration center, by providing centralized configuration management services, allows servers to dynamically obtain and update configuration information, thereby achieving unified management and dynamic updates of configuration information.

[0061] In other words, the cache declaration files corresponding to services can be managed and maintained through a distributed configuration center. In one specific implementation, the server and the distributed configuration center establish a network connection in advance. When the server needs to obtain the first cache declaration file, it can use this pre-established network connection to request the first cache declaration file from the distributed configuration center. Specifically, the server can obtain the first cache declaration file from the distributed configuration center (which may specifically be a configuration server) using the identification information of the first service (e.g., by downloading it).

[0062] It is understood that this application does not limit the specific timing of when the server obtains the first cache declaration file. As an example, the server can obtain the first cache declaration file directly after startup.

[0063] It can also be understood that the present application does not limit the file type of the first cache declaration file. As an example, the first cache declaration file can be a file in yaml format or a file in xml format.

[0064] After obtaining the first cache declaration file, the server loads the first cache configuration information corresponding to the first service based on the first cache declaration file. As an example, the server loading the first cache configuration information can mean that the server parses and stores the first cache configuration information, and creates a session object and / or creates a synchronization listener based on the cache configuration information.

[0065] It can be understood that the first cache configuration information includes parameters for configuring the cache characteristics of the first service, and the specific content can be determined according to the needs of the first service, which is not limited by the present application. As an example, the first cache configuration information includes one or more of the following parameters: cache type, cache storage, cache description information, cache key, key description information, key example, cache value, value description information, value example, cache monitoring prompt, cache configuration information expiration time, service custom data loading path information, and cache strategy. Correspondingly, an example of the file format of the first cache declaration file is as follows (taking the yaml format as an example):

[0066] Desc: Cache description information

[0067] Type: Cache type

[0068] CacheStorage: Cache storage

[0069] KeyDesc: Cache key description information

[0070] keyExam: Cache key example

[0071] ValueDesc: Cache value description information

[0072] ValueExam: Cache value example

[0073] Hint: Monitoring prompt

[0074] SurvieTimeDesc: Cache survival valid period description information

[0075] ExpireTime: Expiration time

[0076] loadData: Service custom data loading path information

[0077] Among them, the cache description information (Desc) is a text description used to describe some related information and characteristics of the cache, which may include the name, role, storage strategy, cache capacity and other information of the cache.

[0078] The cache type (Type) is used to describe the different data structures or storage methods adopted when storing data in the cache system. The cache type may be, for example, a string (String) or a hash (Hash). Among them, the String cache type refers to storing data in the cache in the form of a string, which is suitable for storing single values or simple key-value pair data. The Hash cache type refers to storing data in the cache in the form of a hash table, which is suitable for storing complex data structures such as objects or data containing multiple fields.

[0079] The cache storage (CacheStorage) refers to the actual storage device or storage medium used to store cache data, such as jvm or redis.

[0080] The key of the cache (key) is an identifier used to uniquely identify the cache data. In the cache, the key is usually a string, which is used to quickly find and access the corresponding cache data. Different cache systems may have certain restrictions on the length of the key, character set, etc.

[0081] The value of the cache (value) is the actual data stored in the cache. The value can be any type of data, such as a string, a number, an object, etc., depending on the needs of the application. The key and value of the cache are stored in pairs, and the key is used to quickly find the corresponding value.

[0082] The monitoring hint (Hint) is a text or identifier displayed when monitoring cache data, for example, when the cache data is inconsistent with the data in the database, the system uses a text or identifier to prompt the user or operator, and the specific content can be freely set according to the needs.

[0083] The expiration time (ExpireTime) refers to the length of time that cache data remains valid in the cache storage. When the expiration time of the cache data arrives, the cache system will mark the data as expired, and the next time it is accessed, the latest data needs to be reacquired. The expiration time can be determined according to the specific needs. Generally, the expiration time should be determined according to the update frequency and importance of the data.

[0084] The business custom data loading path information (loadData) is used to indicate the data loading path customized by the business, for example, when the required data is not found in the cache, the path can be used to continue searching, so the path usually points to the database.

[0085] It can be understood that some fields in the above examples (such as Type, CacheStorage, ExpireTime, loadData) can be considered as mandatory fields, that is, necessary fields for performing cache operations; the remaining fields can be considered as padding fields for cache monitoring, and the monitoring console fills in the monitoring interface according to the description information in the cache declaration file.

[0086] The following will be described in combination with Figure 3 A specific implementation corresponding to step S110 will be exemplarily described. It can be understood that, Figure 3 The flowchart shown is only a specific example, and in the specific implementation, Figure 3 All steps shown, and the order of execution of each step shown, and other ways of executing the flow of obtaining and loading the first cache configuration file can also be used, and the present application is not limited. Figure 3

[0087] A1, the server starts.

[0088] Exemplarily, after the server starts, a listening system can be started synchronously, which is used to listen to a cache operation instruction, the cache operation instruction being used to instruct to perform a cache operation on cache data, for example, to delete cache data. The cache instruction is, for example, from other servers of the same cluster, and specifically, for example, when the cache data in other servers has changed, in order to maintain the consistency of the cache data, the other servers can send a cache operation instruction to the server in the embodiment to instruct the server to perform the same change on the cache data. The server can obtain the cache operation instruction through the listening system, and the specific process is not limited by the present application.

[0089] A2, obtaining a first cache declaration file.

[0090] Exemplarily, after the monitoring system starts, the server obtains the cache declaration file, for example, from the distributed configuration center to obtain the first cache declaration file.

[0091] A3, loading the first cache configuration information.

[0092] Exemplarily, the first cache configuration information is obtained by parsing the first cache declaration file and stored in the memory. For example, after obtaining the first cache declaration file, the first cache configuration information can be obtained by file parsing according to the file type of the first cache declaration file. Specifically, assuming that the first cache declaration file is a yaml format file, the first cache configuration information is parsed from the first cache declaration file by a parsing method of the yaml format file.

[0093] ​Further, the parsed first cache configuration information can be stored in the memory, and the storage manner is not limited in the present application. As an example, the first cache configuration information can be stored in the memory in the form of key-value.

[0094] A4, constructing a session factory.

[0095] As an example, a session factory (SessionFactory) is generated according to the file type of the first cache declaration file. For example, if the file format of the first cache declaration file is yaml, a yaml session factory is generated; if the file format of the first cache declaration file is xml, an xml session factory is generated.

[0096] The session factory is a factory class used to create and manage a session.

[0097] A5, creating a cache session object.

[0098] As an example, after the session factory is generated, a cache session object (CacheSession) is created by using the session factory. The cache session object is a top-level interface design of cache operation, which is used to execute cache operation. The cache operation in the embodiment of the present application includes the add, delete, modify and query operations for cache data.

[0099] A6, judging the cache storage type.

[0100] As an example, the cache storage type (such as jvm or redis) is determined according to the first cache configuration information.

[0101] It can be understood that the step A6 can be executed at any time after the step A3, that is, A6 can be executed after A3, or can be executed after A4 or A5, which is not limited in the present application.

[0102] A7, creating a storage executor.

[0103] As an example, a cache execution object (executor) is determined according to the cache storage type. For example, in the case of redis cache storage, a redis link client executor object is generated; in the case of jvm cache storage, a caffeine client executor object is generated.

[0104] A8, generating a cache synchronization listener.

[0105] Exemplarily, a corresponding synchronization listener listen is generated according to the cache storage type. For example, if the storage type is jvm, a jvm corresponding synchronization listener is generated; if the synchronization type is redis, a redis listener is generated; and if the synchronization type is kafka, a kafka listener is generated.

[0106] To sum up, the above scheme centrally manages the cache-related parameters corresponding to the first business through the first cache declaration file. Since the cache-related parameters are usually coded based on the respective business characteristics (code writing), the related codes are usually scattered in each business code, and therefore, configuring the cache-related parameters is a relatively complicated work. Based on the scheme provided in the embodiments of the present application, the cache-related parameters corresponding to the first business can be centrally managed, so that the cache configuration can be conveniently and quickly loaded based on the first cache declaration file, which can not only improve the efficiency, but also reduce the operation errors in the configuration process.

[0107] S120, triggering a cache operation of cache data of the first business based on the first cache configuration information.

[0108] Exemplarily, after the first cache configuration information is parsed, the server triggers a cache operation of cache data of the first business based on the first cache configuration information. The server triggering the cache operation can mean that the server triggers other servers to perform the cache operation, or that the server performs the cache operation by itself. The cache operation, for example, includes one or more of the following: querying the cache data of the first business, adding the cache data of the first business, deleting the cache data of the first business, and modifying the cache data of the first business.

[0109] The following will be described in combination with Figure 4 Taking the server to perform the cache operation as an example, the execution process of a kind of cache operation is described. It can be understood that, Figure 4 Taking the cache operation including the two operations of querying and deleting as an example.

[0110] B1, the business side triggers the cache operation.

[0111] Exemplarily, the business side triggers the server to perform the cache operation, for example, an application program in the client sends a cache operation request message to the server through an external interface of the server to trigger the server to perform the cache operation.

[0112] B2, obtaining a cache session object.

[0113] Exemplarily, after the server receives the cache operation request message from the business side, a pre-established cache session object (CacheSession) is obtained, and the creation process of the cache session object can be referred toFigure 3 Step A5 in the foregoing method, which will not be repeated here.

[0114] B3, obtaining a cache storage object according to the key; and B4, obtaining a corresponding cache strategy.

[0115] Exemplarily, the server obtains the key from the first cache configuration information, and obtains the corresponding cache storage object (i.e., the value corresponding to the key) and the corresponding cache strategy according to the key. Here, the cache strategy can be obtained from the first cache configuration information. The cache strategy refers to a strategy for determining storage and management of cache data in the cache system, for example. The selection and configuration of the cache strategy can be adjusted according to specific business requirements and system performance requirements, which will not be limited here.

[0116] B5, determining the type of the cache storage.

[0117] Exemplarily, the type of the cache storage is determined according to the preloaded first cache configuration information. If the cache storage is redis, steps B6-B10 are executed. If the cache storage is jvm, steps B11-B19 are executed. The following will be described respectively.

[0118] B6, obtaining a redis storage excutor.

[0119] Exemplarily, if the cache storage is redis, a pre-generated redis storage excutor (i.e., a redis link client excutor object) is obtained. The specific generation process can refer to step A7 in the foregoing method, which will not be repeated here. Figure 3

[0120] It can be understood that the redis storage excutor is used to execute cache operations triggered by the business party.

[0121] B7, determining the cache operation.

[0122] Exemplarily, the server further determines the type of the cache operation, and determines the operation to be executed according to the type of the cache operation. If the cache operation triggered by the business party is a deletion operation (i.e., deleting the cache data of the first business), step B8 is executed. If the cache operation triggered by the business party is a query operation (i.e., querying the cache data of the first business), B9 is executed.

[0123] B8, executing cache deletion.

[0124] Exemplarily, if the cache operation triggered by the business party is a deletion operation, the redis storage excutor is used to delete the cache data of the first business.

[0125] B9, executing cache query. ​

[0126] Exemplarily, if the cache operation triggered by the business party is a query operation, the redis storage executor is used to query the cache data of the first business.

[0127] B10, optionally, the corresponding loadData class is obtained.

[0128] Exemplarily, in the case of executing a query operation but there is no cache data of the first business in the cache, the loadData method of the business party can be called to load the business data, and the specific process is not limited by the present application.

[0129] B11, the caffeine storage executor is obtained.

[0130] Exemplarily, if the cache storage is jvm, the pre-generated caffeine storage executor (i.e. caffeine client executor object) is obtained, and the specific generation process can refer to step A7 in Figure 3 , which will not be repeated here.

[0131] It can be understood that the jvm storage executor is used to execute the cache operation triggered by the business party.

[0132] B12, the cache operation is determined.

[0133] Exemplarily, the server further determines the type of the cache operation, and determines the operation to be executed according to the type of the cache operation. If the cache operation triggered by the business party is a delete operation (i.e. deleting the cache data of the first business), steps B13-B17 are executed. If the cache operation triggered by the business party is a query operation (i.e. querying the cache data of the first business), B18-B19 are executed.

[0134] B13, the cache is deleted.

[0135] Exemplarily, if the cache operation triggered by the business party is a delete operation, the caffeine storage executor is used to delete the cache data of the first business.

[0136] B14, the message component is determined.

[0137] Exemplarily, unlike redis cache, the biggest feature of jvm cache is its non-centralized cache storage, so when the cache deletion operation is executed, other servers in the cluster also need to be notified to execute the same operation to ensure the consistency of the cache data between different servers. For example, cache synchronization messages can be pushed according to the configured message component to achieve cache consistency. If the type of the message component is kafka, B15 is executed; if the type of the message component is http, B16 is executed; if the type of the message component is redis, B17 is executed.

[0138] B15, sending a kafka message.

[0139] Illustratively, if the type of the message component is kafka, the server sends a kafka message to other servers in the cluster to instruct the other servers to perform a deletion operation on the cache data of the first service.

[0140] B16, polling http request call execution.

[0141] Illustratively, if the type of the message component is http, the server polls other servers in the cluster to perform a deletion operation on the cache data of the first service through an http request call.

[0142] B17, sending a redis message.

[0143] Illustratively, if the type of the message component is redis, the server sends a redis message to other servers in the cluster to instruct the other servers to perform a deletion operation on the cache data of the first service.

[0144] B18, performing a cache query.

[0145] Illustratively, if the cache operation triggered by the service party is a query operation, the caffeine storage executor is used to query the cache data of the first service.

[0146] B19, obtaining a corresponding loadData class.

[0147] Illustratively, in the case of performing a query operation but there is no cache data of the first service in the cache, the loadData method of the service party can be called to load service data, and the specific process is not limited by the present application.

[0148] Therefore, in the above scheme, the cache operation can be performed based on the preloaded first cache configuration information, improving the use efficiency of data. At the same time, for the jvm cache type, when performing a cache deletion operation, the message component can be used to notify other servers in the cluster to perform the same operation, so as to guarantee the consistency of the cache data.

[0149] In summary, in the above method 100, through steps S110 and S120, the first cache configuration information can be loaded based on the first cache declaration file, and the cache operation can be triggered based on the storage configuration information. However, the first cache configuration information is written according to the service characteristic code of the first service, so in the iterative development process of the first service, the corresponding first cache configuration information also needs to be updated.

[0150] As an example, in the case of maintaining the first cache declaration file through the distributed configuration center, if a user or developer needs to modify the first cache declaration file, the first cache declaration file maintained in the distributed configuration center can be directly modified. In the case where the first cache declaration file is modified, the distributed configuration center can notify the corresponding server so that the server downloads the modified cache declaration file from the distributed configuration center.

[0151] For example, the server obtains the second cache declaration file in the case of receiving the change prompt information. The change prompt information is used to indicate that the first cache configuration information is updated to the second cache configuration information, or the change prompt is used to indicate that the first cache declaration file is changed, or the change prompt is used to indicate that the configuration information related to the first service is changed, or the change prompt is used to indicate that the server updates the first cache declaration file, or the change prompt is used to indicate that the server re-downloads the cache declaration file from the distributed configuration center. The change prompt is sent by the distributed configuration center to the server, for example.

[0152] After obtaining the second cache declaration file, the server loads the second cache configuration information corresponding to the second service based on the second cache declaration file, and then triggers the cache operation of the cache data of the second service based on the second cache configuration information. The second service is the first service or the service after the first service is updated and iterated, and the second cache declaration file is used to centrally declare the parameters in the second cache configuration information. The specific implementation process is similar to the scheme introduced in the above S110 and S120 part, and for the sake of brevity, it will not be repeated here.

[0153] In summary, the configuration parameters related to the cache are centrally declared through the cache declaration file, which can more conveniently manage the configuration parameters. In the process of service iteration and update, only the cache declaration file corresponding to the service needs to be modified, and the server needs to be triggered to reload the new cache declaration file, without the need to modify the cache feature related code scattered in each service code, thereby improving the configuration update efficiency and reducing the situation of missing cache configuration parameters.

[0154] As can be seen from the above-mentioned scheme, the cache is a scheme that uses high-speed storage to replace low-speed storage. However, in the process of using the cache, various cache operations (such as deleting, modifying, etc. of the cache data) may cause the data in different storage media to be inconsistent, which may cause system function abnormalities, data errors or business logic errors, etc.

[0155] In view of this, the parameter configuration method provided in the embodiments of the present application can control the working node to perform the cache operation through the monitoring node, and when the cache data maintained by the working node is inconsistent with the data in the database in the source database, the working node can be triggered to update the cache data in time, thereby improving the consistency of the cache data. On the other hand, the effectiveness of the communication between the monitoring node and the working node is maintained, thereby ensuring that the control instruction of the cache operation can accurately reach the working node, and reducing the situation that the cache data is inconsistent due to the failure of the control instruction to be sent successfully.

[0156] The parameter configuration method provided in the embodiments of the present application will be further described below in combination with step S120 in the method 100. Specifically, the server triggering the cache operation of the cache data of the first service based on the first storage configuration information can include the following two possible implementation manners.

[0157] In the first possible implementation manner, if the current server is a monitoring node, the working node is triggered to perform the cache operation based on the comparison between the working node and the cache data in the database or an external request.

[0158] Exemplarily, the server obtains the first cache declaration file, and after loading the cache configuration information corresponding to the first service based on the first cache declaration file (the specific implementation manner can refer to the description of step S110 above), the node type of the server is determined according to the first cache configuration information. The node type here includes, for example, a monitoring node and / or a working node, wherein the monitoring node is used to control the working node to perform the cache operation, and the working node is used to perform the cache operation based on the control instruction from the monitoring node. One monitoring node corresponds to one or more working nodes, and one server can be a monitoring node, a working node, or both. It can be understood that the monitoring node and the working node are only names used to identify two different types of nodes in the embodiments of the present application, and in different application scenarios, the two types of nodes can also be called other names.

[0159] In an example, the IP addresses of the monitoring node and the working node are included in the first cache configuration information, such as the following parameters in the first cache configuration information: masterip: IP1; workip: IP2, IP3, IP4…, wherein “masterip” represents the IP address of the monitoring node, and “workip” represents the IP address of the working node. If the IP address of the current server is IP1, it means that the current server is a monitoring node; if the IP address of the current server is one of IP2, IP3, IP4…, it means that the current server is a working node.

[0160] When the server acts as the monitoring node, a list of worker nodes is obtained. This list includes the Internet Protocol (IP) addresses of one or more worker nodes. The monitoring node (i.e., the current server) corresponds to one or more worker nodes and is used to control these worker nodes to perform caching operations. In one possible implementation, the monitoring node can obtain the worker node list based on first cache configuration information. In another possible implementation, worker nodes actively register with the monitoring node after startup. For example, worker nodes may proactively report their IP addresses and corresponding service identifiers to the monitoring node. In this case, the monitoring node can obtain the worker node list by organizing the information of the registered worker nodes.

[0161] After obtaining the list of worker nodes, the monitoring node can trigger one or more worker nodes in the list to perform caching operations. Taking the i-th worker node (where i is a positive integer greater than or equal to 1) as an example: the monitoring node triggers the i-th worker node to perform a caching operation on the cached data for the first business.

[0162] For example, in one scenario, if a monitoring node detects that the cached data for the first service stored on the i-th worker node is inconsistent with the cached data in the persistent database of the first service, it triggers the i-th worker node to clear the locally stored cached data for the first service and then download the cached data for the first service again from the persistent database. In other words, in this scenario, the caching operation for the cached data of the first service includes clearing the local cached data and retrieving the cached data for the first service. Here, the persistent database for the first service refers to a database system used for long-term storage and management of the first service data. It is typically stored on a hard drive, thus ensuring that the data is reliably preserved even after the system is shut down or power is lost, and can be read and modified when needed. For convenience, this application refers to the persistent database simply as the database. This scheme allows for timely updates to the cached data of worker nodes when inconsistencies are detected, reducing system anomalies caused by cached data errors.

[0163] For example, in another scenario, after receiving a cache operation request message, the monitoring node, in response to the cache operation request message, triggers the i-th worker node to execute the cache operation. For instance, the monitoring node receives an operation request message from a client requesting a cache operation on the cached data of the first service. In response to this operation request message, the i-th worker node is triggered to execute the cache operation on the cached data of the first service.

[0164] Optionally, the monitoring node can also detect reachability of one or more of the worker nodes in the worker node list. The detection of reachability of a worker node means detecting whether communication between the monitoring node and the worker node is effective. The following takes the ith worker node as an example for illustration.

[0165] The reachability of the ith worker node is detected. For example, the monitoring node periodically sends a heartbeat detection message to the ith worker node. In the case that no response message to the heartbeat detection message is received within a preset reach period, it is determined that the ith worker node is unreachable.

[0166] In the case that the ith worker node is unreachable, the monitoring node sends an alarm information indicating that the ith worker node is unreachable. In the case that the ith worker node is reachable, the monitoring node does not perform other operations.

[0167] Optionally, if the monitoring node learns that the ith worker node is offline, the monitoring node can stop detecting the reachability of the ith worker node. For example, the monitoring node receives a notification message from the ith worker node indicating that the ith worker node is offline; in response to the notification message, the monitoring node stops detecting the reachability of the ith worker node.

[0168] Therefore, in the scheme of the embodiments of the present application, if a worker node is offline, the worker node can notify the monitoring node, and at this time the monitoring node can stop detecting whether the worker node is reachable, thereby saving resources.

[0169] In the second possible implementation, if the current server is a worker node, the cache operation is performed based on the instruction of the monitoring node.

[0170] For example, the server obtains the first cache declaration file, and after loading the cache configuration information corresponding to the first service based on the first cache declaration file (the specific implementation can refer to the description of the S110 step above), the node type of the server is determined according to the first cache configuration information. The specific implementation can refer to the first possible implementation described above.

[0171] In the case that the server is a worker node, the monitoring node is determined, and the cache operation is performed according to the instruction of the monitoring node.

[0172] For example, the worker node determines the monitoring node according to the first cache configuration information (such as obtaining the IP address of the worker node), the monitoring node corresponds to the worker node, and the monitoring node is used to control the worker node to perform the cache operation. Further, the worker node receives a cache operation request message from the monitoring node, the cache operation request message is used to request to perform the cache operation on the cache data of the first service. In response to the cache operation request message, the worker node performs the cache operation on the cache data of the first service.

[0173] Optionally, the working node reports the service identifier of the first service and the IP address of the working node to the monitoring node. Through this scheme, the monitoring node can obtain the information of the active (i.e. not offline) working node, so as to perform corresponding operations (such as detecting reachability, or triggering cache operation) on these active working nodes, without triggering the non-active (i.e. offline) working node to perform corresponding operations, thereby saving resources.

[0174] Optionally, in the case of determining offline, the working node sends a notification message to the monitoring node, and the notification message is used to indicate that the working node is offline. That is, the working node can actively report that it will be offline, so that the monitoring node does not have to actively discover the offline working node through the reachability detection process, thereby saving resources and improving the efficiency of system operation.

[0175] In summary, based on the above scheme, the monitoring node can monitor whether the cache data of the working node is consistent with the data in the database, and in the case of inconsistent cache data, the working node can be triggered to update the cache data in a timely manner, thereby improving the consistency of the cache data and reducing system errors or business execution errors caused by inconsistent data.

[0176] At the same time, through reachability detection, the offline working node can be discovered in a timely manner and an alarm can be issued, thereby alleviating the problem of communication effectiveness between the monitoring node and the working node, and reducing the situation of inconsistent cache data caused by the failure of sending control instructions.

[0177] Corresponding to the parameter configuration method given in the above embodiment, the present embodiment also provides a server cluster architecture, in which a plurality of servers are deployed in a cluster manner, and the plurality of servers include at least one monitoring node and one or more working nodes. Figure 5 An example of the server cluster architecture is shown, and it can be understood that, Figure 5 Only one monitoring node and two working nodes are shown, but Figure 5 The shown architecture is only an example, and according to actual needs, the architecture can also include two or more monitoring nodes, and can also include three or more working nodes, or only one working node, which is not limited by the present application. In addition, Figure 5 The shown architecture takes the redis cache as an example of the cache storage type.

[0178] It can be understood that, in Figure 5 The shown architecture, any node can correspond to the server in the method 100 described above, for example, Figure 5 The monitoring node in the method 100 can be used to perform the scheme when the server is the monitoring node.Figure 5 Any one of the worker nodes in the architecture of FIG. 1 can be used to execute the scheme performed by the server in the method 100 when the server is a worker node. Thus, the following description of the execution steps of the nodes is exemplary and can be applied to the worker nodes in the architecture of FIG. 1. Figure 5 The parts not described in detail in the corresponding scheme can refer to the description in the method 100.

[0179] The following exemplary description of the execution steps of the nodes is in conjunction with the architecture of FIG. 1. Figure 5

[0180] C1, the worker node loads the first cache configuration information and determines the monitoring node.

[0181] C2, the monitoring node loads the first cache configuration information, opens the monitoring management capability, and detects the reachability of the worker node.

[0182] C3, periodically reports the service identifier and IP to the monitoring node.

[0183] Exemplarily, after the server (worker node or monitoring node) is started, the first cache configuration information is loaded. For example, the server loads the first cache configuration information through the first cache declaration file. The specific implementation manner can refer to the description of the part S110 in the method 100, which will not be repeated here.

[0184] Then, the server determines whether the node type of itself is a monitoring node or a worker node based on the first cache configuration information, and then executes the corresponding scheme according to the node type of itself. The following exemplary description of the specific implementation process is in conjunction with the architecture of FIG. 1. Figure 6

[0185] D1, the server is started.

[0186] D2, the first cache declaration file is obtained.

[0187] Exemplarily, after the server is started, the server can start to listen to the system and obtain the first cache declaration file, and then load the first cache configuration information based on the first cache declaration file. The specific implementation process is similar to the steps A1 and A2 in the method 100, which will not be repeated here for the sake of brevity. Figure 3

[0188] D3, it is determined whether the server is a monitoring node.

[0189] Exemplarily, it is determined whether the server is a monitoring node based on the first cache configuration information.

[0190] In an example, the IP address of the monitoring node is included in the first cache configuration information. If the IP address of the current server matches the IP address of the monitoring node, it indicates that the current server is a monitoring node, and then step D4 is directly executed, otherwise, step D5 is executed.

[0191] ​​​D4 provides an open monitoring interface to obtain a list of worker nodes and detect their reachability.

[0192] For example, when the server determines its own monitored nodes, it opens the monitoring interface (i.e., opens monitoring management capabilities) to the worker nodes to provide monitoring and management services. Simultaneously, it obtains a list of worker nodes and checks the reachability of one or more worker nodes in that list.

[0193] In one possible implementation, the reachability of worker nodes can be detected through a heartbeat detection process. The following example... Figure 7 For example, in step E1, the server starts a heartbeat detection task. Then, in step E2, it determines whether it is a monitoring node. If the current server is a monitoring node, step E3 is triggered, which involves obtaining a list of worker nodes. Then, in step E4, the server checks the reach of one or more worker nodes in the worker node list. For example, the monitoring node sends a heartbeat detection message to a worker node. If the worker node receives the heartbeat detection message from the monitoring node, it returns a response message. In this case, in step E5, the monitoring node determines whether the return time of the response message exceeds the reach period. That is, the monitoring node determines whether it received the response message within the reach period. If it did not receive the response message within the reach period, then in step E6, the worker node determines that it is offline. If the current server is a worker node, and the worker node is about to go offline, it can notify the monitoring node. For example, in step E7, the worker node obtains the address of the monitoring node and then triggers the monitoring node to stop heartbeat detection.

[0194] D5 determines whether it is a working node.

[0195] For example, if the current server is not a monitoring node, it is further determined whether it is a working node based on the first cache configuration information.

[0196] In one example, the first cache configuration information includes the IP address of the worker node. If the IP address of the current server matches the IP address of the worker node, it indicates that the current server is a worker node, and step D6 is executed directly; otherwise, the current process ends.

[0197] D6, obtain the address of the monitoring node.

[0198] D7, report business identifier and IP, and enable message listening.

[0199] Exemplarily, when the server determines itself as a worker node, the server acquires the address of the monitoring node and reports the service identifier of the first service and the IP of the server to the monitoring node. For example, the server acquires the IP of the monitoring node according to the first cache configuration information, and then reports the identifier of the first service and the IP of the server to the monitoring node at a regular time interval (e.g., every 10 minutes).

[0200] C4, the monitoring node sends a monitoring command to the worker node.

[0201] Exemplarily, the monitoring node can trigger the worker node to perform the cache operation based on a comparison between the cache data of the worker node and the cache data in the database or an external request.

[0202] For example, when the monitoring node detects that the cache data of the first service stored on a certain worker node is inconsistent with the cache data in the persistent database of the first service, the monitoring node triggers the worker node to clear the locally stored cache data of the first service and re-download the cache data of the first service from the persistent database.

[0203] For another example, after the monitoring node receives a cache operation request message from the service system, the monitoring node triggers the worker node to perform the cache operation in response to the cache operation request message.

[0204] As an example, the monitoring node can send a command to a specific worker node based on the hypertext transfer protocol (HTTP) protocol to trigger the cache operation. It can be understood that the monitoring node can specify an IP (i.e., specify a worker node) or specify a cluster (i.e., specify multiple worker nodes in a cluster) to perform the cache operation.

[0205] C5, optionally, after the service is destroyed, the server actively performs offline notification.

[0206] Exemplarily, after the service of the server is destroyed, the server can actively perform offline notification to the corresponding node (corresponding monitoring node or worker node). The following will be described in combination with Figure 8 The specific process is exemplarily described as follows:

[0207] F1, after (or before) the service is destroyed, triggering step F2; F2, the current server determines whether it is a monitoring node; F3, if the current server is a monitoring node, obtaining a list of worker nodes; F4, after the monitoring node obtains the list of worker nodes, issuing offline notification to one or more worker nodes in the list of worker nodes to indicate that the worker nodes no longer actively trigger heartbeat detection to the monitoring node; F5, if the current server is a worker node, obtaining address information of the monitoring node; F6, after the worker node obtains the address of the monitoring node, logging out the worker node information from the monitoring node, for example, logging out the identifier of the first service and the IP address of the worker node, so that the monitoring node stops the heartbeat detection for the worker node.

[0208] In summary, in the server cluster architecture provided by the embodiments of the present application, multiple servers are deployed in a cluster. In order to achieve the purpose of cache monitoring, at least one server in the cluster is set as a monitoring node to monitor the cache consistency of other servers and control other servers to perform cache operations. At the same time, in the server cluster architecture, the problem of communication reliability between the monitoring node and the worker node is solved, and the reliability of the cache monitoring scheme is improved.

[0209] Corresponding to the parameter configuration method and the server cluster architecture provided in the above embodiments, the embodiments of the present application further provide a cache framework. The cache framework can be a library (Library) deployed in a server, so that the server can execute the method provided by the embodiments of the present application. The library is a reusable code set containing frequently used functions, objects and tools in programming, which provides a way to abstract and encapsulate general code into reusable modules, so that developers can develop applications more efficiently.

[0210] Please refer to Figure 9 The cache framework provided by the embodiments of the present application includes five modules: interface facade module, parsing & execution module, node management module, strategy selection module and message management module.

[0211] The interface facade module provides external capabilities, that is, external devices or programs can trigger the server to perform cache operations such as cache query, cache cleaning, jvm cluster cleaning, etc. through the interface facade module.

[0212] The parsing & execution module is configured to provide the calling logic for the cached declaration file, that is, the parsing & execution module can be configured to parse and load the cached declaration file. Meanwhile, the parsing & execution module can also be configured to perform link management, command execution, synchronous listening and the like. The link management refers to the management of the communication link established between different servers, for example, when the cache cleaning needs to be performed across servers, the parsing & execution module can be configured to find the link of the target server so as to trigger the target server to perform the cache cleaning according to the link; the command execution refers to the execution of the corresponding cache operation based on the cache, such as cache query, cache cleaning and the like; the synchronous listening refers to the listening of whether the data in the current server is consistent with the data in the database.

[0213] The node management module is configured to provide the start listening, logout listening, inter-service heartbeat detection and the like for the service nodes using the framework. The node management module supports different message types, such as http, kafka, redis and the like. The parsing & execution module can select different message components based on the strategy.

[0214] The memory is configured to implement the cache function. The memory can support a plurality of different types of storage, such as redis, jvm and the like. The parsing & execution module can select different memories based on the strategy.

[0215] The message management module is configured to provide the message communication and synchronization function between the service nodes using the framework.

[0216] The following illustrates the process of the server executing the method embodiment provided in the application through the cache framework. The steps not described in detail can refer to the description in the method embodiment part.

[0217] For example, after the server is started, the node management module starts the listening. The specific scheme can refer to the description in the step A1 part of Figure 3 Meanwhile, the node management module loads the parsing & execution module. Then, the parsing & execution module loads the first cache declaration file corresponding to the first business (assuming that the first cache declaration file is a file in the yaml format), parses the file format to obtain the first cache configuration information, and stores the information in the memory in the form of key-value.

[0218] On the other hand, the parsing & execution module can load the corresponding memory module and message management module according to the business strategy.

[0219] When the business system calls the parsing & execution module to execute the cache operation through the interface facade module, the parsing & execution module can select the corresponding memory based on the strategy to execute the corresponding cache operation. In addition, in some scenarios, the parsing & execution module can also call the message management module to notify other servers to execute the corresponding cache operation. The following will be described in combination withFigure 10 Part of the cache operation is listed.

[0220] In the first example, the business system performs ip query jvm cache, the cache framework can query the ip information corresponding to the business first, and then acquires the jvm cache interface according to the ip, so as to query the jvm cache based on the jvm cache interface.

[0221] In the second example, the business system specifies ip to clean up jvm cache, the cache framework can query the ip information corresponding to the business first, and then clean up the jvm cache according to the ip.

[0222] In the third example, the business system indicates to clean up all jvm caches. Since jvm is a non-centralized cache storage, the cache framework can distribute messages through the message component to instruct other servers in the cluster to clean up jvm caches. Correspondingly, other servers listen to messages through the cache framework, and clean up jvm caches according to the listened messages.

[0223] In the fourth example, the business system specifies ip to query redis cache, the cache framework can query the ip information corresponding to the business first, and then acquires the redis cache interface according to the ip, so as to query the redis cache based on the redis cache interface.

[0224] In the fifth example, the business system specifies ip to clean up redis cache. Since redis is a centralized cache storage, the servers in the cluster can synchronize to perform redis cache operation. Therefore, in this case, the cache framework can query the redis configuration information corresponding to the business first, and then clean up the redis cache based on the configuration information.

[0225] It can be understood that if the cache operation process shown in Figure 5 is executed by the server cluster architecture shown in Figure 10 , the cache operation process in the second column of the table shown in Figure 10 is executed by the worker node through the built-in cache framework, and the cache operation process is triggered and executed by the monitoring node.

[0226] As can be seen from the above solutions, the cache framework provided by the embodiments of the present application provides a complete set of centralized management cache mechanism, which can effectively monitor and process the cache. At the same time, the cache framework provided by the present application provides a set of flexible and lightweight integration scheme, which can minimize the integration of other components or servers, and therefore can be suitable for various scenes and reduce the integration difficulty of the scheme. Specifically, the memory and message component in the present application support a plurality of different types of objects, which can be freely selected or extended according to specific strategies. The following will be described in combination with Figure 11Briefly described, the processor obtains the first cache configuration information at step G1, and the specific process can refer to the description corresponding to steps A2 and A3 in Figure 3 . Then, the processor calls the policy context based on the first cache configuration information to obtain all policies at step G2. Finally, the processor generates the corresponding policy object according to the policies at step G3. Specifically, the memory and the message component can be uniformly obtained through the policy context, and the corresponding policy object can be generated according to the policy code configured by the business. The code uses the policy mode for decoupling. By providing a unified application programming interface (API) of the memory and a unified API of the message communication (see the storage API in the memory and the message API in the message management module in Figure 9 ), if a new memory and a new message component need to be implemented, the unified API can be extended to implement the new memory and the new message component. Therefore, flexible extension can be implemented, and the cache framework provided by the embodiments of the present application can adapt to more scenarios.

[0227] Corresponding to the method provided in each of the method embodiments, the embodiments of the present application also provide a corresponding server. Figure 12 A server 1200 provided by the embodiments of the present application is shown, and the server 1200 includes at least one processor 1210, a memory 1220, and a computer program 1221 stored in the memory and executable on the at least one processor. When the processor executes the computer program, the steps in any of the method embodiments described above are implemented.

[0228] The embodiments of the present application also provide a computer readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in any of the method embodiments described above can be implemented.

[0229] The embodiments of the present application provide a computer program product. When the computer program product is run on an electronic device, the mobile terminal executes the steps in any of the method embodiments described above.

[0230] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, all or part of the processes in the above-mentioned embodiment methods can be completed by a computer program instructing related hardware, and the computer program can be stored in a computer readable storage medium. When the computer program is executed by a processor, the steps of each method embodiment described above can be implemented. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or some intermediate forms. The computer readable medium at least includes any entity or device capable of carrying the computer program code to the photographing device / electronic device, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium. For example, U disk, mobile hard disk, magnetic disk or optical disk, etc. In some jurisdictions, according to legislation and patent practice, the computer readable medium can not be an electrical carrier signal and a telecommunication signal.

[0231] In the above embodiments, the description of each embodiment has its own focus, and the parts not described or recorded in detail in a certain embodiment can be referred to the related description of other embodiments.

[0232] Those skilled in the art can appreciate that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether the functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Professionals can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0233] In the embodiments provided in the present application, it should be understood that the disclosed apparatus / network device and method can be implemented in other ways. For example, the apparatus / network device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division, and there can be another division manner in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection between each other can be indirect coupling or communication connection through some interface, device or unit, and can be electrical, mechanical or other forms.

[0234] The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, i.e. may be located in one place, or may be distributed on multiple network units. Part or all of the units can be selected to achieve the purpose of the embodiment scheme according to actual needs.

[0235] The above embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can be modified, or some technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.

[0236] In addition, it should be noted that various numbers involved in the present application (such as the terms "first", "second", "third", "fourth" and other various term labels in the description and claims and the above drawings, if any) are only for the convenience of differentiation, and do not limit the scope of the present application. The size of the serial number of each process does not mean the order of execution, and the execution order of each process should be determined by its function and inherent logic.

[0237] The terms "include" and "have" and any variations thereof mean "including but not limited to", unless otherwise specifically emphasized, for example, a process, method, system, product or device including a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0238] In the embodiments of the present application, the words "exemplarily" or "for example" are used to represent as an example, illustration or description. Any embodiment or design scheme described as "exemplarily" or "for example" in the embodiments of the present application should not be interpreted as more preferred or more advantageous than other embodiments or design schemes. On the contrary, the words "exemplarily" or "for example" are intended to present the relevant concept in a specific manner.

[0239] In various embodiments of the present application, the terms and / or descriptions of different embodiments are consistent and can be mutually referred to if there is no special description and no logical conflict. The technical features in different embodiments can be combined to form new embodiments according to their inherent logical relationship. The specific operation method in the method embodiment of the present application can also be applied to the device embodiment or the system embodiment.

[0240] The "storage" or "save" referred to in the embodiments of the present application can refer to saving in one or more memories. The one or more memories can be separately arranged or integrated in the encoder or decoder, processor, or electronic device. The one or more memories can be partially separately arranged and partially integrated in the decoder, processor, or electronic device. The type of the memory can be any form of storage medium, which is not limited in the present application.

[0241] In the schematic diagrams in the drawing part of the present application specification, the lines or blocks shown by the dashed lines represent optional steps or optional modules, and the lines or blocks shown by the dotted lines represent the contents of the annotations.

Claims

1. A parameter configuration method, applied to a server, characterized in that, The method includes: Obtain the first cache declaration file, and load the first cache configuration information corresponding to the first service based on the first cache declaration file. The first cache declaration file is used to centrally declare the parameters in the first cache configuration information. The node type of the server is determined based on the first cache configuration information; When the server is a monitoring node, a list of worker nodes is obtained. The list of worker nodes includes the Internet Protocol addresses of one or more worker nodes. The monitoring node corresponds to the one or more worker nodes and is used to control the one or more worker nodes to perform caching operations. Trigger the i-th worker node among the one or more worker nodes to perform a caching operation on the cached data for the first service, where i is a positive integer greater than or equal to 1; The caching operation includes one or more of the following: querying the cached data of the first service, adding the cached data of the first service, deleting the cached data of the first service, and modifying the cached data of the first service.

2. The method according to claim 1, characterized in that, The first cache configuration information includes one or more of the following parameters: Cache type, cache memory, cache description information, cache key, description information of the cache key, example of the cache key, cache value, description information of the cache value, example of the cache value, cache monitoring prompt, expiration time of the cache configuration information, and business-defined data loading path information.

3. The method according to claim 1 or 2, characterized in that, After obtaining the first cache declaration file, the method further includes: Upon receiving a change notification, a second cache declaration file is obtained, and the second cache configuration information corresponding to the second service is loaded based on the second cache declaration file. The change notification is used to indicate that the first cache configuration information has been updated to the second cache configuration information. The second service is the first service or a service updated and iterated from the first service. The second cache declaration file is used to centrally declare the parameters in the second cache configuration information. Based on the second cache configuration information, a caching operation is triggered for the cached data of the second service.

4. The method according to claim 1, characterized in that, The method further includes: Detect the reachability of the i-th working node; If the i-th working node is unreachable, an alarm message is sent, which indicates that the i-th working node is unreachable.

5. The method according to claim 4, characterized in that, The detection of the reachability of the i-th working node includes: Receive response messages periodically sent by the i-th working node, the response messages being used in response to heartbeat detection messages sent by the server; If the response message is not received within the preset reach period, the i-th working node is determined to be unreachable.

6. The method according to claim 4 or 5, characterized in that, The method further includes: Receive a notification message from the i-th working node, the notification message being used to indicate that the i-th working node is offline; In response to the notification message, the reachability detection of the i-th working node is stopped.

7. The method according to claim 1, characterized in that, The step of triggering the i-th worker node among the one or more worker nodes to perform a caching operation on the cached data for the first service includes: If the cached data of the first service stored on the i-th working node is found to be inconsistent with the cached data in the persistent database of the first service, the i-th working node is triggered to clear the cached data of the first service stored locally and download the cached data of the first service again from the persistent database.

8. The method according to claim 1, characterized in that, The step of triggering the i-th worker node among the one or more worker nodes to perform a caching operation on the cached data for the first service includes: Receive a cache operation request message, the cache operation request message being used to request the cache operation to be performed on the cached data of the first service; In response to the cache operation request message, the i-th worker node is triggered to execute the cache operation.

9. The method according to claim 1 or 2, characterized in that, Based on the first cache configuration information, a caching operation is triggered for the cached data of the first service, including: The node type of the server is determined based on the first cache configuration information; When the server is a worker node, a monitoring node is determined according to the first cache configuration information. The monitoring node corresponds to the worker node and is used to control the worker node to perform the cache operation. Receive a cache operation request message from the monitoring node; In response to the cache operation request message, the cache operation is performed on the cached data of the first service.

10. The method according to claim 9, characterized in that, The method further includes: The service identifier of the first service and the IP address of the working node are periodically reported to the monitoring node.

11. The method according to claim 9, characterized in that, The method further includes: When the first cache configuration information indicates that the cache type corresponding to the first service is JVM, and the cache operation includes deleting the cache data of the first service, a cache synchronization message is sent to other nodes. The cache synchronization message is used to instruct the other nodes to delete the cache data of the first service. The working node and the other nodes belong to the same cluster, and the other nodes correspond to the monitoring node.

12. The method according to claim 9, characterized in that, The method further includes: If the node is determined to be offline, a notification message is sent to the monitoring node, which instructs the working node to go offline.

13. The method according to claim 1 or 2, characterized in that, The step of loading the first cache configuration information corresponding to the first service based on the first cache declaration file includes: The first cache declaration file is parsed to obtain the first cache configuration information, and the first cache configuration information is stored in memory; Generate a session factory based on the file type of the first cache declaration file; The session factory is used to create a cached session object, which is used to perform the cache operation. The cache memory type is determined based on the first cache configuration information; The cache execution object is determined based on the cache memory type, and the corresponding synchronization listener is generated.

14. A server, characterized in that, The server's structure includes a processor and memory; The memory is used to store programs that support the server in performing the methods provided in any one of claims 1 to 13, and to store data involved in implementing the methods in any one of claims 1 to 13; The processor is configured to execute programs stored in the memory.

15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to perform the method as described in any one of claims 1 to 13.

Citation Information

Patent Citations

  • Work management with claims / priority assignment and dynamic work allocation

    US20170076242A1

  • Work management with claims caching and dynamic work allocation

    US20170076247A1