title: How to calculate used memory for php-fpm?
body: <p>Suppose I have a php application that runs with php-fpm. Below are the options for php/php-fpm and opcache. How can I calculate how much memory is used by all of the components?</p>
  
  <pre><code>memory_limit=128M
  ...
  opcache.memory_consumption=128M
  ...
  [www]
  pm = dynamic
  pm.max_children = 2
  pm.start_servers = 1
  pm.min_spare_servers = 1
  pm.max_spare_servers = 2
  </code></pre>
  
  <p>Here is my thinking. php-fpm is starting 1 process with 128 MB and opcache 128MB = 256 MB. If php-fpm creates a new server/process we will have 2 processes with 256 MB and opcache 128 MB = 384 MB. Is that correct?</p>
  
  <p>The background is to calculator the correct memory limits for a Kubernetes deployment.</p>