8

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

asked Mar 22, 2019 at 6:27
4
  • how often do you run the cache warmer? I am not sure what the default expiry time for cached varnished pages is and how often to warm the cache. Commented Feb 10, 2020 at 17:37
  • every 24 hours is best time for cache, in addition I have created a command to warm cache. So when I flush cache I can also warm it with command line Commented Feb 11, 2020 at 4:34
  • so default ttl for varnish pages is 24 hours? Commented Feb 11, 2020 at 15:43
  • Sorry, don't know exactly Commented Feb 11, 2020 at 16:34

1 Answer 1

6

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.

answered Jun 10, 2019 at 5:40
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.