CN114201315A - Caching method and device of micro-service system, electronic equipment and storage medium - Google Patents
Caching method and device of micro-service system, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN114201315A CN114201315A CN202111517976.2A CN202111517976A CN114201315A CN 114201315 A CN114201315 A CN 114201315A CN 202111517976 A CN202111517976 A CN 202111517976A CN 114201315 A CN114201315 A CN 114201315A
- Authority
- CN
- China
- Prior art keywords
- micro service
- service module
- instruction
- target
- micro
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 69
- 238000004590 computer program Methods 0.000 claims description 22
- 230000005540 biological transmission Effects 0.000 claims description 18
- 230000004044 response Effects 0.000 claims description 14
- 238000005538 encapsulation Methods 0.000 claims description 9
- 238000004458 analytical method Methods 0.000 claims description 8
- 238000004806 packaging method and process Methods 0.000 claims description 3
- 230000009286 beneficial effect Effects 0.000 abstract description 3
- 230000006870 function Effects 0.000 description 27
- 238000010586 diagram Methods 0.000 description 14
- 238000011144 upstream manufacturing Methods 0.000 description 9
- 230000008569 process Effects 0.000 description 5
- 238000012545 processing Methods 0.000 description 5
- 239000003795 chemical substances by application Substances 0.000 description 4
- 239000002699 waste material Substances 0.000 description 4
- 238000004891 communication Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 230000003993 interaction Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000007792 addition Methods 0.000 description 1
- 230000004075 alteration Effects 0.000 description 1
- 238000013475 authorization Methods 0.000 description 1
- 230000004888 barrier function Effects 0.000 description 1
- 230000008901 benefit Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000010367 cloning Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000000354 decomposition reaction Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000014509 gene expression Effects 0.000 description 1
- 230000000977 initiatory effect Effects 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 230000005055 memory storage Effects 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 230000006798 recombination Effects 0.000 description 1
- 238000005215 recombination Methods 0.000 description 1
- 238000012958 reprocessing Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/544—Buffers; Shared memory; Pipes
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the disclosure discloses a cache method and a cache device of a micro service system, an electronic device and a storage medium, wherein the micro service system comprises a first micro service module and a second micro service module, and the method is applied to the first micro service module and comprises the following steps: responding to the requirement of acquiring target data, and determining whether a target instruction matched with the target data exists in an instruction cache region of the first micro service module; if the target instruction exists in the instruction cache region, acquiring an access parameter corresponding to the target instruction from the instruction cache region; wherein the access parameter comprises an access address; and accessing the storage system based on the access parameters, and acquiring the target data from the storage system by using the target instruction. The embodiment of the disclosure can realize the instruction cache of the micro-service system, and is beneficial to improving the service efficiency of the micro-service system.
Description
Technical Field
The present disclosure relates to computer technologies, and in particular, to a cache method and apparatus for a micro service system, an electronic device, and a storage medium.
Background
With the increasing functions of information systems, a single system cannot support the implementation of all functions, and a common scheme is to form independent function modules into subsystems, and the subsystems are mutually called in an RPC (Remote Procedure Call) manner to achieve the purpose of decoupling. In particular, the micro service Architecture (micro service Architecture) popular in recent years pushes the solution extremely, and each function point may become a small API (Application Programming Interface) service module. In this context, each API call may be a service completed by several levels or dozens of service modules working together, and the call across systems becomes a main cause of time consumption of the service.
Therefore, how to reduce the service time consumption caused by cross-system calling under the micro-service framework to improve the service efficiency under the micro-service framework is a problem to be solved at present.
Disclosure of Invention
The embodiment of the disclosure provides a caching method and device for a micro service system, an electronic device and a storage medium, so as to implement instruction caching of the micro service system, effectively reduce service time consumption of the micro service system, and contribute to improving service efficiency of the micro service system.
In one aspect of the embodiments of the present disclosure, a cache method of a micro service system is provided, where the micro service system includes a first micro service module and a second micro service module, and the method is applied to the first micro service module, and the method includes:
responding to the requirement of acquiring target data, and determining whether a target instruction matched with the target data exists in an instruction cache region of the first micro service module;
if the target instruction exists in the instruction cache region, acquiring an access parameter corresponding to the target instruction from the instruction cache region; wherein the access parameter comprises an access address;
and accessing the storage system based on the access parameters, and acquiring the target data from the storage system by using the target instruction.
In one aspect of the embodiments of the present disclosure, a cache apparatus of a micro service system is provided, where the micro service system includes a first micro service module and a second micro service module, and the apparatus is disposed in the first micro service module, and the apparatus includes:
the first determining module is used for responding to the requirement of acquiring target data and determining whether a target instruction matched with the target data exists in an instruction cache region of the first micro-service module;
a first obtaining module, configured to, according to a determination result of the first determining module, obtain, from the instruction cache area, an access parameter corresponding to the target instruction if the target instruction exists in the instruction cache area; wherein the access parameter comprises an access address;
and the second acquisition module is used for accessing the storage system based on the access parameter and acquiring the target data from the storage system by using the target instruction.
In another aspect of the disclosed embodiments, an electronic device is provided, including:
a memory for storing a computer program;
a processor, configured to execute the computer program stored in the memory, and when the computer program is executed, implement the caching method of the micro service system according to any embodiment of the disclosure.
In a further aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the computer program implements the caching method of the micro service system according to any one of the above embodiments of the present disclosure.
In a further aspect of the embodiments of the present disclosure, a computer program product is provided, which includes a computer program/instruction, and when the computer program/instruction is executed by a processor, the computer program/instruction implements the caching method of the micro service system according to any one of the above embodiments of the present disclosure.
Based on the caching method and apparatus of the micro service system, the electronic device, and the storage medium provided by the embodiments of the present disclosure, for a first micro service module and a second micro service module located in the micro service system, when the first micro service module needs to acquire target data in the storage system, it is first determined whether a target instruction matching the target data exists in an instruction cache region of the first micro service module, and if the target instruction exists in the instruction cache region, an access parameter corresponding to the target instruction is acquired from the instruction cache region, where the access parameter includes an access address, and then the storage system is accessed by using the access parameter, and the target data is acquired from the storage system by using the target instruction. Therefore, the instruction cache of the micro-service system is realized, the first micro-service module can directly acquire the target data from the storage system by using the target instruction and the access parameter in the instruction cache region, and compared with the acquisition of the target data through multi-level calling, the method can effectively reduce the service time consumption of the micro-service system and is beneficial to improving the service efficiency of the micro-service system. In addition, when the first micro service module needs the target data, the current target data can be acquired from the storage system by using the target instruction and the access parameter, and the cache target data is acquired from the data cache region relative to the cache target data, so that the effectiveness and the accuracy of the data are improved.
The technical solution of the present disclosure is further described in detail by the accompanying drawings and examples.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments of the disclosure and together with the description, serve to explain the principles of the disclosure.
The present disclosure may be more clearly understood from the following detailed description, taken with reference to the accompanying drawings, in which:
FIG. 1 is a flow chart of one embodiment of a caching method of the disclosed microservice system.
FIG. 2 is a flow chart of another embodiment of a caching method of the disclosed microservice system.
Fig. 3 is a schematic diagram of a proxy layer in the caching method of the microservice system of the present disclosure.
FIG. 4 is a diagram illustrating a preset class library in the caching method of the micro service system according to the present disclosure.
Fig. 5 is an interaction diagram of a first micro service module and a second micro service module according to the present disclosure.
FIG. 6 is a schematic structural diagram of a cache device of the microservice system of the present disclosure.
FIG. 7 is a schematic structural diagram of another embodiment of a cache device of the microservice system of the present disclosure.
Fig. 8 is a schematic structural diagram of an embodiment of an application of the electronic device of the present disclosure.
Detailed Description
Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that: the relative arrangement of the components and steps, the numerical expressions, and numerical values set forth in these embodiments do not limit the scope of the present disclosure unless specifically stated otherwise.
It will be understood by those of skill in the art that the terms "first," "second," and the like in the embodiments of the present disclosure are used merely to distinguish one element from another, and are not intended to imply any particular technical meaning, nor is the necessary logical order between them.
It is also understood that in embodiments of the present disclosure, "a plurality" may refer to two or more and "at least one" may refer to one, two or more.
It is also to be understood that any reference to any component, data, or structure in the embodiments of the disclosure, may be generally understood as one or more, unless explicitly defined otherwise or stated otherwise.
In addition, the term "and/or" in the present disclosure is only one kind of association relationship describing an associated object, and means that three kinds of relationships may exist, for example, a and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" in the present disclosure generally indicates that the former and latter associated objects are in an "or" relationship.
It should also be understood that the description of the various embodiments of the present disclosure emphasizes the differences between the various embodiments, and the same or similar parts may be referred to each other, so that the descriptions thereof are omitted for brevity.
Meanwhile, it should be understood that the sizes of the respective portions shown in the drawings are not drawn in an actual proportional relationship for the convenience of description.
The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the disclosure, its application, or uses.
Techniques, methods, and apparatus known to those of ordinary skill in the relevant art may not be discussed in detail but are intended to be part of the specification where appropriate.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, further discussion thereof is not required in subsequent figures.
The disclosed embodiments may be applied to electronic devices such as terminal devices, computer systems, servers, etc., which are operational with numerous other general purpose or special purpose computing system environments or configurations. Examples of well known terminal devices, computing systems, environments, and/or configurations that may be suitable for use with electronic devices, such as terminal devices, computer systems, servers, and the like, include, but are not limited to: personal computer systems, server computer systems, thin clients, thick clients, hand-held or laptop devices, microprocessor-based systems, set-top boxes, programmable consumer electronics, networked personal computers, minicomputer systems, mainframe computer systems, distributed cloud computing environments that include any of the above, and the like.
Electronic devices such as terminal devices, computer systems, servers, etc. may be described in the general context of computer system-executable instructions, such as program modules, being executed by a computer system. Generally, program modules may include routines, programs, objects, components, logic, data structures, etc. that perform particular tasks or implement particular abstract data types. The computer system/server may be practiced in distributed cloud computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed cloud computing environment, program modules may be located in both local and remote computer system storage media including memory storage devices.
FIG. 1 is a flow chart of one embodiment of a caching method of the disclosed microservice system. As shown in fig. 1, the method of this embodiment may be applied to a first micro service module in a micro service system, including:
In the embodiment of the present disclosure, the micro service system may include a first micro service module and a second micro service module, and may further include other micro service modules, a storage system of the micro service system may be a cache system, a centralized storage system, or a distributed storage system, the number of the micro service modules included in the micro service system and the type of the storage system are not specifically limited in the embodiment of the present disclosure, and the micro service module in the embodiment of the present disclosure may also be referred to as a micro service subsystem.
In the embodiment of the disclosure, various information such as data, instructions, files, images and the like can be mutually transmitted among all the micro service modules in the micro service system. In any information transmission process, the micro service module initiating the information transmission request may be referred to as an upstream micro service module (also referred to as a client, or a client micro service module), and the micro service module responding to the information transmission request may be referred to as a downstream micro service module (also referred to as a server, or a server micro service module). The first micro service module in step 102 may be any upstream micro service module in the micro service system, and the second micro service module may be any downstream micro service module in the micro service system.
In the embodiment of the present disclosure, each micro service module in the micro service system may only support data caching, may only support instruction caching, and may also support data caching and instruction caching. The data cache may store various data such as database data, text data, image data, and the like in the data cache region, the instruction cache may store an instruction (also referred to as an operation instruction) and an access parameter corresponding to the instruction in the instruction cache region, where the instruction may be various instructions such as a database operation instruction, a text operation instruction, an image operation instruction, and the like, and the corresponding access parameter may be various access parameters such as an access parameter for accessing the database, an access parameter for accessing the text, an access parameter for accessing the image, and the like.
In the embodiment of the present disclosure, when the first micro service module needs to acquire target data in the storage system, it may be determined whether a target instruction matching the target data exists in an instruction cache region of the first micro service module. The target data may be any of database data, text data, image data, and the like in the storage system. The target instruction that matches the target data is an instruction used to retrieve the target data from the storage system.
And 104, if the target instruction exists in the instruction cache region, acquiring an access parameter corresponding to the target instruction from the instruction cache region.
In the embodiment of the present disclosure, the target instruction in the instruction cache region of the first micro service module and the access parameter corresponding to the target instruction may be received from the second micro service module and cached in the instruction cache region before the first micro service module acquires the target data this time. It should be noted that the access parameter corresponding to the target instruction may include an access address, and/or an access key. The access Address may include a device IP Address (Internet Protocol Address) of a device where the storage system is located. In the case where the target data is database data, the access address may further include a database port number. The access key may include a user name and a user password for accessing the device in which the storage system is located.
In step 104, if the determination result in step 102 indicates that the target instruction exists in the instruction cache region of the first micro service module, the access parameter corresponding to the target instruction may be obtained from the instruction cache region, and further, the data may be obtained from the storage system by using the target instruction and the access parameter.
And step 106, accessing the storage system based on the access parameters, and acquiring target data from the storage system by using the target instruction.
In the embodiment of the present disclosure, the storage system may be a distributed KV (Key-data Key-Value) system, the data storage medium of the storage system may be a finite set such as db (database), Redis (Remote Dictionary service), and a distributed cache system (MemCache), and the target instruction for acquiring the target data from the storage system is the same regardless of which micro service module in the micro service system executes the acquired target data. The target instruction can thus be passed to the first microserver module, execution of which by the first microserver module obtains the same value, while the level of invocation can be reduced.
Based on the target command and the access parameter obtained in step 104, in this step 106, the first microserver module may access the storage system based on the access parameter and obtain the target data from the storage system by using the target command.
As an example, the target data may be student name data C, which may be stored in a student achievement table B in a database a in the storage system, which is the device D. The target instruction, that is, the instruction used to obtain the target data FROM the storage system, is "SELECT C FROM B", and the access address in the access parameter may include an IP address of a device D where the storage system is located and a port number of the data a. The first micro-service module can access the database A in the device D based on the access address, and acquires the student name data C in the student information table B FROM the database A by using a target instruction 'SELECT C FROM B'.
Based on the caching method of the micro service system provided by the above embodiment of the present disclosure, for a first micro service module and a second micro service module located in the micro service system, when the first micro service module needs to acquire target data in the storage system, it is first determined whether a target instruction matching the target data exists in an instruction cache region of the first micro service module, if the target instruction exists in the instruction cache region, an access parameter corresponding to the target instruction is acquired from the instruction cache region, where the access parameter includes an access address, and then the access parameter is used to access the storage system, and the target instruction is used to acquire the target data from the storage system. Therefore, the instruction cache of the micro-service system is realized, the first micro-service module can directly acquire the target data from the storage system by using the target instruction and the access parameter in the instruction cache region, and compared with the method for acquiring the target data by calling the second micro-service module, the time consumed by the micro-service system can be effectively reduced, and the service efficiency of the micro-service system is improved. In addition, when the first micro service module needs the target data, the current target data can be acquired from the storage system by using the target instruction and the access parameter, and the cache target data is acquired from the data cache region relative to the cache target data, so that the effectiveness and the accuracy of the data are improved.
Optionally, in some possible implementations of the present disclosure, the first micro service module may receive a third obtaining request sent by a third micro service module for obtaining the target data, and in response to that the third micro service module belongs to the micro service system, the first micro service module may determine, according to a third switch parameter included in the third obtaining request, whether the third micro service module supports the instruction cache, and in response to that the third micro service module does not support the instruction cache, the first micro service module may send the target data to the third micro service module; in response to the third micro service module supporting the instruction cache, the first micro service module may send the target instruction and the access parameter to the third micro service module, so that the third micro service module obtains the target data based on the target instruction and the access parameter.
In the embodiment of the disclosure, the first micro service module may transmit the target instruction and the access parameter returned by the second micro service module to the upstream micro service module, so that the upstream micro service module may also obtain the target data from the storage system based on the target instruction and the access parameter, which is beneficial to reducing the load of the entire system.
In this embodiment of the disclosure, the first micro service module may receive a third acquisition request sent by a third micro service module for acquiring the target data, where the third micro service module may be any one of the other micro service modules in the micro service system except the first micro service module and the second micro service module, or may be any one of the other micro service modules in the micro service system except the micro service system.
In this embodiment of the disclosure, the third obtaining request sent by the third micro service module includes a third switch parameter for identifying whether the third micro service module supports instruction caching. Under the condition that the third micro service module belongs to the micro service system, the first micro service module can determine whether the third micro service module supports instruction caching according to the third switch parameter, and if the third micro service module does not support instruction caching, the first micro service module can send target data to the third micro service module; if the third micro service module supports instruction caching, the first micro service module may send the target instruction and the access parameter to the third micro service module, so that the third micro service module obtains the target data based on the target instruction and the access parameter.
It should be noted that, when sending the target data to the third micro service module, the first micro service module may send the target data acquired from the data cache region of the first micro service module to the third micro service module, or send the latest target data acquired from the storage system by using the target instruction and the access parameter corresponding to the target instruction to the third micro service module.
Based on the possible implementation manner, when the third micro service module belonging to the micro service system requests the first micro service module to acquire the target data, the first micro service module may determine to send the target data to the third micro service module or send the target instruction according to whether the third micro service module supports the instruction cache, and when sending the target data, may send the target data in its own data cache region, and may also send the latest acquired target data, which has better compatibility and applicability, and may effectively avoid resource waste caused by sending the target instruction to the third micro service module when the third micro service module does not support the instruction cache.
Optionally, in some possible implementations of the disclosure, if the third micro service module does not belong to the micro service system, the first micro service module may determine, according to the pre-configuration information, whether itself is allowed to send the instruction to another micro service system other than the micro service system, and determine, according to the third switch parameter, whether the third micro service module supports the instruction cache, and if the first micro service module is allowed to send the instruction to another micro service system other than the micro service system and the third micro service module supports the instruction cache, the first micro service module may send the target instruction and the access parameter to the third micro service module, so that the third micro service module obtains the target data based on the target instruction and the access parameter; if the first micro service module is not allowed to send the instruction to other micro service systems except the micro service system, the first micro service module may send the target data to the third micro service module.
In this possible implementation manner, in a case that the third micro service module does not belong to the micro service system, in consideration of data security, the first micro service module may determine whether the first micro service module is allowed to send the instruction to another micro service system other than the micro service system according to the pre-configuration information, and whether the third micro service module supports instruction caching, if the third micro service module supports instruction caching and is allowed to send, the third micro service module may send the target instruction and the access parameter corresponding to the target instruction to the third micro service module, so that the third micro service module obtains the target data based on the target instruction and the access parameter, and if the third micro service module is not allowed to send, the third micro service module may send the target data to the third micro service module. It should be noted that, an implementation manner of the third micro service acquiring the target data based on the target instruction and the access parameter is the same as an implementation manner of the first micro service module acquiring the target data based on the target instruction and the access parameter, and reference may be specifically made to the description of the first micro service module acquiring the target data based on the target instruction and the access parameter in the foregoing embodiment.
Based on the possible implementation manner, for the third micro service module not belonging to the micro service system, the first micro service module can only send the target instruction and the access parameter corresponding to the target instruction to the third micro service module under the condition that the pre-configuration information allows the first micro service module to send the instruction to other micro service systems except the micro service system and the third micro service module supports instruction caching, so that the data security of the micro service system can be effectively ensured.
Optionally, in some possible implementation manners of the present disclosure, the access parameter may further include an expiration policy, the first micro service module may determine whether the target instruction in the instruction cache region is in an effective state based on the expiration policy, and if the target instruction is not in the effective state, may release a storage space occupied by the target instruction and the access parameter in the instruction cache region, so as to avoid waste of the storage space by the target instruction and the access parameter in the invalid state, and help to save the storage space.
Optionally, in some possible implementations of the present disclosure, the expiration policy includes any one of: effective access duration and effective use times. The Second micro service module may configure an expiration policy for the target instruction according to a QPS (Query Per Second) of the micro service system.
Under the condition that the QPS of the micro-service system is low, the second micro-service module can determine that the expiration policy of the target instruction is the effective access duration, namely the target instruction is in an effective state in the effective access duration, and the target instruction is in a failure state when the effective access duration exceeds the effective access duration. The initial calculation time of the effective access duration may be time for the second micro service module to complete the configuration of the expiration policy, may also be time for the first micro service module to receive the target instruction, and may also be time for the first micro service module to complete the caching of the target instruction.
Under the condition that the QPS of the micro service system is high, the second micro service module may determine that the expiration policy of the target instruction is the number of effective uses, that is, the number of times that the first micro service module uses the target instruction may not exceed the number of effective uses. The number of times that the first micro service module uses the target instruction may include the number of times that the first micro service module itself uses the target instruction, and the number of times that other micro service modules that acquire the target instruction from the first micro service module use the target instruction. The effective use times may be set according to actual needs or according to QPS, and the embodiment of the present disclosure does not specifically limit the effective use times.
Or, in other possible implementation manners of the present disclosure, the second micro service module may further determine that the expiration policy of the target instruction includes two items, namely an effective access duration and an effective usage number, and within the effective access duration and without exceeding the effective usage number, the target instruction is in an effective state; and exceeding the effective access time length or exceeding the effective use times, and enabling the target instruction to be in a failure state.
Based on the possible implementation manners, the second micro service module can configure a reasonable expiration policy for the target instruction according to the QPS of the micro service system, can effectively ensure the accuracy and reliability of the target instruction, and can timely find the target instruction in the failure state, so that the storage space occupied by the target instruction and the access parameter in the instruction cache region can be released, the waste of the storage space by the target instruction and the access parameter in the failure state can be avoided, and the storage space saving is facilitated.
Optionally, in some possible implementation manners of the present disclosure, if the target instruction is not in the valid state, the first micro service module may send a third obtaining request for updating the target instruction to the second micro service module, and update the target instruction and the access parameter in the instruction cache region by using a new target instruction and a new access parameter returned by the second micro service module for the third obtaining request.
In this possible implementation manner, if the target instruction is not in an effective state, the first micro service module may send a third obtaining request for updating the target instruction to the second dimensional service module, and include target data matched with the target instruction that needs to be updated in the third obtaining request, so that the second micro service module may determine, according to the target data included in the third obtaining request, a new target instruction matched with the target data and a new access parameter.
For example, the target data may be student name data C, which is stored in a student score table B in a database a in the storage system, and the device in which the storage system is located is a device D. The target instruction is "SELECT C FROM B", and the access address in the access parameter includes the IP address of device D and the port number of data a.
In one system upgrading transformation, the database A is transplanted to the device E FROM the device D, the student name data C is transplanted to the student information table F FROM the student achievement table B, therefore, the new target instruction is 'SELECT C FROM F', and the access address in the access parameter comprises the IP address of the device E and the port number of the data A. After receiving the third acquisition request of the first micro service module, the second micro service module returns a new target instruction ("SELECT C FROM F") and new access parameters (the IP address of the device E and the port number of the data a) for the third acquisition request, so that the first micro service module updates the target instruction and the access parameters in the instruction cache region using the new target instruction and the new access parameters.
Based on the possible implementation manner, when the target instruction in the instruction cache region is not in the valid state, the first micro service module may update the target instruction and the access parameter in the instruction cache region by sending a third obtaining request to the second micro service module to obtain a new target instruction and a new access parameter. Therefore, the target instruction and the access parameter can be updated in time, and the effectiveness and the accuracy of the target instruction and the access data are improved.
Optionally, in some possible implementation manners of the present disclosure, in step 106, when the first micro service module accesses the storage system based on the access parameter and acquires the target data from the storage system by using the target instruction, the first micro service module may access the proxy layer of the storage system based on the access parameter and further receive the target data, which is returned by the proxy layer and acquired from the storage system by using the target instruction.
In the embodiment of the present disclosure, the second micro service module may output the target instruction to the first micro service module that requests the second micro service module to obtain the target data, and the first micro service module may output the target instruction to another micro service module that requests the first micro service module to obtain the target data, that is, the plurality of micro service modules in the micro service system may obtain the target data from the storage system by using the target instruction, and the storage system needs to perform access authorization on the plurality of micro service modules.
Based on this, in order to ensure the data security of the storage system and enable each micro service module to obtain the target data, a proxy layer of the storage system may be constructed, each micro service module may access the proxy layer, and the proxy layer returns the target data to each micro service module after obtaining the target data from the storage system by using the target instruction. Therefore, a safety barrier can be established for the storage system through the agent layer, each micro-service module can access the storage system through the agent layer, the data safety problem caused by the fact that each micro-service module directly accesses the storage system to obtain target data is avoided, and the safety of the data can be effectively guaranteed.
Fig. 3 is a schematic diagram of a proxy layer in the caching method of the microservice system of the present disclosure. In fig. 3, an upstream micro service module may correspond to a first micro service module in an embodiment of the present disclosure, a downstream micro service module may correspond to a second micro service module in an embodiment of the present disclosure, a cache system may correspond to a storage system in an embodiment of the present disclosure, and a cache proxy layer may be a proxy layer of the storage system in an embodiment of the present disclosure.
As shown in fig. 3, the downstream microservice module may access the caching proxy layer through a key. When the downstream microservice module returns the target instruction and the access parameter to the upstream microservice module, the access address of the caching agent layer and the key to access the caching agent layer may be included in the access parameter. The access address of the caching proxy layer may be an IP address of a device where the caching proxy layer is located, and the key for accessing the caching proxy layer may be a temporary key obtained by cloning a key for accessing the caching proxy layer by the downstream micro-service module. The upstream microservice module can access the caching proxy layer based on the access parameter, and further receive target data which is returned by the caching proxy layer and is obtained from the caching system by using the target instruction.
FIG. 2 is a flow chart of another embodiment of a caching method of the disclosed microservice system. As shown in fig. 2, on the basis of the embodiment shown in fig. 1, in response to that no target instruction exists in the instruction cache of the first microservice module, the method may further include:
In this step 108, the first micro service module may send a first obtaining request for obtaining the target data to the second micro service module when the target instruction does not exist in the instruction cache region of the first micro service module, and the first obtaining request includes a first switch parameter for identifying that the first micro service module supports the instruction cache.
After receiving the first acquisition request of the first micro service module, the second micro service module may determine whether to return the target instruction and the access parameter corresponding to the target instruction to the first micro service module according to a first switch parameter included in the first acquisition request. Here, the first switch parameter identifies that the first micro service module supports instruction caching, and the second micro service module may return the target data, the target instruction, and the access parameter to the first micro service module. The access parameter may include an access address, an access key, and an expiration policy.
Optionally, in some possible implementations of the present disclosure, if the target data is a value that can be directly obtained from the storage system, in a case that the first micro service module supports instruction caching, the second micro service may return the target data, the target instruction, and the access parameter to the first micro service module; if the target data is a value obtained by reprocessing a value directly obtained from the storage system by the second micro-service module, the second micro-service module only returns the target data to the first micro-service module and does not return a target instruction and an access parameter under the condition that the first micro-service module supports instruction caching, so that the accuracy of the data obtained by the first micro-service module is ensured.
And step 110, receiving first information returned by the second micro service module aiming at the first acquisition request.
In step 110, the first information includes the data that the second micro service module determined in step 108 needs to return to the first micro service module. Since the first switch parameter in the first get request identifies that the first micro service module supports instruction caching, the first information may include target data, a target instruction, and an access parameter.
And step 112, analyzing the first information to obtain target data, a target instruction and an access parameter, and storing the target instruction and the access parameter in an instruction cache region.
In step 112, after receiving the first information sent by the second micro service module, the first micro service module analyzes the first information to obtain data returned by the second micro service module. Under the condition that the first micro-service module supports instruction caching, the first micro-service module can obtain target data, a target instruction and an access parameter by analyzing the first information, and can store the target instruction and the access parameter in an instruction cache region so as to be used in a subsequent target data requesting process.
Based on the cache method of the micro service system provided by another embodiment of the present disclosure, in the case that the first micro service module supports instruction caching, the first micro service module may send a first get request containing a first switch parameter to the second micro service module, to obtain the target data, and can obtain the target data, the target instruction and the access parameter by analyzing the first information returned by the second micro service module aiming at the first obtaining request, and storing the target instruction and the access parameter in an instruction cache area, and subsequently when the target data needs to be acquired, the first micro service module can acquire the target data from the storage system by using the target instruction and the access parameter without acquiring the target data by calling the second micro service module, so that the service time consumption of the micro service system can be effectively reduced, and the service efficiency of the micro service system is improved.
Or, in other possible implementation manners of the present disclosure, in response to that no target instruction exists in the instruction cache region of the first micro service module, the first micro service module may send a second obtaining request for obtaining the target data to the second micro service module, where the second obtaining request includes a second switch parameter, and the second switch parameter is used to identify that the first micro service module does not support the instruction cache. And then the first micro-service module can receive second information returned by the second service module aiming at the second acquisition request, and analyze the second information to obtain target data.
Based on this, under the condition that the first micro service module does not support the instruction cache, the first micro service module may send a second acquisition request including the second switch parameter to the second micro service module to acquire the target data. After receiving the second acquisition request, the second micro service module may determine, according to a second switch parameter included in the second acquisition request, that the first micro service module does not support the instruction cache, and may further return second information including the target data for the second acquisition request. It can be seen that the second micro service module only returns the target data to the first micro service module and does not return the target instruction and the access parameter under the condition that the first micro service module does not support the instruction cache, which is helpful for avoiding resource waste caused by returning the target instruction and the access parameter to the first micro service module under the condition that the first micro service module does not support the instruction cache.
Optionally, in some possible implementation manners of the present disclosure, when the first micro service module receives the first information returned by the second micro service module for the first acquisition request, the first information returned by the second micro service module for the first acquisition request and encrypted based on the preset transmission key may be received. When the first micro service module analyzes the first information to obtain the target data, the target instruction and the access parameter, the first micro service module can decrypt the first information by using a preset transmission key to obtain decrypted first information; and then analyzing the decrypted first information to obtain target data, a target instruction and an access parameter.
In this possible implementation, part or all of the microservice modules in the microservice system may maintain a common pre-set transmission key. The preset transmission key may be determined according to actual needs, which is not specifically limited in the embodiment of the present disclosure.
When the second micro service module sends the first information to the first micro service module, the second micro service module can encrypt the first information based on a preset transmission key and then send the encrypted first information to the first micro service module, and after receiving the encrypted first information, the first micro service module can decrypt the encrypted first information based on the preset transmission key to obtain the decrypted first information, and then analyze the decrypted first information to obtain target data, a target instruction and an access parameter.
Based on the possible implementation mode, when each micro-service module in the micro-service system performs information transmission, encryption and decryption of transmission information can be realized based on the preset transmission key, and the safety of the information in the transmission process can be effectively ensured, so that the data safety of the whole micro-service system is improved.
Optionally, in other possible implementation manners of the present disclosure, when the first micro service module receives the first information returned by the second micro service module for the first acquisition request, the first information returned by the second micro service module for the first acquisition request and obtained by encapsulating the target data, the target instruction, and the access parameter based on the preset encapsulation function acquired from the preset class library may also be received. When the first micro-service module analyzes the first information to obtain the target data, the target instruction and the access parameter, a preset analysis function corresponding to a preset encapsulation function can be obtained from a preset class library, and then the first information is analyzed by using the preset analysis function to obtain the target data, the target instruction and the access parameter.
A Client-Server (C/S) communication mode based on a general Protocol such as HTTP (Hyper Text Transfer Protocol) may be unique to a Server or a Client. Any micro service module in the embodiments of the present disclosure may serve as a server to provide data to other micro service modules, or may serve as a client to request other micro service modules to obtain data.
Based on this, in this possible implementation manner, a preset class library commonly maintained by some or all micro service modules in the micro service system may be established, so that the class libraries of each micro service module may be updated and upgraded synchronously, and the system maintenance cost may be reduced in favor of maintaining the respective class libraries for each micro service module.
FIG. 4 is a diagram illustrating a preset class library in the caching method of the micro service system according to the present disclosure. As shown in fig. 4, the preset class library may include a server class library and a client type, the downstream micro service module may copy (Clone) the server class library from the preset class library, and the upstream micro service module may copy (Clone) the client class library from the preset class library, so as to implement information transmission between the upstream service module and the downstream module.
In this possible implementation manner, when the second micro service module returns the first information to the first micro service module in response to the first acquisition request, the second micro service module may encapsulate the target data, the target instruction, and the access parameter based on a preset encapsulation function acquired from the preset class library to obtain the first information. The first micro service module can analyze the first information by using a preset analysis function which is acquired from a preset class library and corresponds to the preset encapsulation function, so as to obtain target data, a target instruction and an access parameter.
In the preset class library, a decode function and an encapsulate function can be simultaneously realized aiming at the same operation, and each micro-service module can call the corresponding parse function or encapsulate function from the preset class library according to the function requirement of the micro-service module. The encapsulation function and the analysis function can follow the same preset protocol, the encapsulation function can encapsulate data according to the preset protocol to obtain encapsulated information, and the analysis function can analyze the encapsulated information according to the preset protocol to obtain real data.
As an example, for database operations, the preset protocol may be [ version ] [ mysql | pgsql | oracle | … ] [ IP: port ] [ database ] [ table ] [ command ], where [ version ] is a protocol version field, [ mysql | pgsql | oracle | … ] is a database type field, [ IP: port ] is an IP address and port field, [ database ] is a database identification field, [ table ] is a data table field, and [ command ] is an operation instruction field. The encapsulation function may encapsulate the database data according to the preset protocol to obtain encapsulated information, and the parsing function may parse the encapsulated information according to the preset protocol to obtain the database data.
Fig. 5 is an interaction diagram of a first micro service module and a second micro service module according to the present disclosure. The cache method of the microservice system of the present disclosure is further described below with reference to fig. 5:
in the first request process, when the first micro service module needs to acquire target data in the storage system, the first micro service module requests the second micro service module to acquire the target data; the second micro service module obtains target data from the storage system after receiving a request of the first micro service module, determines whether the first micro service module supports instruction cache, returns the target data to the first micro service module if the first micro service module does not support the instruction cache, adds a target instruction and an access parameter in the returned data if the first micro service module supports the instruction cache so as to return the target data, the target instruction and the access parameter to the first micro service module, and the first micro service module stores the target instruction and the access parameter returned by the second micro service module in an instruction cache area.
In the subsequent request process, when the first micro-service module needs to acquire target data in the storage system, accessing the instruction cache region of the first micro-service module to acquire a target instruction, and if the instruction cache region does not have the target instruction, repeating the first request process; if the target instruction exists in the instruction cache region, whether the target instruction is in an effective state is determined, if the target instruction is not in the effective state, the first request process is repeated, and if the target instruction is in the effective state, the first micro-service module accesses the storage system based on the access parameter and acquires target data from the storage system by using the target instruction.
Any of the caching methods of the microservice system provided by the embodiments of the present disclosure may be performed by any suitable device having data processing capabilities, including but not limited to: terminal equipment, a server and the like. Alternatively, the caching method of any one of the microservice systems provided by the embodiments of the present disclosure may be executed by a processor, for example, the processor may execute the caching method of any one of the microservice systems mentioned in the embodiments of the present disclosure by calling a corresponding instruction stored in a memory. And will not be described in detail below.
Those of ordinary skill in the art will understand that: all or part of the steps for implementing the method embodiments may be implemented by hardware related to program instructions, and the program may be stored in a computer readable storage medium, and when executed, the program performs the steps including the method embodiments; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
FIG. 6 is a schematic structural diagram of a cache device of the microservice system of the present disclosure. The micro service system of this embodiment may include a first micro service module and a second micro service module, and the cache device may be disposed in the first micro service module, and is configured to implement the cache method embodiments of each micro service system of the present disclosure. As shown in fig. 6, the apparatus of this embodiment includes: a first determination module 602, a first acquisition module 604, and a second acquisition module 606. Wherein,
a first determining module 602, configured to determine, in response to that the first micro service module needs to acquire target data, whether a target instruction matching the target data exists in an instruction cache region of the first micro service module;
a first obtaining module 604, configured to, according to a determination result of the first determining module, if a target instruction exists in the instruction cache region, obtain an access parameter corresponding to the target instruction from the instruction cache region, where the access parameter includes an access address;
and a second obtaining module 606, configured to access the storage system based on the access parameter, and obtain the target data from the storage system by using the target instruction.
Based on the cache device of the micro service system provided by the above embodiment of the present disclosure, for a first micro service module and a second micro service module located in the micro service system, when the first micro service module needs to acquire target data in the storage system, it is first determined whether a target instruction matching the target data exists in an instruction cache region of the first micro service module, if the target instruction exists in the instruction cache region, an access parameter corresponding to the target instruction is acquired from the instruction cache region, where the access parameter includes an access address, and then the access parameter is used to access the storage system, and the target instruction is used to acquire the target data from the storage system. Therefore, the instruction cache of the micro-service system is realized, the first micro-service module can directly acquire the target data from the storage system by using the target instruction and the access parameter in the instruction cache region, and compared with the method for acquiring the target data by calling the second micro-service module, the time consumed by the micro-service system can be effectively reduced, and the service efficiency of the micro-service system is improved. In addition, when the first micro service module needs the target data, the current target data can be acquired from the storage system by using the target instruction and the access parameter, and the cache target data is acquired from the data cache region relative to the cache target data, so that the effectiveness and the accuracy of the data are improved.
FIG. 7 is a schematic structural diagram of another embodiment of a cache device of the microservice system of the present disclosure. On the basis of the caching apparatus of the microservice system shown in fig. 6, the caching apparatus may further include a first request module 608, a first receiving module 610 and a parsing module 612. Wherein,
a first request module 608, configured to, according to a determination result of the first determining module, in response to that no target instruction exists in the instruction cache region, send, by the first micro service module, a first obtaining request for obtaining target data to the second micro service module; the first acquisition request comprises a first switch parameter used for identifying that the first micro service module supports instruction caching;
a first receiving module 610, configured to receive first information returned by the second micro service module for the first acquisition request;
the analyzing module 612 is configured to analyze the first information to obtain target data, a target instruction, and an access parameter, and store the target instruction and the access parameter in an instruction cache region;
or,
a first request module 608, configured to send, according to a determination result of the first determining module, a second obtaining request for obtaining target data to the second micro service module in response to that no target instruction exists in the instruction cache region; the second acquisition request comprises a second switch parameter, and the second switch parameter is used for identifying that the first micro-service module does not support instruction caching;
a first receiving module 610, configured to receive second information returned by the second service module for the second obtaining request;
and the analyzing module 612 is configured to analyze the second information to obtain target data.
Optionally, in some possible implementation manners of the present disclosure, the cache device of the micro service system may further include:
the second receiving module is used for receiving a third acquisition request which is sent by the third micro service module and used for acquiring the target data; the third obtaining request comprises a third switch parameter used for identifying whether the third micro service module supports instruction caching or not;
the second determining module is used for responding to the fact that the third micro-service module belongs to the micro-service system and determining whether the third micro-service module supports instruction caching or not according to the third switch parameter;
and the sending module is used for responding to the situation that the third micro service module does not support instruction caching according to the determination result of the second determining module and sending the target data to the third micro service module.
The sending module is further configured to respond to the instruction cache supported by the third micro service module according to the determination result of the second determining module, and send the target instruction and the access parameter to the third micro service module, so that the third micro service module obtains the target data based on the target instruction and the access parameter.
Optionally, in some possible implementation manners of the present disclosure, the cache device of the micro service system may further include:
and the third determining module is used for responding that the third micro service module does not belong to the micro service system, determining whether the first micro service module is allowed to send instructions to other micro service systems except the micro service system according to the preset configuration information, and determining whether the third micro service module supports instruction caching according to the third switch parameter.
The sending module is configured to, according to a determination result of the third determining module, in response to that the first micro service module is allowed to send the instruction to other micro service systems other than the micro service system and that the third micro service module supports instruction caching, send the target instruction and the access parameter to the third micro service module, so that the third micro service module obtains the target data based on the target instruction and the access parameter.
The sending module is further configured to send the target data to the third micro service module according to the determination result of the third determining module in response to that the first micro service module is not allowed to send the instruction to the other micro service systems except the micro service system.
Optionally, in some possible implementation manners of the present disclosure, the first receiving module 610 is specifically configured to:
receiving first information which is returned by the second micro-service module aiming at the first acquisition request and is encrypted based on a preset transmission key; and/or the presence of a gas in the gas,
and receiving first information which is returned by the second micro service module aiming at the first acquisition request and is obtained by encapsulating the target data, the target instruction and the access parameter based on a preset encapsulation function acquired from a preset class library, wherein the preset class library is commonly maintained by a plurality of micro service modules in the micro service system.
The parsing module 612 is specifically configured to:
decrypting the first information by using a preset transmission key to obtain decrypted first information, and analyzing the decrypted first information to obtain target data, a target instruction and an access parameter; and/or the presence of a gas in the gas,
acquiring a preset analytic function corresponding to a preset packaging function from a preset class library; and analyzing the first information by using a preset analysis function to obtain target data, a target instruction and an access parameter.
Optionally, in some possible implementations of the present disclosure, the access parameter may further include an expiration policy;
and the fourth determination module is used for determining whether the target instruction is in a valid state based on the expiration policy.
And the releasing module is used for releasing the storage space occupied by the target instruction and the access parameter in the instruction cache region if the target instruction is not in the effective state according to the determination result of the fourth determining module.
Optionally, in some possible implementation manners of the present disclosure, the cache device of the micro service system may further include:
and the second request module is used for sending a third acquisition request for updating the target instruction to the second micro service module according to the determination result of the fourth determination module if the target instruction is not in the valid state, and updating the target instruction and the access parameter in the instruction cache region by using a new target instruction and a new access parameter returned by the second micro service module aiming at the third acquisition request.
Optionally, in some possible implementations of the present disclosure, the expiration policy may include any one of the following: effective access duration and effective use times.
Optionally, in some possible implementation manners of the present disclosure, the second obtaining module 606 may include:
and the access unit is used for accessing the proxy layer of the storage system based on the access parameter.
And the receiving unit is used for receiving the target data which is returned by the proxy layer and is acquired from the storage system by using the target instruction.
In addition, an embodiment of the present disclosure also provides an electronic device, including:
a memory for storing a computer program;
a processor, configured to execute the computer program stored in the memory, and when the computer program is executed, implement the caching method of the micro service system according to any embodiment of the disclosure.
Fig. 8 is a schematic structural diagram of an embodiment of an application of the electronic device of the present disclosure. Next, an electronic apparatus according to an embodiment of the present disclosure is described with reference to fig. 8. The electronic device may be either or both of the first device and the second device, or a stand-alone device separate from them, which stand-alone device may communicate with the first device and the second device to receive the acquired input signals therefrom.
As shown in fig. 8, the electronic device includes one or more processors and memory.
The processor may be a Central Processing Unit (CPU) or other form of processing unit having data processing capabilities and/or instruction execution capabilities, and may control other components in the electronic device to perform desired functions.
The memory may include one or more computer program products that may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. The volatile memory may include, for example, Random Access Memory (RAM), cache memory (cache), and/or the like. The non-volatile memory may include, for example, Read Only Memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium and executed by a processor to implement the caching method of the microservice system of the various embodiments of the present disclosure described above and/or other desired functionality.
In one example, the electronic device may further include: an input device and an output device, which are interconnected by a bus system and/or other form of connection mechanism (not shown).
The input device may also include, for example, a keyboard, a mouse, and the like.
The output device may output various information including the determined distance information, direction information, and the like to the outside. The output devices may include, for example, a display, speakers, a printer, and a communication network and remote output devices connected thereto, among others.
Of course, for simplicity, only some of the components of the electronic device relevant to the present disclosure are shown in fig. 8, omitting components such as buses, input/output interfaces, and the like. In addition, the electronic device may include any other suitable components, depending on the particular application.
In addition to the above methods and apparatus, embodiments of the present disclosure may also be a computer program product comprising computer program instructions that, when executed by a processor, cause the processor to perform the steps in the caching method of the microservice system according to various embodiments of the present disclosure described in the above section of this specification.
The computer program product may write program code for carrying out operations for embodiments of the present disclosure in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server.
Furthermore, embodiments of the present disclosure may also be a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, cause the processor to perform the steps in the caching method of the microservice system according to various embodiments of the present disclosure described in the above section of the present specification.
The computer-readable storage medium may take any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may include, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The foregoing describes the general principles of the present disclosure in conjunction with specific embodiments, however, it is noted that the advantages, effects, etc. mentioned in the present disclosure are merely examples and are not limiting, and they should not be considered essential to the various embodiments of the present disclosure. Furthermore, the foregoing disclosure of specific details is for the purpose of illustration and description and is not intended to be limiting, since the disclosure is not intended to be limited to the specific details so described.
In the present specification, the embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts in the embodiments are referred to each other. For the system embodiment, since it basically corresponds to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The block diagrams of devices, apparatuses, systems referred to in this disclosure are only given as illustrative examples and are not intended to require or imply that the connections, arrangements, configurations, etc. must be made in the manner shown in the block diagrams. These devices, apparatuses, devices, systems may be connected, arranged, configured in any manner, as will be appreciated by those skilled in the art. Words such as "including," "comprising," "having," and the like are open-ended words that mean "including, but not limited to," and are used interchangeably therewith. The words "or" and "as used herein mean, and are used interchangeably with, the word" and/or, "unless the context clearly dictates otherwise. The word "such as" is used herein to mean, and is used interchangeably with, the phrase "such as but not limited to".
The methods and apparatus of the present disclosure may be implemented in a number of ways. For example, the methods and apparatus of the present disclosure may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above-described order for the steps of the method is for illustration only, and the steps of the method of the present disclosure are not limited to the order specifically described above unless specifically stated otherwise. Further, in some embodiments, the present disclosure may also be embodied as programs recorded in a recording medium, the programs including machine-readable instructions for implementing the methods according to the present disclosure. Thus, the present disclosure also covers a recording medium storing a program for executing the method according to the present disclosure.
It is also noted that in the devices, apparatuses, and methods of the present disclosure, each component or step can be decomposed and/or recombined. These decompositions and/or recombinations are to be considered equivalents of the present disclosure.
The previous description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other aspects without departing from the scope of the disclosure. Thus, the present disclosure is not intended to be limited to the aspects shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
The foregoing description has been presented for purposes of illustration and description. Furthermore, this description is not intended to limit embodiments of the disclosure to the form disclosed herein. While a number of example aspects and embodiments have been discussed above, those of skill in the art will recognize certain variations, modifications, alterations, additions and sub-combinations thereof.
Claims (10)
1. A caching method of a micro service system, wherein the micro service system comprises a first micro service module and a second micro service module, and the method is applied to the first micro service module, and is characterized in that the method comprises the following steps:
responding to the requirement of acquiring target data, and determining whether a target instruction matched with the target data exists in an instruction cache region of the first micro service module;
responding to the target instruction existing in the instruction cache region, and acquiring an access parameter corresponding to the target instruction from the instruction cache region; wherein the access parameter comprises an access address;
and accessing the storage system based on the access parameters, and acquiring the target data from the storage system by using the target instruction.
2. The method of claim 1, further comprising:
responding to the target instruction not existing in the instruction cache region, and sending a first acquisition request for acquiring the target data to the second micro service module; the first acquisition request comprises a first switch parameter, and the first switch parameter is used for identifying that the first micro service module supports instruction caching;
receiving first information returned by the second micro service module aiming at the first acquisition request;
analyzing the first information to obtain the target data, the target instruction and the access parameter, and storing the target instruction and the access parameter in the instruction cache region;
or,
responding to the target instruction not existing in the instruction cache region, and sending a second acquisition request for acquiring the target data to the second micro service module; the second acquisition request comprises a second switch parameter, and the second switch parameter is used for identifying that the first micro service module does not support instruction caching;
receiving second information returned by the second service module aiming at the second acquisition request;
and analyzing the second information to obtain the target data.
3. The method of claim 1, further comprising:
receiving a third acquisition request which is sent by a third micro service module and used for acquiring the target data; the third obtaining request comprises a third switch parameter, and the third switch parameter is used for identifying whether the third micro service module supports instruction caching;
in response to the third micro service module belonging to the micro service system, determining whether the third micro service module supports instruction caching according to the third switch parameter;
in response to the third micro service module not supporting instruction caching, sending the target data to the third micro service module;
and responding to the third micro service module supporting instruction caching, and sending the target instruction and the access parameter to the third micro service module so as to enable the third micro service module to acquire the target data based on the target instruction and the access parameter.
4. The method of claim 3, further comprising:
if the third micro service module does not belong to the micro service system, determining whether the first micro service module is allowed to send instructions to other micro service systems except the micro service system according to pre-configuration information, and determining whether the third micro service module supports instruction caching according to the third switch parameter;
if the first micro service module is allowed to send instructions to other micro service systems except the micro service system and the third micro service module supports instruction caching, sending the target instruction and the access parameter to the third micro service module so that the third micro service module obtains the target data based on the target instruction and the access parameter;
and if the first micro service module is not allowed to send instructions to other micro service systems except the micro service system, sending the target data to the third micro service module.
5. The method of claim 2, wherein the receiving the first information returned by the second microservice module for the first acquisition request comprises:
receiving first information which is returned by the second micro service module aiming at the first acquisition request and is encrypted based on a preset transmission key;
and/or the presence of a gas in the gas,
receiving first information which is returned by the second micro-service module aiming at the first acquisition request and is obtained by packaging the target data, the target instruction and the access parameter based on a preset packaging function acquired from a preset class library; wherein the preset class library is commonly maintained by a plurality of micro-service modules in the micro-service system;
the analyzing the first information to obtain the target data, the target instruction, and the access parameter includes:
decrypting the first information by using the preset transmission key to obtain decrypted first information, and analyzing the decrypted first information to obtain the target data, the target instruction and the access parameter;
and/or the presence of a gas in the gas,
and acquiring a preset analysis function corresponding to the preset encapsulation function from the preset class library, and analyzing the first information by using the preset analysis function to obtain the target data, the target instruction and the access parameter.
6. The method of any of claims 1-5, wherein the access parameters further include an expiration policy;
determining whether the target instruction is in a valid state based on the expiration policy;
and if the target instruction is not in an effective state, releasing the storage space occupied by the target instruction and the access parameter in the instruction cache region.
7. The method of claim 6, wherein the expiration policy comprises any one of: effective access duration and effective use times.
8. The method of claim 1, wherein accessing the storage system based on the access parameter and using the target instruction to retrieve the target data from the storage system comprises:
accessing a proxy layer of the storage system based on the access parameter;
and receiving the target data which is returned by the agent layer and is acquired from the storage system by using the target instruction.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the caching method of the microservice system of any one of the preceding claims 1 to 8.
10. A computer program product comprising computer programs/instructions which, when executed by a processor, implement the caching method of the microservice system of any one of the preceding claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111517976.2A CN114201315A (en) | 2021-12-13 | 2021-12-13 | Caching method and device of micro-service system, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111517976.2A CN114201315A (en) | 2021-12-13 | 2021-12-13 | Caching method and device of micro-service system, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114201315A true CN114201315A (en) | 2022-03-18 |
Family
ID=80652920
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111517976.2A Pending CN114201315A (en) | 2021-12-13 | 2021-12-13 | Caching method and device of micro-service system, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114201315A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115934765A (en) * | 2022-10-11 | 2023-04-07 | 中电金信软件(上海)有限公司 | Data sharing method and device between micro service systems and electronic equipment |
-
2021
- 2021-12-13 CN CN202111517976.2A patent/CN114201315A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115934765A (en) * | 2022-10-11 | 2023-04-07 | 中电金信软件(上海)有限公司 | Data sharing method and device between micro service systems and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11520912B2 (en) | Methods, media, apparatuses and computing devices of user data authorization based on blockchain | |
US11456965B2 (en) | Network service request throttling system | |
CN111274268B (en) | Internet of things data transmission method and device, medium and electronic equipment | |
EP2457152B1 (en) | Method and system of plug-in privilege control | |
CN111478910B (en) | User identity authentication method and device, electronic equipment and storage medium | |
CN113079164B (en) | Remote control method and device for bastion machine resources, storage medium and terminal equipment | |
US20210243024A1 (en) | User Security Token Invalidation | |
WO2015051017A1 (en) | Method and apparatus for managing access to electronic content | |
JP2015505387A (en) | Dynamic service integration system and method | |
JP2024153841A (en) | System and method for maintaining immutable data access logs with privacy - Patents.com | |
CN114598481B (en) | Authorization authentication method and device, electronic equipment and storage medium | |
CN111104652B (en) | Authority management method and device, computer readable storage medium and electronic equipment | |
CN114785590A (en) | Login method, device, equipment and storage medium | |
CN114201315A (en) | Caching method and device of micro-service system, electronic equipment and storage medium | |
CN112560003A (en) | User authority management method and device | |
CN114598520A (en) | Method, device, equipment and storage medium for resource access control | |
CN112528239A (en) | Method and device for automatically authorizing software | |
KR101318234B1 (en) | Data cache method and device for database system | |
CN109150893B (en) | Service request forwarding method and related device | |
CN108347471A (en) | Obtain the method, apparatus and system of third party's user information | |
EP4411562A1 (en) | Data processing method and apparatus, electronic device, computer storage medium and computer program product | |
CN110730073A (en) | Bypass signature verification method and system, server, signature management platform and medium | |
US11824919B2 (en) | System and method for force running of remote support, and client for executing the same | |
US11616828B2 (en) | System and method for remote support, and web application server for executing the same | |
WO2024131083A1 (en) | Data processing method and apparatus, electronic device, computer storage medium and computer program product |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |