Welcome! Log In Create A New Profile

Advanced

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

Posted by jonathanmueller 
Is it safe to use “open_file_cache” in this scenario?
February 09, 2015 12:29PM
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?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 242
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready