my site is currently limited to my IP by htaccess, so I’m the only visitor. When I did not visit page for few hours (like maybe 8 hours I guess), first load take 8 seconds. next loads are fast ~1 seconds. when I go to clodflare dashboard and I click on Purge cache, it has same effect - 8 seconds first time.
My web is Prestashop eshop.
Can I avoid that 8 seconds somehow? of course I can set somewhere hourly cron job to visit my page, but is there some more elegant way?
What is default expiration time of Cloudflare’s cache? Can I extend it?
On Caching > Browser Cache Expiration, you can set it between 30 min and a year. Also, on Page Rules you can create a page rule with same setting and with an Edge Cache Expiration.
Fantastic answer Flori! thank you. Btw is possible lower somehow that 8 seconds loading when cache expire, like for example set level of Cloudflare caching (full, light etc) ?
Long load times for the first load are usually an issue with the server or the page itself. To reduce that number either beef up the server (if the pages are dynamic) or reduce the number of requests/size of the requests.
I can check that somewhere, but until now when accessing server directly (changed host file) it has not long loading times, even after hours and always with disabled browser cache in F12 developer menu.
is there function in Cloudflare to refresh page by itself, like even when there is no visitor?
looks like only javascript is taking long time when caching in Cloudflare, gifs and other files are fast (there is a lot of js in Prestashop), I will try turn off minimizing on Cloudflare…
That waterfall is useless so compressed. Also all files seem to wait for the first byte a lot. You sure the server is fine? How much caching does Cloudflare do?
I can’t exactly right now, but give me the URL and allow for loading outside your IP so I can check things.
Are you using Heroku to host your app? I’ve had this problem before and it turned out Heroku was putting my “server” to sleep if it didn’t have any activity for 30minutes (only on their free plan). So page loads were taking 5-10 seconds to load if I hadn’t accessed the site in some time. The time delay was because Heroku was spinning up my server again.
Im using different VPS with the same first letter, and I mean it’s 3 USD/month but it is 2GB RAM and SSD speed ~1 GByte/s, ~300 Mbps line, so I don’t think the server is the issue. I will try switch Apache MPM from prefork to event, if that can help…
Ok interesting things here, changing apache’s MPM worker from prefork to event did sovled this issue. This is interesting because before I tried multiple times direct connection to the server (via changing host file) and even after restart of the server, there was no delay with prefork worker. Is Cloudflare connecting by different way than a browser, like it will made more tcp connections at a time?