Skip to content
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

Plugin Optimization... #38

Open
erikdemarco opened this issue Aug 6, 2021 · 2 comments
Open

Plugin Optimization... #38

erikdemarco opened this issue Aug 6, 2021 · 2 comments

Comments

@erikdemarco
Copy link
Contributor

erikdemarco commented Aug 6, 2021

Currently our plugin doing the cache clearing ourself (on shutdown). And when we want to get cache we get multiple keys (real value and locked value).

All of this makes redis not useful. For what we do all of this if redis already do that? Redis have LFU which is much more smart when deleting expired cache. We just need to pass ttl when setting the cache. And redis will take care of the rest.

For locking the key it still make sense. But we can optimize it by implementing redis way using either Redlock / SETNX / WATCH.
For deleting expired cache let redis do it.

When we compare our plugin with other similar page cache plugin (using redis) like WP Redis Cache. We left behind so much:
=> https://github.com/BenjaminAdams/wp-redis-cache

Then when comparing with disk cache, we even get similar result (redis is reading from ram, logically it should be much much much faster then reading from disk)

Now the benchmark: (100visits/sec for 10 minutes)
W3 Total Cache (disk basic cache): avg 365ms
Pressijitsu redis cache (localhost): avg 368 ms
WP redis cache (localhost): avg 41ms

@soulseekah
Copy link
Contributor

Can you share your Redis configuration? This plugin requires an LRU cache to be used.

@erikdemarco
Copy link
Contributor Author

All default. Except memory-policy set to lfu (which more recommended by redis than lru). and max-memory set to 1gb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants