-
Notifications
You must be signed in to change notification settings - Fork 873
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sync cache between multiple instances #130
Comments
It seems to me that you are looking for a distributed cache. Go cache is a local cache, they are different use cases. To solve your problem I recommend you see memcached or redis. |
Something to think about..
Now you can make an api request: PUT https://yourappproxy/cache/tokensX/newkey with payload newvalue Should your app contain code that would trigger forwarding a certain cache operation to your other instances directly you can use the X-Mirrored-By header to check if that operation was an original request (X-Mirrored-By = origin) or mirrored request (X-Mirrored-By = relayed) Caveats
|
Some numbers benching this:
Requests that do use cached data
Requests that trigger cache update on all instances
Requests that trigger cache update on all instances where one instance (mirror) is offline
One offline/slow mirror causes a significant delay in returning the request that was made to the cache path. / edit For tests database vs cache
Fetching the data from cache
Fetching the data from cache while manipulating cache on all instances
The requests for manipulating the cache in this test were send to https://yourappproxy/cache/tokenX/ involving dns and ssl.
|
Hey
I have an application that runs with multiple instances in a cloud environment. Cause It stores very little amounts of data and It doesn't need to be persistent, I do not find it necessary to run a separate database for it. I wanted to use go cache as a built-in datastore for my application but It doesn't support synchronization between multiple instances.
The text was updated successfully, but these errors were encountered: