0

On one of our servers, we get some PHP processes killed very often. I added some logs in the PHP scripts to try understand where all this memory goes, but the numbers I find on PHP side do not relate to the logs from oom-killer.

PHP side reports :

memory_get_usage(true)/1000/1000 = 74 MB

In oom-killer log for the same process I get :

[ pid ]   uid  tgid total_vm      rss nr_ptes swapents oom_score_adj name
[39130]    33 39130   557139   470405    1040        0             0 php

I'm no expert with oom-killer, but I understood I should take rss column * 4kb, so

470405 * 4 / 1000 = 1881MB

A very different number!!

Which one of my calculation is wrong ??

Thank you all.

emma
  • 68
  • 1
  • 7
  • 1
    If I am not mistaken, a single PHP process can handle multiple threads so if this server is being actively used then there could be hundreds of threads being processed. oom-killer is presenting the usage of the entire process but `memory_get_usage()` only tells you the usage of its own thread. – MonkeyZeus Dec 22 '17 at 14:08
  • Check out https://stackoverflow.com/q/268680/2191572 – MonkeyZeus Dec 22 '17 at 14:11

0 Answers0