System and method for implementing cache consistent regional clusters
First Claim
1. An apparatus located in a first region of a system, the apparatus comprising:
- a memory configured to store database updates performed on a first database cluster in the first region, wherein each database update corresponds to a key, and a first invalidation associated with the key is appended to the update; and
a processor configured to;
in a event that a replica database in a second region remote from the first region has failed and cannot respond to database updates, publish a first subset of the first invalidations to a subscriber in the second region, wherein the first subset of the first invalidations are associated with keys having values stored in the replica database,wherein the subscriber is configured to send the first subset of the first invalidations to caches in the second region to cause values stored in the caches for the keys to be deleted;
wherein, in an event that at least one cache of the caches does not have a value for a requested key stored in the at least one cache, the at least one cache is configured to generate to a token associated with the requested key and to send the token to a web server requesting the value, wherein the value for the requested key is set in the at least one cache upon receiving, at the at least one cache, the token from the web server;
wherein after the web server retrieves the value for the requested key from the read-only data cluster and sends the value and the token to the at least one cache for setting the value in the cache, the cache is configured to discard the value if the token has been extinguished, wherein the token is extinguished when a new value for the requested key has been set in the cache by another web server after the token has been generated and before the token is sent back to the cache by the web server.
2 Assignments
0 Petitions
Accused Products
Abstract
When multiple regional data clusters are used to store data in a system, maintaining cache consistency across different regions is important for providing a desirable user experience. In one embodiment, there is a master data cluster where all data writes are performed, and the writes are replicated to each of the slave data clusters in the other regions. Appended to the replication statements are invalidations for cache values for the keys whose values have been changed in the master data cluster. An apparatus in the master data cluster logs replication statements sent to the slave databases. When a slave database fails, the apparatus extracts the invalidations intended for the failed database and publishes the invalidations to a subscriber in the region of the failed database. The subscriber sends the invalidations to the local caches to cause stale data for those keys to be deleted from the caches.
-
Citations
17 Claims
-
1. An apparatus located in a first region of a system, the apparatus comprising:
-
a memory configured to store database updates performed on a first database cluster in the first region, wherein each database update corresponds to a key, and a first invalidation associated with the key is appended to the update; and a processor configured to; in a event that a replica database in a second region remote from the first region has failed and cannot respond to database updates, publish a first subset of the first invalidations to a subscriber in the second region, wherein the first subset of the first invalidations are associated with keys having values stored in the replica database, wherein the subscriber is configured to send the first subset of the first invalidations to caches in the second region to cause values stored in the caches for the keys to be deleted; wherein, in an event that at least one cache of the caches does not have a value for a requested key stored in the at least one cache, the at least one cache is configured to generate to a token associated with the requested key and to send the token to a web server requesting the value, wherein the value for the requested key is set in the at least one cache upon receiving, at the at least one cache, the token from the web server; wherein after the web server retrieves the value for the requested key from the read-only data cluster and sends the value and the token to the at least one cache for setting the value in the cache, the cache is configured to discard the value if the token has been extinguished, wherein the token is extinguished when a new value for the requested key has been set in the cache by another web server after the token has been generated and before the token is sent back to the cache by the web server. - View Dependent Claims (2, 3, 4, 5, 6)
-
-
7. A system comprising:
-
a processor; a master data cluster in a first region of the system;
the master data cluster coupled to the processor;a read-only data cluster in a second region remote from the first region, the read-only data cluster coupled to the processor, wherein the read-only data cluster is a replica of the master data cluster and comprises one or more slave databases and, further wherein the one or more slave database resides in the read-only data cluster includes a database that has failed; an apparatus in the master data cluster configured to log database updates performed on the master data cluster, wherein each database update for a key has an invalidation associated with the key appended to the update, and further wherein the apparatus is configured to select invalidations from a portion of the log sent to the failed database for sending to a subscriber in the second region; and at least one cache in the second region; wherein the subscriber in the second region is configured to send invalidations received from the apparatus to the at least one cache to cause the stored values for the keys specified in the invalidations to be deleted from the at least one cache; wherein, in an event that the at least one cache does not have a value for a requested key stored in the at least one cache the at least one cache is configured to generate a token associated with the requested key and to send the token to a web server requesting the value, wherein the value for the requested key is set in the at least one cache upon receiving, at the at least one cache, the token from the web server; wherein after the web server retrieves the value for the requested key from the read-only data cluster and sends the value and the token to the at least one cache for setting the value in the cache, the cache is configured to discard the value if the token has been extinguished, wherein the token is extinguished when a new value for the requested key has been set in the cache by another web server after the token has been generated and before the token is sent back to the cache by the webs server. - View Dependent Claims (8, 9, 10, 11)
-
-
12. A computer-implemented method comprising:
-
publishing from a module in a first region of a system selected invalidations to a subscriber in a second region of the system, wherein the selected invalidations are associated with keys having selected values stored that are stored in a slave database in the second region, and further wherein the slave database has failed and cannot process the selected invalidations; sending by the subscriber in the second region of the system, the selected invalidations to caches in the second region to cause to be deleted values stored in the caches for the keys; receiving, at one of the caches, a request from a web server for a value for a specified key; upon determining that the value is not stored in the one of the caches, generating, by a token generation module of the one of the caches, a token associated with the specified key; sending the token to the web server; and setting the value for the specified key upon receiving the token and the value from the web server if the token has not been extinguished; otherwise, discarding the value for the specified key; wherein the token is extinguished when a new value for the specified key has been set in the one of the caches by another web server after the token has been generated and before the token is received by the web server. - View Dependent Claims (13, 14, 15, 16, 17)
-
Specification