I have the following docker configuration for Mautic (A PHP based CRM):
x-mautic-volumes:
&mautic-volumes
- ./mautic/config:/var/www/html/config:z
- ./mautic/logs:/var/www/html/var/logs:z
- ./mautic/media/files:/var/www/html/docroot/media/files:z
- ./mautic/media/images:/var/www/html/docroot/media/images:z
- ./mautic/themes/leeway_newsletter:/var/www/html/docroot/themes/leeway_newsletter:z
- ./mautic/themes/leeway_responsive:/var/www/html/docroot/themes/leeway_responsive:z
- ./session.ini:/usr/local/etc/php/conf.d/session.ini:z
- ./cron:/opt/mautic/cron:z
- mautic-docroot:/var/www/html/docroot:z
- mautic-vendor:/var/www/html/vendor:z
services:
nginx:
image: nginx
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf
- mautic-docroot:/var/www/html/docroot:z
- ./mautic/media/files:/var/www/html/docroot/media/files:z
- ./mautic/media/images:/var/www/html/docroot/media/images:z
- ./.well-known:/var/www/html/docroot/.well-known
depends_on:
- web
ports:
- "127.0.0.1:8002:80"
networks:
- default
restart: always
web:
image: my_mautic:5.2.1
build: .
volumes: *mautic-volumes
env_file:
- .mautic_env
healthcheck:
test: cgi-fcgi -bind -connect 127.0.0.1:9000
start_period: 5s
interval: 5s
timeout: 5s
retries: 100
networks:
- default
restart: always
cron:
image: my_mautic:5.2.1
build: .
volumes: *mautic-volumes
environment:
- DOCKER_MAUTIC_ROLE=mautic_cron
env_file:
- .mautic_env
depends_on:
web:
condition: service_healthy
networks:
- default
restart: always
volumes:
mautic-docroot:
name: mautic-5.2.1
mautic-vendor:
name: mautic-5.2.1-vendor
networks:
default:
name: ${COMPOSE_PROJECT_NAME}-docker
This application is accessed through an NginX that takes care of SSL and forwards traffic to both this docker container and a regular WordPress hosted directly on the server using php8.2-fpm.
I have my servers on Basic Premium Intel droplets (1 GB Ram, 1vCPU, 25GB disk).
The app is currently running just fine on an Ubuntu 23.10 server.
I tried to put together a new server using Ubuntu 24.04 and, using the exact same configuration, after running for about 20 minutes, the CPU usage will go to 100% and stay there until I manually kill the in-docker php-fpm process.
I tried installing docker from the official sources, re-install the whole thing from scratch to make sure I wasn’t using old volumes, explicitly limited resources for the web container but I always end up in the same place.
Any idea?
Thanks!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hello, @maurochojrin
You can use tools like
htop
oriotop
to identify bottlenecks:It will be useful to check if a process outside Docker is interfering with PHP-FPM. Also you can monitor which exct process is consuming the CPU and memory on the droplet. This willl give you insight which configuration you can tweak - php-fpm, nginx and etc.
The high CPU usage is likely due to an issue with PHP-FPM or the Mautic app’s handling of requests:
Inspect the PHP-FPM logs within the container to identify errors or repetitive processes. Look for:
pm.max_children
being exceeded).Also there might be a high disk usage or slow reads/writes could cause processes to hang.
Hope that this helps!
If you issue comes from the php-fpm proccesses that are being spawned, you’ll need to tweak them a little bit.
Try something like the above.
Now, I am also baffled about why it’s happening on Ubuntu 24.04. The only thing I can think of is that maybe there are some differences between the versions which lead to this.