Welcome! Log In Create A New Profile

Advanced

How to retrieve information about cache expiration?

Giovani Rinaldi
May 20, 2016 08:44AM
Hello,

I'm trying to retrieve information regarding the number of times a cache
file is expired (either forced, due to cache pressure, or not, such as time
expiration). I've noticed that the cache manager process logs this info
when configured with debug level for the error.log directive. An example is
the following line:

[debug] 5461#5461: http file cache expire:
"/data/nginx/cache/c/1b/cc1651d5d24be40ce402c4e583cd01bc"

I see, currently, two possible ways of achieving such goal. One is parsing
the log file (using a cyclic memory buffer configured to a tmpfs/ramfs, as
described in http://nginx.org/en/docs/debugging_log.html#memory) with an
external executable, in order to not increase IO ops or delay the cache
processing under high load.

Another option would be to develop a module that would be called by the
cache manager process every time its event loop executes, so it could
access to the memory log, parse it and count the amount of times an
expiration occurred. Although it is my understanding that current module
hooks only allow access to memory (including the log struct) allocated by
the worker process, I wonder if there is any other way to hook external
code into the cache manager process (maybe by overloading some global
static struct that contains any function declaration pertaining to the log
or cache managing module?).

Is there any better way of achieving this goal? If not, are any of these
two approaches doable/recommended? Any advice would be most welcome.

The NGINX version I'm currently using is the 1.8.1, and altering its code
(such as patching any original source code) is something I would like to
avoid at all costs.

Thanks in advance.
Giovani.
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

How to retrieve information about cache expiration?

Giovani Rinaldi 468 May 20, 2016 08:44AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 167
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