Quantcast
Channel: Nginx Forum - Other discussion
Viewing all articles
Browse latest Browse all 972

Is it safe to use “open_file_cache” in this scenario?

$
0
0
I'm currently in the progress of switching from Apache to nginx.

nginx – without any optimizations done – is much faster than Apache.
But I want to get the maximum performance.

I read about "open_file_cache" and I'm considering to use it in my configuration for a site – let's name it MY-SITE.

MY-SITE mainly serves static files, but also some PHP stuff.
MY-SITE has an api, which serves content via GET and POST requests.
(static content for GET requests, dynamic content for POST requests)
One of the statically served files returns a JSON formatted list of something.
This file gets around 15 reqs/s.

Current nginx config for MY-SITE:
` ..
location = /api/v1/something {
rewrite ^(.*)$ /la/la/la/something.json;
}
..`

I've read that when using "open_file_cache", one should NOT modify the file content / replace the file.
Why?

The API file I talked about (/la/la/la/something.json) may change regularly.
It might get completely replaced (deleted, then re-created -> inode will change) or only updated (inode will not change)
So is it safe to add the following configuration to my nginx config?
`
open_file_cache max=2000 inactive=20s;
open_file_cache_valid 10s;
open_file_cache_min_uses 5;
open_file_cache_errors off;
`

Does it possibly break anything?
Why is "open_file_cache" not enabled by default, if it greatly increases speed?

Viewing all articles
Browse latest Browse all 972

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>