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
Wrongly sharing the cache between different sites #6572
Comments
There are three common ways of partitioning data for his kind of scenario:
Redis (not including "cluster") supports the notion of multiple numbered databases that are independent key-spaces. Somewhere in your code or config you'd associate a database number per site, and away you go.
Since redis keys are essentially strings, it is usually possible to simply prefix each key with some token, perhaps a numeric I'd of the site, or perhaps the base host address, so instead of "/foo/bar" you use a key of "whatever.com/foo/bar". Since "cluster" doesn't support database numbers, key prefix may be preferable if you are now, or in the future, considering using "cluster".
Redis instances are relatively cheap to spin up, so in some scenarios it makes sense to just have a separate redis process per site. This takes more configuration, but provides the highest isolation. The first two may or may not be trivially configurable in whatever client library or middleware you're using for the caching. But that's really a question for whatever client library or middleware you're using! |
Hi Antirez :-)
Thank you so much :-)
We have about 70 WP sites on our dedicated server at FastComet.
Wouldn’t it be best solution for us to use the approach with a key prefix per site? I can prefix the key in WP_CACHE_KEY_SALT per cPanel / WP site. And having no sites use a non-prefixed cache setup (so no sharing can happen).
It also means that a hacker can “hack” into the Redis cache of another site but only if the person knows the WP_CACHE_KEY_SALT-value which is not realistic.
Using a redis node (TCP port) per site also means that our firewall has to accept about 70 new ports (if all sites are going to use Redis).
But the approach with different database numbers per site also sounds good but I am not an expert in working with the shell.
Bedste hilsner / Kind Regards
Hurtig support – skriv til support@webkonsulenter.dk <mailto:support@webkonsulenter.dk>
Driftstatus og nyheder – se vores Facebook-side: facebook.dk/webkonsulenter.dk <https://www.facebook.com/Webkonsulenter.dk>
Handelsbetingelser ved projekter: www.webkonsulenter.dk/handelsbetingelser <http://www.webkonsulenter.dk/handelsbetingelser>
Fra: Marc Gravell <notifications@github.com>
Sendt: 13. november 2019 08:46
Til: antirez/redis <redis@noreply.github.com>
Cc: JensKirk <jens@webkonsulenter.dk>; Author <author@noreply.github.com>
Emne: Re: [antirez/redis] Wrongly sharing the cache between different sites (#6572)
There are three common ways of partitioning data for his kind of scenario:
1. use different database numbers per site
Redis (not including "cluster") supports the notion of multiple numbered databases that are independent key-spaces. Somewhere in your code or config you'd associate a database number per site, and away you go.
2. use a key prefix per site
Since redis keys are essentially strings, it is usually possible to simply prefix each key with some token, perhaps a numeric I'd of the site, or perhaps the base host address, so instead of "/foo/bar" you use a key of "whatever.com/foo/bar".
3. use a redis node (TCP port) per site
Redis instances are relatively cheap to spin up, so in some scenarios it makes sense to just have a separate redis process per site. This takes more configuration, but provides the highest isolation.
The first two may or may not be clttibially configurable in whatever client library or middleware you're using for the caching. But that's really a question for whatever client library or middleware you're using!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#6572> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/ADG76NS4XHL3STJI4PQZSNDQTOWDXANCNFSM4JMTEMRA> . <https://github.com/notifications/beacon/ADG76NQ3UIBLZHBR6ZUTEDTQTOWDXA5CNFSM4JMTEMRKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOED5GC6Y.gif>
|
Reading on |
Hi :-)
We are a client at FastComet with a dedicated server. FastComet Support is helping us installing your Redis Cache server but it is wrongly sharing the cache between the different sites that have enabled Redis cache. This is making all kinds of random errors.
We are using this WP plugin: https://da.wordpress.org/plugins/redis-cache/
We have disabled it for now and have flushed the cache via the terminal (WHM) so the sites are working again.
Can you tell us how to set up the Redis at the server level so it does not share cache between different sites?
The text was updated successfully, but these errors were encountered: