3

I'm investingating nginx's cache mechanism. I set the following in my nginx.conf.

fastcgi_cache_path /run/nginx-cache levels=1:2 keys_zone=PHP_CACHE:4m inactive=5m max_size=1m;

By keys_zone=PHP_CACHE:4m, nginx should allocate 4 MiB of shared memory. To check this, I used ipcs command, but it didn't show anything. Does this mean nginx doesn't really utilize Linux's shared memory mechanism? Or are there other ways to monitor a process's shared memory usage?

aosho235
  • 63
  • 4

1 Answers1

0

Nginx workers use so-called shared mappings (see mmap(2)). This mechanism differs from SYSV and POSIX shared memory, therefore ipcs doesn't provide information you're looking for. You can monitor (somewhat) shared memory usage with top (SHR) or look into /proc/[your_nginx_worker's_pid]/status file (RssShmem).

ameiji
  • 41
  • 3