CN107979629B - Distributed cache system and data cache method and device thereof - Google Patents
Distributed cache system and data cache method and device thereof Download PDFInfo
- Publication number
- CN107979629B CN107979629B CN201610939867.2A CN201610939867A CN107979629B CN 107979629 B CN107979629 B CN 107979629B CN 201610939867 A CN201610939867 A CN 201610939867A CN 107979629 B CN107979629 B CN 107979629B
- Authority
- CN
- China
- Prior art keywords
- server cluster
- cache server
- cache
- identifier
- cluster
- 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.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1097—Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1095—Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/568—Storing data temporarily at an intermediate stage, e.g. caching
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The application discloses a distributed cache system and a data cache method and device thereof. A specific embodiment of the system includes an application server and a cache server cluster that establishes a communication channel with the application server, where the cache server cluster includes at least one of: the first cache server cluster is positioned in a machine room where the application server is positioned, and the second cache server cluster is positioned in at least one other machine room different from the machine room; the application server is used for synchronously sending data to the cache server cluster through the communication channel; and the cache server cluster is used for receiving and caching the data sent by the application server through the communication channel. The implementation mode improves the operation efficiency of the distributed cache system.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a distributed cache system and a data caching method and apparatus thereof.
Background
A distributed cache system generally comprises at least one application server and a plurality of cache server clusters, wherein one of the cache server clusters is set as a master cluster, and the other cache server clusters are set as slave clusters.
However, data of the existing distributed cache system is sent to the master cluster by the application server, and then sent to the slave cluster by the master cluster at predetermined time intervals, so that the distributed cache system has more read-write operations, and the overall operation efficiency of the distributed cache system is reduced, thereby having the problem of low operation efficiency.
Disclosure of Invention
The present application is directed to an improved distributed cache system and a data caching method and apparatus thereof, so as to solve the technical problems mentioned in the above background.
In a first aspect, the present application provides a distributed cache system, including: the system comprises an application server and a cache server cluster which establishes a communication channel with the application server, wherein the cache server cluster comprises at least one of the following items: the first cache server cluster is positioned in a machine room where the application server is positioned, and the second cache server cluster is positioned in at least one other machine room different from the machine room; the application server is used for synchronously sending data to the cache server cluster through the communication channel; and the cache server cluster is used for receiving and caching the data sent by the application server through the communication channel.
In a second aspect, the present application provides a data caching method for a distributed caching system, where the distributed caching system includes an application server and a caching server cluster, where the caching server cluster includes at least one of: the method comprises the following steps that a first cache server cluster is located in a machine room where the application server is located, and at least one second cache server cluster is located in other machine rooms different from the machine room, and the method comprises the following steps: establishing a communication channel with the cache server cluster; and synchronously sending the data to a cache server cluster through the established communication channel so that the cache server cluster receives and caches the data through the communication channel.
In a third aspect, the present application provides a data caching apparatus for a distributed caching system, where the distributed caching system includes an application server and a caching server cluster, where the caching server cluster includes at least one of the following: the device comprises a first cache server cluster positioned in a machine room where the application server is positioned and at least one second cache server cluster positioned in other machine rooms different from the machine room, wherein the device comprises: the establishing unit is used for establishing a communication channel with the cache server cluster; and the sending unit is used for synchronously sending the data to the cache server cluster through the established communication channel so that the cache server cluster can receive and cache the data through the communication channel.
According to the distributed cache system and the data cache method and device thereof, the application server and the cache server cluster with the communication channel established with the application server are arranged, the application server sends data to each cache server cluster, and each cache server cluster receives and caches the data, so that the read-write operation of the distributed cache system is reduced, and the operation efficiency of the distributed cache system is improved.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1a is an architecture diagram of one embodiment of a distributed caching system according to the present application;
FIG. 1b is an architecture diagram of yet another embodiment of a distributed caching system according to the present application;
FIG. 2 is a flow diagram of one embodiment of a data caching method of a distributed caching system according to the present application;
FIG. 3 is a flow diagram of yet another embodiment of a data caching method of a distributed caching system according to the present application;
FIG. 4 is a flow diagram of yet another embodiment of a data caching method of a distributed caching system according to the present application;
FIG. 5 is a block diagram of one embodiment of a data caching apparatus of a distributed caching system according to the present application;
FIG. 6 is a block diagram of a computer system suitable for use in implementing an application server according to embodiments of the present application.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1a shows a system architecture 110 of an embodiment of a distributed caching system according to the present application.
As shown in fig. 1a, the system architecture 110 may include an application server 101, a network 102, and cache server clusters 103, 104, 105. The network 102 serves as a medium for providing communication links between the application server 101 and the cache server clusters 103, 104, 105. Network 102 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
In this embodiment, the cache server cluster may include a first cache server cluster and/or at least one second cache server cluster, where the first cache server cluster is located in a machine room where the application server is located, and the second cache server cluster is located in another machine room different from the machine room where the application server is located.
As an example, the cache server cluster may be a first cache server cluster; the system can also be a first cache server cluster and a plurality of second cache server clusters; the system can also be a plurality of second cache server clusters; the system can also be a first cache server cluster and a plurality of second cache server clusters; or may be a second cluster of cache servers.
In this embodiment, a communication channel is established between the cache server cluster and the application server. The establishment of the communication channel can be initiated by an application server, the application server sends authentication information to a cache server cluster in the distributed cache system, and after the cache server cluster passes the authentication, the application server establishes communication connection with the cache server cluster.
It will be appreciated by those skilled in the art that the application server may also be a cluster of application servers, and the cluster of cache servers may also be a cache server.
Here, the application server may provide support for electronic devices outside the distributed cache system, for example, the application server may receive order data sent by a terminal, and then send the order data to a cache server cluster for caching; the application server can also respond to an order data reading request of the terminal, read order data from the caching server cluster, and then send the read order data to the terminal requesting the order data.
In this embodiment, the application server is configured to send data to the cache server cluster through the communication channel synchronously; the cache server cluster is used for receiving and caching the data sent by the application server through the communication channel.
As will be understood by those skilled in the art, the process of sending data from the application server to the cache server cluster and caching the received data by the cache server cluster may also be referred to as writing data from the application server to the cache server cluster. It can be seen that, here, the respective cache server clusters of the application server no longer distinguish between the master cluster and the slave cluster, and when the application server writes data to the respective cache server clusters, the respective cache server clusters are the same with respect to the application server, i.e. the data cached in the respective cache server clusters are the same.
It should be understood that the number of application servers, networks, and cache server clusters in FIG. 1a is merely illustrative. There may be any number of application servers, networks, and cache server clusters, as desired for implementation.
If a master cluster of the existing distributed cache system is down, data received in a time period from the time when the master cluster sends data to a slave cluster last time to the time when the master cluster is down cannot be sent to the slave cluster, the data cached by the slave cluster is missing relative to the master cluster, and the data missing from the slave cluster relative to the master cluster needs to be read from a database.
In the distributed cache system provided by this embodiment, the application server and the cache server cluster having the communication channel with the application server are set, the application server sends data to each cache server cluster, and each cache server cluster receives and caches the data, so that the read-write operation of the distributed cache system is reduced, and the operating efficiency of the distributed cache system is improved.
FIG. 1b illustrates a system architecture 120 of yet another embodiment of a distributed caching system according to the present application.
As shown in fig. 1b, the system architecture 120 may include an application server 101, a network 102, a cluster of cache servers 103, 104, 105, and a control server 106. The network 102 serves to provide a medium of communication links between the control server 106 and the application server 101, as well as between the application server 101 and the cache server clusters 103, 104, 105. Network 102 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
In this embodiment, the application server 101 is configured to send data to the cache server cluster through the communication channel synchronously; the cache server cluster is used for receiving and caching the data sent by the application server through the communication channel.
Here, the application server may provide support for electronic devices outside the distributed cache system, for example, the application server may receive order data sent by a terminal, and then send the order data to a cache server cluster for caching; the application server can also respond to an order data reading request of the terminal, read order data from the caching server cluster, and then send the read order data to the terminal requesting the order data.
In this embodiment, a communication channel is established between the cache server cluster and the application server. The establishment of the communication channel can be initiated by an application server, the application server sends authentication information to a cache server cluster in the distributed cache system, and after the cache server cluster passes the authentication, the application server establishes communication connection with the cache server cluster.
In this embodiment, the control server is configured to: receiving operation on a preset cache server cluster identifier; loading configuration information of the cache server cluster to which the operation aims; assembling a message, wherein the message comprises an operation identifier of a received operation, a cache server cluster identifier to which the operation is directed, and loaded configuration information; the assembled message is broadcast.
In the present embodiment, the operation includes at least one of: add operation, delete operation. Accordingly, the operation identification of the above operation may be "add operation" or "delete operation".
In this embodiment, the cache server cluster to which the operation is directed refers to the cache server cluster indicated by the cache server cluster identifier to which the operation is directed.
In this embodiment, the configuration information is pre-stored and includes at least one of: the computer room identification of the computer room where the cache server cluster is located, the alternative cluster information and the authentication information establishing a communication channel with the cache server cluster.
Here, the candidate cluster information is used to indicate whether the cache server cluster is a candidate read cache server cluster and/or a candidate write cache server cluster of the application server; the alternative cache server reading cluster is a cache server cluster from which the application server reads data instead when a cache server cluster which reads the data currently by the application server is down; the alternative read cache server cluster is a cache server cluster for writing data into the application server instead when the cache server cluster for writing data into the application server is down.
Here, the authentication information may be information for authentication that needs to be provided to the cache server cluster when the application server requests the cache server cluster to establish the communication channel, and the authentication information may be, for example, a password or a token.
As an example, the control server may receive a deletion operation of a worker on a preset first cache server cluster identifier, load configuration information of the first cache server cluster indicated by the first cache server cluster identifier, assemble the operation identifier of the "deletion operation", the cache server cluster identifier of the "first cache server cluster" and the configuration information of the first cache cluster into a message, and finally broadcast the assembled message. Techniques for how to assemble messages and broadcast messages are known per se to those skilled in the art and will not be described in detail here.
In this embodiment, the application server is further configured to: receiving the message broadcast by the control server; and analyzing the received message to obtain the operation identifier, the cache server cluster identifier and the loaded configuration information in the message.
Here, the application server listens and receives the messages broadcast by the control server. The application server is preset with a monitoring mechanism to receive the broadcast according to the theme, for example, if the application server is a server responsible for supporting the order data, the order data application server may monitor the broadcast of the order data theme. Those skilled in the art can understand that the message is analyzed in the memory, and the information obtained by analyzing the message can be directly used for establishing the communication channel or deleting the communication channel, so that the situation that the application server restarts to establish or delete the communication channel is avoided.
Here, the application server parses the received message to obtain the operation identifier, the cache server cluster identifier, and the configuration information in the message.
In this embodiment, the application server is further configured to: responding to the obtained operation identifier as an adding operation, and determining whether the cache server cluster identifier aimed by the adding operation is in a pre-stored cache server cluster list or not; and in response to that the cache server cluster identifier to which the adding operation is directed is not in a pre-stored cache server cluster list, establishing a communication channel with the cache server cluster to which the adding operation is directed, and adding the configuration information in the message and the cache server cluster identifier to which the adding operation is directed to the cache server cluster list in a corresponding manner.
Here, the cache server cluster list is used to record cache server clusters in the distributed cache system, and it can be understood that a communication channel is established between a cache server cluster in the distributed cache system and an application server in the distributed cache system, and therefore, the cache server cluster list includes a cache server cluster identifier of a cache server cluster establishing a communication channel with the application server and corresponding configuration information.
In some optional implementations of this embodiment, the application server is further configured to: determining whether a read cache server cluster of the application server is the first cache server cluster, wherein the read cache server cluster is a cache server cluster for the application server to read cache data; and switching the read cache server cluster to the first cache server cluster in response to the read cache server cluster of the application server not being the first cache server cluster.
As can be understood by those skilled in the art, if the read cache server cluster of the application server is the second cache server cluster, the cache server cluster to which the adding operation is directed is the first cache server cluster, and the detected read cache server cluster of the application server should be the second cache server cluster, after the first cache server cluster is added to the distributed cache system, the read cache server cluster of the application server is switched to the first cache server cluster, so that the application server can read cache data from the cache server cluster of the local room, and the efficiency of reading cache data is improved.
In this embodiment, the application server is further configured to: and in response to that the obtained operation identifier is a deletion operation, determining whether the cache server cluster identifier in the cache server cluster list only includes the cache server cluster identifier for the deletion operation.
Here, if the cache server cluster identifier in the cache server cluster list only includes the cache server cluster identifier for the delete operation, it indicates that there is only one cache server cluster in the distributed cache system, and in the case of only one cache server cluster, the cache server cluster cannot be deleted, otherwise, the application server reads the cache data nowhere, and a system failure is caused. Therefore, if the cache server cluster identifier in the cache server cluster list only includes the cache server cluster identifier for the delete operation, the delete of the cache server cluster is terminated.
In this embodiment, in response to that the cache server cluster identifier in the cache server cluster list does not include only the cache server cluster identifier to which the delete operation is directed, it is determined whether the source of the currently read cache data is the cache server cluster to which the delete operation is directed.
Here, if the source of the cache data currently read by the application server is the cache server cluster to which the deletion operation is directed, if the application server and the cache server cluster to which the deletion operation is directed are closed at this time, an abnormality may occur in reading the cache data by the application server.
In some optional implementations of this embodiment, the application server is further configured to: in response to that the source of the currently read cache data is the cache server cluster to which the deletion operation is directed, switching the read cache server cluster of the application server to be the first cache server cluster or the alternative read cache server cluster so that the source of the currently read cache data is not the cache server cluster to which the deletion operation is directed; and in response to the switching of the read cache server cluster of the application server to the first cache server cluster or the alternative read cache server cluster, closing a communication channel with the cache server cluster to which the deletion operation is directed, and deleting the cache server cluster identifier to which the deletion operation is directed and the corresponding configuration information from the cache server cluster list.
Here, before the application server and the cache server cluster to which the deletion operation is directed are closed, it is determined whether a source of cache data currently read by the application server is the cache server cluster to which the deletion operation is directed, and if so, the read cache server cluster is switched to be the first cache server cluster or the alternative read cache server cluster, so that the occurrence of an abnormality in reading data by the application server can be avoided.
In this embodiment, the application server is further configured to: and in response to that the source of the currently read cache data is not the cache server cluster to which the deletion operation is directed, closing a communication channel with the cache server cluster to which the deletion operation is directed, and deleting the cache server cluster identifier to which the deletion operation is directed and the corresponding configuration information from the cache server cluster list.
Compared with the distributed cache system corresponding to fig. 1a, the distributed cache system provided in this embodiment highlights an effect of the application server, sends a message broadcast through the set application server, the application server monitors and receives the broadcast message, the application server parses the message and completes an operation of establishing or closing a communication channel with the cache server cluster, the addition or deletion of the cache server cluster can be performed without restarting the application server, and the operation efficiency of the distributed cache system is further improved.
With continued reference to FIG. 2, a flow 200 of one embodiment of a data caching method of a distributed caching system according to the present application is shown.
It should be noted that the data caching method of the distributed caching system provided in the embodiment of the present application is generally executed by the application server 101, and accordingly, the data caching apparatus of the distributed caching system is generally disposed in the application server 101.
The distributed cache system to which the data caching method provided by the embodiment is applied comprises: the distributed cache system comprises an application server and a cache server cluster, wherein the cache server cluster comprises at least one of the following items: the system comprises a first cache server cluster positioned in a machine room where the application server is positioned and at least one second cache server cluster positioned in other machine rooms different from the machine room.
The process 200 of the data caching method of the distributed caching system includes the following steps:
In this embodiment, an electronic device (for example, the application server shown in fig. 1a or fig. 1 b) on which the data caching method of the distributed caching system operates may establish a communication channel with the caching server cluster.
In this embodiment, an electronic device (for example, the application server shown in fig. 1a or fig. 1 b) on which the data caching method of the distributed caching system operates may send data to the caching server cluster synchronously.
The specific implementation manner and technical effect of step 201 and step 202 may refer to the related description in fig. 1a and fig. 1b, and are not described herein again.
With further reference to FIG. 3, a flow 300 of yet another embodiment of a data caching method of a distributed caching system is illustrated.
It should be noted that the data caching method of the distributed caching system provided in the embodiment of the present application is generally executed by the application server 101, and accordingly, the data caching apparatus of the distributed caching system is generally disposed in the application server 101.
The distributed cache system to which the data caching method provided by the embodiment is applied comprises: the system comprises an application server and a cache server cluster, wherein the cache server cluster comprises at least one of the following items: the system comprises a first cache server cluster positioned in a machine room where the application server is positioned and at least one second cache server cluster positioned in other machine rooms different from the machine room.
The distributed data caching system to which the data caching method provided by the embodiment is applied further includes a control server, configured to: receiving an operation on a preset cache server cluster identifier, wherein the operation comprises at least one of the following operations: adding operation and deleting operation; loading configuration information of a cache server cluster to which the operation is directed, wherein the cache server cluster to which the operation is directed refers to a cache server cluster indicated by a cache server cluster identifier to which the operation is directed, and the configuration information is pre-stored and includes at least one of the following: the system comprises a machine room identifier of a machine room where a cache server cluster is located, alternative cluster information and authentication information establishing a communication channel with the cache server cluster, wherein the alternative cluster information is used for indicating whether the cache server cluster is an alternative read cache server cluster and/or an alternative write cache server cluster of the application server; assembling a message, wherein the message comprises an operation identifier of a received operation, a cache server cluster identifier to which the operation is directed, and loaded configuration information; the assembled message is broadcast.
The process 300 of the data caching method of the distributed caching system includes the following steps:
In this embodiment, an electronic device (for example, the application server shown in fig. 1a or fig. 1 b) on which the data caching method of the distributed caching system operates may establish a communication channel with a caching server cluster in the distributed caching system.
In this embodiment, an electronic device (for example, the application server shown in fig. 1a or fig. 1 b) on which the data caching method of the distributed caching system operates may receive a message broadcast by the control server.
In this embodiment, an electronic device (for example, the application server shown in fig. 1a or fig. 1 b) on which the data caching method of the distributed caching system operates may parse the received message to obtain an operation identifier, a caching server cluster identifier, and configuration information in the message.
And step 304, in response to that the obtained operation identifier is an adding operation, determining whether the cache server cluster identifier to which the adding operation is directed is in a pre-stored cache server cluster list.
In this embodiment, an electronic device (for example, the application server shown in fig. 1a or fig. 1 b) on which the data caching method of the distributed caching system operates may determine, in response to the obtained operation identifier being an adding operation, whether a cache server cluster identifier to which the adding operation is directed is in a pre-stored cache server cluster list. Here, the above-mentioned cache server cluster list is used for recording cache server clusters in the distributed cache system.
In some optional implementation manners of this embodiment, if the cache server cluster identifier to which the adding operation is directed is in a pre-stored cache server cluster list, a transition is made to an end step to avoid repeatedly adding the same cache server cluster identifier in the cache server cluster list.
In this embodiment, an electronic device (for example, the application server shown in fig. 1a or fig. 1 b) on which the data caching method of the distributed caching system operates may add, in response to that the cache server cluster identifier targeted by the addition operation is not in a pre-stored cache server cluster list, the configuration information in the message and the cache server cluster identifier targeted by the addition operation to the cache server cluster list correspondingly.
In this embodiment, an electronic device (for example, the application server shown in fig. 1a or fig. 1 b) on which the data caching method of the distributed caching system operates may establish a communication channel with the cache server cluster to which the addition operation is directed in response to that the cache server cluster identifier to which the addition operation is directed is not in a pre-stored cache server cluster list.
In this embodiment, an electronic device (for example, the application server shown in fig. 1a or fig. 1 b) on which the data caching method of the distributed caching system operates may send data to the caching server cluster through an existing communication channel. Here, the existing communication channel refers to the communication channel established in step 301 and the communication channel established in step 306.
In some optional implementations of this embodiment, the method further includes: determining whether a read cache server cluster of the application server is the first cache server cluster, wherein the read cache server cluster is a cache server cluster for the application server to read cache data; and switching the read cache server cluster to the first cache server cluster in response to the read cache server cluster of the application server not being the first cache server cluster.
The specific implementation manner and technical effect of steps 301-307 can refer to the related descriptions in fig. 1a and fig. 1b, and are not described herein again.
With further reference to FIG. 4, a flow 400 of yet another embodiment of a data caching method of a distributed caching system is illustrated.
It should be noted that the data caching method of the distributed caching system provided in the embodiment of the present application is generally executed by the application server 101, and accordingly, the data caching apparatus of the distributed caching system is generally disposed in the application server 101.
The distributed cache system to which the data caching method provided by the embodiment is applied comprises: the system comprises an application server and a cache server cluster, wherein the cache server cluster comprises at least one of the following items: the system comprises a first cache server cluster positioned in a machine room where the application server is positioned and at least one second cache server cluster positioned in other machine rooms different from the machine room.
The distributed data caching system to which the data caching method provided by the embodiment is applied further includes a control server, configured to: receiving an operation on a preset cache server cluster identifier, wherein the operation comprises at least one of the following operations: adding operation and deleting operation; loading configuration information of a cache server cluster to which the operation is directed, wherein the cache server cluster to which the operation is directed refers to a cache server cluster indicated by a cache server cluster identifier to which the operation is directed, and the configuration information is pre-stored and includes at least one of the following: the system comprises a machine room identifier of a machine room where a cache server cluster is located, alternative cluster information and authentication information establishing a communication channel with the cache server cluster, wherein the alternative cluster information is used for indicating whether the cache server cluster is an alternative read cache server cluster and/or an alternative write cache server cluster of the application server; assembling a message, wherein the message comprises an operation identifier of a received operation, a cache server cluster identifier to which the operation is directed, and loaded configuration information; the assembled message is broadcast.
The process 400 of the data caching method of the distributed caching system includes the following steps:
In this embodiment, an electronic device (for example, the application server shown in fig. 1a or fig. 1 b) on which the data caching method of the distributed caching system operates may establish a communication channel with a caching server cluster in the distributed caching system.
In this embodiment, an electronic device (for example, the application server shown in fig. 1a or fig. 1 b) on which the data caching method of the distributed caching system operates may receive a message broadcast by the control server.
In this embodiment, an electronic device (for example, the application server shown in fig. 1a or fig. 1 b) on which the data caching method of the distributed caching system operates may parse the received message to obtain an operation identifier, a caching server cluster identifier, and configuration information in the message.
In this embodiment, an electronic device (for example, the application server shown in fig. 1a or fig. 1 b) on which the data caching method of the distributed caching system operates may determine, in response to that an obtained operation identifier is a delete operation, whether a cache server cluster identifier in the cache server cluster list includes only a cache server cluster identifier to which the delete operation is directed.
In some optional implementation manners of this embodiment, in response to that the cache server cluster identifier in the cache server cluster list only includes the cache server cluster identifier to which the deletion operation is directed, the deletion of the cache server cluster is terminated.
In this embodiment, an electronic device (for example, the application server shown in fig. 1a or fig. 1 b) on which the data caching method of the distributed caching system operates may determine whether a source of currently read cached data is a cache server cluster to which the delete operation is directed, in response to that a cache server cluster identifier in the cache server cluster list does not include only a cache server cluster identifier to which the delete operation is directed.
In some optional implementation manners of this embodiment, in response to that the source of the currently read cache data is the cache server cluster to which the deletion operation is directed, the read cache server cluster of the application server is switched to be the first cache server cluster or the alternative read cache server cluster; and in response to the switching of the read cache server cluster of the application server to the first cache server cluster or the alternative read cache server cluster, closing a communication channel with the cache server cluster to which the deletion operation is directed, and deleting the cache server cluster identifier to which the deletion operation is directed and the corresponding configuration information from the cache server cluster list.
In this embodiment, an electronic device (for example, the application server shown in fig. 1a or fig. 1 b) on which the data caching method of the distributed caching system operates may delete, from the cache server cluster list, the cache server cluster identifier and the corresponding configuration information to which the deletion operation is directed, in response to that a source of the currently read cache data is not the cache server cluster to which the deletion operation is directed.
In this embodiment, an electronic device (for example, the application server shown in fig. 1a or fig. 1 b) on which the data caching method of the distributed caching system operates may close a communication channel with the cache server cluster to which the deletion operation is directed in response to that a source of the currently read cached data is not the cache server cluster to which the deletion operation is directed.
In this embodiment, an electronic device (for example, the application server shown in fig. 1a or fig. 1 b) on which the data caching method of the distributed caching system operates may send data to the caching server cluster through an existing communication channel. Here, the existing communication channel is the communication channel remaining after the deletion of the part of the communication channel established in step 401 in step 407.
The specific implementation manner and technical effect of steps 401 and 408 can refer to the related descriptions in fig. 1a and fig. 1b, and are not described herein again.
With further reference to fig. 5, as an implementation of the method shown in the above-mentioned figures, the present application provides an embodiment of a data caching apparatus of a distributed caching system, where the embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 2, and the apparatus may be specifically applied to various electronic devices.
The data caching device of the distributed caching system is applied to the distributed caching system and comprises an application server and a caching server cluster, wherein the caching server cluster comprises at least one of the following items: the system comprises a first cache server cluster positioned in a machine room where the application server is positioned and at least one second cache server cluster positioned in other machine rooms different from the machine room.
As shown in fig. 5, the data caching apparatus 500 of the distributed caching system of the present embodiment includes: establishing unit 501 and transmitting unit 502. The establishing unit 501 is configured to establish a communication channel with the cache server cluster; a sending unit 502, configured to send data to a cache server cluster through the established communication channel synchronously, so that the cache server cluster receives and caches the data through the communication channel.
In this embodiment, the establishing unit 501 of the data caching apparatus 500 of the distributed caching system may establish a communication channel with the caching server cluster.
In this embodiment, based on the communication channel established by the establishing unit 501, the sending unit 502 may send the data to the cache server cluster synchronously, so that the cache server cluster receives and caches the data through the communication channel.
The data caching device of the distributed caching system is applied to the distributed caching system, and the data caching device further comprises a control server for: receiving an operation on a preset cache server cluster identifier, wherein the operation comprises at least one of the following operations: adding operation and deleting operation; loading configuration information of a cache server cluster to which the operation is directed, wherein the cache server cluster to which the operation is directed refers to a cache server cluster indicated by a cache server cluster identifier to which the operation is directed, and the configuration information is pre-stored and includes at least one of the following: the system comprises a machine room identifier of a machine room where a cache server cluster is located, alternative cluster information and authentication information establishing a communication channel with the cache server cluster, wherein the alternative cluster information is used for indicating whether the cache server cluster is an alternative read cache server cluster and/or an alternative write cache server cluster of the application server; assembling a message, wherein the message comprises an operation identifier of a received operation, a cache server cluster identifier to which the operation is directed, and loaded configuration information; the assembled message is broadcast.
In some optional implementations of this embodiment, the apparatus further includes an analyzing unit 503, configured to: receiving the message broadcast by the control server; and analyzing the received message to obtain the operation identifier, the cache server cluster identifier and the configuration information in the message.
In some optional implementations of this embodiment, the apparatus further includes an adding unit 504, configured to: responding to the obtained operation identifier as an adding operation, and determining whether the cache server cluster identifier aimed by the adding operation is in a pre-stored cache server cluster list, wherein the cache server cluster list comprises the cache server cluster identifier of the cache server cluster establishing a communication channel with the application server and corresponding configuration information; and in response to that the cache server cluster identifier to which the adding operation is directed is not in a pre-stored cache server cluster list, establishing a communication channel with the cache server cluster to which the adding operation is directed, and adding the configuration information in the message and the cache server cluster identifier to which the adding operation is directed to the cache server cluster list in a corresponding manner.
In some optional implementations of the present embodiment, the adding unit 504 is further configured to: determining whether a read cache server cluster of the application server is the first cache server cluster, wherein the read cache server cluster is a cache server cluster for the application server to read cache data; and switching the read cache server cluster to the first cache server cluster in response to the read cache server cluster of the application server not being the first cache server cluster.
In some optional implementations of this embodiment, the apparatus further includes a deleting unit 505, configured to: in response to that the obtained operation identifier is a deletion operation, determining whether the cache server cluster identifier in the cache server cluster list only includes the cache server cluster identifier for the deletion operation; determining whether the source of the currently read cache data is the cache server cluster to which the deletion operation aims or not in response to that the cache server cluster identifier in the cache server cluster list does not only comprise the cache server cluster identifier to which the deletion operation aims; and in response to that the source of the currently read cache data is not the cache server cluster to which the deletion operation is directed, closing a communication channel with the cache server cluster to which the deletion operation is directed, and deleting the cache server cluster identifier to which the deletion operation is directed and the corresponding configuration information from the cache server cluster list.
In some optional implementations of this embodiment, the deleting unit 505 is further configured to: in response to that the source of the currently read cache data is the cache server cluster to which the deletion operation is directed, switching the read cache server cluster of the application server to be the first cache server cluster or the alternative read cache server cluster; and in response to the switching of the read cache server cluster of the application server to the first cache server cluster or the alternative read cache server cluster, closing a communication channel with the cache server cluster to which the deletion operation is directed, and deleting the cache server cluster identifier to which the deletion operation is directed and the corresponding configuration information from the cache server cluster list.
The implementation details and technical effects of each module in this embodiment may refer to the relevant descriptions in other embodiments, and are not described herein again.
Referring now to FIG. 6, shown is a block diagram of a computer system 600 suitable for use in implementing an application server of an embodiment of the present application.
As shown in FIG. 6, computer system 600 includes a Central Processing Unit (CPU)601, which may be based on information stored in a Read Only Memory (ROM)602
The program or a program loaded from the storage section 608 into the Random Access Memory (RAM)603 performs various appropriate actions and processes. In the RAM 603, various programs and data necessary for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611. The computer program performs the above-described functions defined in the method of the present application when executed by a Central Processing Unit (CPU) 601.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present application may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes an establishing unit and a sending unit. The names of these units do not in some cases form a limitation on the unit itself, and for example, the establishing unit may also be described as a "unit that establishes a communication channel with the cache server cluster described above".
As another aspect, the present application also provides a non-volatile computer storage medium, which may be the non-volatile computer storage medium included in the apparatus in the above embodiment; or it may be a non-volatile computer storage medium that exists separately and is not incorporated into the terminal. The non-volatile computer storage medium stores one or more programs that, when executed by a device, cause the device to: establishing a communication channel with the cache server cluster; and synchronously sending the data to a cache server cluster through the established communication channel so that the cache server cluster receives and caches the data through the communication channel.
The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention herein disclosed is not limited to the particular combination of features described above, but also encompasses other arrangements formed by any combination of the above features or their equivalents without departing from the spirit of the invention. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.
Claims (16)
1. A distributed cache system, the system comprising an application server, a control server, and a cache server cluster that establishes a communication channel with the application server, wherein the cache server cluster comprises at least one of: the first cache server cluster is positioned in a machine room where the application server is positioned, and the second cache server cluster is positioned in at least one other machine room different from the machine room;
the application server is used for synchronously sending data to the cache server cluster through the communication channel;
the cache server cluster is used for receiving and caching the data sent by the application server through the communication channel;
the control server is used for receiving the operation of the preset cache server cluster identifier; loading configuration information of a cache server cluster to which the operation is directed, wherein the cache server cluster to which the operation is directed refers to a cache server cluster indicated by a cache server cluster identifier to which the operation is directed, and the configuration information includes at least one of the following: the method comprises the steps that machine room identification of a machine room where a cache server cluster is located, alternative cluster information and authentication information for establishing a communication channel with the cache server cluster, wherein the alternative cluster information is used for indicating whether the cache server cluster is an alternative read cache server cluster and/or an alternative write cache server cluster of the application server; assembling a message, wherein the message comprises an operation identifier of a received operation, a cache server cluster identifier to which the operation aims and loaded configuration information; the assembled message is broadcast.
2. The system of claim 1, wherein the operations comprise at least one of: adding operation and deleting operation; the configuration information is pre-stored.
3. The system of claim 2, wherein the application server is further configured to:
receiving a message broadcast by the control server;
analyzing the received message to obtain the operation identifier, the cache server cluster identifier and the configuration information in the message.
4. The system of claim 3, wherein the application server is further configured to:
responding to the obtained operation identifier as an adding operation, and determining whether the cache server cluster identifier aimed at by the adding operation is in a pre-stored cache server cluster list, wherein the cache server cluster list comprises the cache server cluster identifier of the cache server cluster establishing a communication channel with the application server and corresponding configuration information;
and in response to that the cache server cluster identifier to which the adding operation aims is not in a pre-stored cache server cluster list, establishing a communication channel with the cache server cluster to which the adding operation aims, and adding the configuration information in the message and the cache server cluster identifier to which the adding operation aims to the cache server cluster list correspondingly.
5. The system of claim 4, wherein the application server is further configured to:
determining whether a read cache server cluster of the application server is the first cache server cluster, wherein the read cache server cluster is a cache server cluster from which the application server reads cached data;
in response to the read cache server cluster of the application server not being the first cache server cluster, switching the read cache server cluster to the first cache server cluster.
6. The system according to any of claims 1-5, wherein the application server is further configured to:
in response to that the obtained operation identifier is a deletion operation, determining whether the cache server cluster identifier in the cache server cluster list only includes the cache server cluster identifier to which the deletion operation is directed;
in response to that the cache server cluster identifier in the cache server cluster list does not only include the cache server cluster identifier to which the delete operation is directed, determining whether the source of the currently read cache data is the cache server cluster to which the delete operation is directed;
in response to that the source of the currently read cache data is not the cache server cluster to which the delete operation is directed, closing a communication channel with the cache server cluster to which the delete operation is directed, and deleting the cache server cluster identifier to which the delete operation is directed and the corresponding configuration information from the cache server cluster list.
7. The system of claim 6, wherein the application server is further configured to:
in response to that the source of the currently read cache data is the cache server cluster to which the deletion operation is directed, switching the read cache server cluster of the application server to be the first cache server cluster or the alternative read cache server cluster;
and in response to the switching of the read cache server cluster of the application server to the first cache server cluster or the alternative read cache server cluster, closing a communication channel with the cache server cluster to which the deletion operation is directed, and deleting the cache server cluster identifier to which the deletion operation is directed and the corresponding configuration information from the cache server cluster list.
8. A data caching method of a distributed caching system is characterized in that the distributed caching system comprises an application server, a control server and a caching server cluster, wherein the caching server cluster comprises at least one of the following items: the control server is configured to receive an operation on a preset cache server cluster identifier, load configuration information of the cache server cluster targeted by the operation, assemble a message, and broadcast the assembled message, wherein the cache server cluster targeted by the operation is a cache server cluster indicated by the cache server cluster identifier targeted by the operation, and the configuration information includes at least one of the following: the message comprises an operation identifier of a received operation, a cache server cluster identifier for the operation and loaded configuration information; the method comprises the following steps:
establishing a communication channel with the cache server cluster;
and synchronously sending the data to a cache server cluster through the established communication channel so that the cache server cluster receives and caches the data through the communication channel.
9. The method of claim 8, wherein the operation comprises at least one of: adding operation and deleting operation; the configuration information is pre-stored;
the method further comprises the following steps:
receiving a message broadcast by the control server;
analyzing the received message to obtain the operation identifier, the cache server cluster identifier and the configuration information in the message.
10. The method of claim 9, further comprising:
responding to the obtained operation identifier as an adding operation, and determining whether the cache server cluster identifier aimed at by the adding operation is in a pre-stored cache server cluster list, wherein the cache server cluster list comprises the cache server cluster identifier of the cache server cluster establishing a communication channel with the application server and corresponding configuration information;
and in response to that the cache server cluster identifier to which the adding operation aims is not in a pre-stored cache server cluster list, establishing a communication channel with the cache server cluster to which the adding operation aims, and adding the configuration information in the message and the cache server cluster identifier to which the adding operation aims to the cache server cluster list correspondingly.
11. The method of claim 10, further comprising:
determining whether a read cache server cluster of the application server is the first cache server cluster, wherein the read cache server cluster is a cache server cluster for the application server to read cache data;
in response to the read cache server cluster of the application server not being the first cache server cluster, switching the read cache server cluster to the first cache server cluster.
12. The method according to any one of claims 8-11, further comprising:
in response to that the obtained operation identifier is a deletion operation, determining whether the cache server cluster identifier in the cache server cluster list only includes the cache server cluster identifier to which the deletion operation is directed;
in response to that the cache server cluster identifier in the cache server cluster list does not only include the cache server cluster identifier to which the delete operation is directed, determining whether the source of the currently read cache data is the cache server cluster to which the delete operation is directed;
in response to that the source of the currently read cache data is not the cache server cluster to which the delete operation is directed, closing a communication channel with the cache server cluster to which the delete operation is directed, and deleting the cache server cluster identifier to which the delete operation is directed and the corresponding configuration information from the cache server cluster list.
13. The method of claim 12, further comprising:
in response to that the source of the currently read cache data is the cache server cluster to which the deletion operation is directed, switching the read cache server cluster of the application server to be the first cache server cluster or the alternative read cache server cluster;
and in response to the switching of the read cache server cluster of the application server to the first cache server cluster or the alternative read cache server cluster, closing a communication channel with the cache server cluster to which the deletion operation is directed, and deleting the cache server cluster identifier to which the deletion operation is directed and the corresponding configuration information from the cache server cluster list.
14. The data caching device of the distributed caching system is characterized in that the distributed caching system comprises an application server, a control server and a caching server cluster, wherein the caching server cluster comprises at least one of the following items: the control server is configured to receive an operation on a preset cache server cluster identifier, load configuration information of the cache server cluster targeted by the operation, assemble a message, and broadcast the assembled message, wherein the cache server cluster targeted by the operation is a cache server cluster indicated by the cache server cluster identifier targeted by the operation, and the configuration information includes at least one of the following: the message comprises an operation identifier of a received operation, a cache server cluster identifier for the operation and loaded configuration information; the device comprises:
the establishing unit is used for establishing a communication channel with the cache server cluster;
and the sending unit is used for synchronously sending the data to the cache server cluster through the established communication channel so that the cache server cluster can receive and cache the data through the communication channel.
15. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any of claims 8-13.
16. A computer-readable storage medium, on which a computer program is stored, wherein the program, when executed by a processor, implements the method of any one of claims 8-13.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610939867.2A CN107979629B (en) | 2016-10-25 | 2016-10-25 | Distributed cache system and data cache method and device thereof |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610939867.2A CN107979629B (en) | 2016-10-25 | 2016-10-25 | Distributed cache system and data cache method and device thereof |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107979629A CN107979629A (en) | 2018-05-01 |
CN107979629B true CN107979629B (en) | 2021-05-25 |
Family
ID=62004116
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610939867.2A Active CN107979629B (en) | 2016-10-25 | 2016-10-25 | Distributed cache system and data cache method and device thereof |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107979629B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108696581B (en) * | 2018-05-07 | 2021-08-13 | 上海智臻智能网络科技股份有限公司 | Distributed information caching method and device, computer equipment and storage medium |
CN108920504A (en) * | 2018-05-28 | 2018-11-30 | 北京达佳互联信息技术有限公司 | A kind of data cached synchronous method and device |
CN109710427A (en) * | 2018-12-26 | 2019-05-03 | 苏州沁游网络科技有限公司 | A kind of information processing method, system and server |
CN112130747A (en) * | 2019-06-24 | 2020-12-25 | 北京金山云网络技术有限公司 | Distributed object storage system and data read-write method |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8204930B1 (en) * | 2002-02-15 | 2012-06-19 | F5 Networks, Inc. | Method and system for controlling and accessing content servers |
CN102681889A (en) * | 2012-04-27 | 2012-09-19 | 电子科技大学 | Scheduling method of cloud computing open platform |
CN104202375A (en) * | 2014-08-22 | 2014-12-10 | 广州华多网络科技有限公司 | Method and system for synchronous data |
CN105099935A (en) * | 2015-07-28 | 2015-11-25 | 小米科技有限责任公司 | Server load control method and device |
CN106031130A (en) * | 2014-02-19 | 2016-10-12 | 第三雷沃通讯有限责任公司 | Content delivery network architecture with edge proxy |
-
2016
- 2016-10-25 CN CN201610939867.2A patent/CN107979629B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8204930B1 (en) * | 2002-02-15 | 2012-06-19 | F5 Networks, Inc. | Method and system for controlling and accessing content servers |
CN102681889A (en) * | 2012-04-27 | 2012-09-19 | 电子科技大学 | Scheduling method of cloud computing open platform |
CN106031130A (en) * | 2014-02-19 | 2016-10-12 | 第三雷沃通讯有限责任公司 | Content delivery network architecture with edge proxy |
CN104202375A (en) * | 2014-08-22 | 2014-12-10 | 广州华多网络科技有限公司 | Method and system for synchronous data |
CN105099935A (en) * | 2015-07-28 | 2015-11-25 | 小米科技有限责任公司 | Server load control method and device |
Non-Patent Citations (1)
Title |
---|
一种高性价比的网络容灾与高可用集群的设计;妙全兴;《微机发展》;20030930;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN107979629A (en) | 2018-05-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107943594B (en) | Data acquisition method and device | |
CN107979629B (en) | Distributed cache system and data cache method and device thereof | |
CN108282529B (en) | System, method and device for publishing and subscribing data | |
US10261772B2 (en) | Method and device for generating image file | |
US20180048715A1 (en) | Information transmitting method and apparatus in robot operating system | |
US20190258534A1 (en) | Message oriented middleware with integrated rules engine | |
CN108011949B (en) | Method and apparatus for acquiring data | |
CN110647460B (en) | Test resource management method and device and test client | |
CN112769876B (en) | Method, device, equipment and medium for acquiring equipment channel information | |
CN110727523B (en) | Service request processing method, service request processing device and readable storage medium | |
CN110457632B (en) | Webpage loading processing method and device | |
CN109299124B (en) | Method and apparatus for updating a model | |
CN110096305A (en) | Gray scale dissemination method, device, equipment and storage medium | |
KR101845195B1 (en) | Multiple Resource Subscriptions Association Method in an M2M system | |
CN113220342A (en) | Centralized configuration method and device, electronic equipment and storage medium | |
CN109445966B (en) | Event processing method, device, medium and computing equipment | |
JP2021086604A (en) | Method and apparatus for processing service of abnormal server | |
CN105554134A (en) | Information synchronization and device | |
CN114465919B (en) | Network service testing method, system, electronic equipment and storage medium | |
CN111290873B (en) | Fault processing method and device | |
JP6592616B2 (en) | Relay device | |
CN113742617A (en) | Cache updating method and device | |
CN110011767B (en) | Method and apparatus for TCP connection backup | |
CN113132447A (en) | Reverse proxy method and system | |
CN110908886A (en) | Data sending method and device, electronic equipment and storage medium |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |