• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question Nginx cache timeout effect on CPU load

Quinten

Regular Pleskian
Server operating system version
Ubuntu 22.04.1 LTS
Plesk version and microupdate number
Plesk Obsidian Version 18.0.49 Update #1
Hello,

I have come to ask a question in reference to this post Issue - Nginx cache - not creating any cache
Here it sais 30 days is alot but i wonder if i put it on 1 minute instead would it then not reload these mbs of cache every minute and does that not create alot of load on the server?

I have about 50 websites running on a 4 core and 8gb server
At this moment all my websites have 64mb cache enabled on a timer of 30 days
Also the nginx cache is stored on the disk and not in ram am i correct?

Help would be appriciated

Kind Regards,
Quinten
 
would it then not reload these mbs of cache every minute and does that not create alot of load on the server?
It will only add a resource to cache when that resource is requested. If the same resource is requested say every two minutes, but your cache lifetime is 1 minute, then yes, it will probably have the resource cached every other minute. Nginx then also needs to evaluate whether the resource has changed on disk since it last expired. This applies to static resources only. Static resources are rarely updated, so probably you can risk a day or several for them to stay in Nginx cache.

Also the nginx cache is stored on the disk and not in ram am i correct?
Yes and no. It is stored on disk, yes. But when it is used metadata is stored in RAM and actual response may also be stored in RAM for a while.
There is a lot more to know about Nginx, but when you use Plesk you will normally not need to worry about any of it.
[removed a link previously at this place, because it lead to Nginx Plus, not the open version of Nginx]
 
Thank you for the info!
Is it correct that the standard nginx caching on plesk does not even work until you have all the cookies individually defined?
 
I have come to ask a question in reference to this post Issue - Nginx cache - not creating any cache
Here it sais 30 days is alot but i wonder if i put it on 1 minute instead would it then not reload these mbs of cache every minute and does that not create alot of load on the server?

I hope I didn't scare you with my post in that topic. A 30 day cache timeout is not a wrong value to use. If it's suits your purpose than that's fine off course. However (much) shorter values are commonly used. Here why:

Nginx caching is generally used to save on resources. Because (as you probably already know) instead of fully executing/rendering a page on each request a static page gets served from cache. That becomes especially useful if you run high traffic websites where you get visitors about every minute or less. It reduces the load significantly. In that case a short cache timeout is typically used. Because with that many visitors you don't have to worry about the cache going stale (expiring) before the next visitor visites your site.

It's also a matter of content. If you're website uses dynamic or personalized content than you typically want that don't want that to be cached to long (or perhaps not even cached at all). Because the cache is always static. Now, thats not to say you can't benefit from Nginx caching if you have lower traffic sites. If you are fine with holding caches for a long time than that's fine.

Is it correct that the standard nginx caching on plesk does not even work until you have all the cookies individually defined?
Sadly, yes.
 
Back
Top