I’m using EC2
instance t4g.micro
which is arm64
, with 1gb ram of the latest ubuntu
.
I’m using nginx
with PHP-FPM
for upload and convert pictures using latest image.intervention
with GD
.
My PHP_FPM
configuration:
pm = static
pm.max_children = 1
pm.max_requests = 300
And php.ini:
max_execution_time = 5
memory_limit = 100M
opcache.enable = 1
opcache.jit_buffer_size = 50M
opcache.jit = 1255
And yet I keep on getting those messages from time to time on my syslog
:
Out of memory: Killed process 510 (php-fpm8.3) total-vm:490452kB, anon-rss:273404kB, file-rss:2944kB, shmem-rss:3840kB, UID:1001 pgtables:708kB oom_score_adj:0
Out of memory: Killed process 510 (php-fpm8.3) total-vm:499780kB, anon-rss:282508kB, file-rss:2944kB, shmem-rss:3968kB, UID:1001 pgtables:720kB oom_score_adj:0
Out of memory: Killed process 20481 (php-fpm8.3) total-vm:495800kB, anon-rss:272472kB, file-rss:2944kB, shmem-rss:3456kB, UID:1001 pgtables:708kB oom_score_adj:0
Out of memory: Killed process 24725 (php-fpm8.3) total-vm:465556kB, anon-rss:247920kB, file-rss:2944kB, shmem-rss:1664kB, UID:1001 pgtables:648kB oom_score_adj:0
Out of memory: Killed process 24732 (php-fpm8.3) total-vm:458888kB, anon-rss:240892kB, file-rss:2816kB, shmem-rss:3456kB, UID:1001 pgtables:624kB oom_score_adj:0
Out of memory: Killed process 24739 (php-fpm8.3) total-vm:458280kB, anon-rss:240372kB, file-rss:2816kB, shmem-rss:3456kB, UID:1001 pgtables:628kB oom_score_adj:0
Sometimes it cause my instance to not respond at all ,not even to SSH
, and the CPU reach to 60% precent on AWS monitor and stay there till I manually click on restart instance several times.
My php
script is simple, takes post image file, convert it and save, no error are thrown.
The OOM killed might happend once a week..
I tried tuning my configuration to the lowest possible,
All I want is to avoid OOM intervention, control php
to kill request that absorb to much memory before it crushes PHP-FPM
and even worse when it stuck the whole ubuntu
system.
user24198409 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.