Question

I have integrated a cache warmer module. Using cronjob it runs and creates cache for all the pages, and it's working properly.

I have multiple servers (Let's say 2 servers), until now there is no need to schedule cronjobs for all servers, I used to schedule cronjobs only on first server.

Since cache used local storage to save cached data, if I schedule cronjob on one server, then cache warmer wont work on other server.

Now my question is, how can I create cache for both servers while cron is scheduled on first server

Was it helpful?

Solution

In local cache environment it is impossible to create cache for both servers while executing cron on one server.

There is only one option left, make cache centralize.

To do this you need to use either Varnish or Redis. I have read multiple articles and all of them saying that Varnish is better approach. But I have used AWS Elasticache Redis on my server as it is more cheap and I have less knowledge of Varnish right now :D

To implement redis I have executed this command on shell (Putty)

php bin/magento setup:config:set --page-cache=redis --page-cache-redis-server=127.0.0.1 --page-cache-redis-db=1

I have used my server details in above command (Obviously)

And now I have centralized storage of Full Page Cache, and I have scheduled cronjob on one server and it is working fine for both servers.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top