Lightsail - adjusting php-fpm settings

0

Is it possible to adjust the php-fpm settings on a lightsail instance? I've adjusted pm.max_children under php-fpm.d/www.conf but it appears to have no affect after restaring the server.

Tim
asked a month ago144 views
1 Answer
1
Accepted Answer

In the Bitnami LightSail instance - php-fpm configuration resides in /opt/bitnami/php/etc/php-fpm.d. At the bottom of the www.conf file, there is a statement that includes a file that is generated based on the memory and other specifications of the lighsail instance type that you are using.

; Memory settings adapted to the machine
; The file below will be overwritten after restarts
include=/opt/bitnami/php/etc/memory.conf

This will override any changes that you make to settings like pm.max_children in www.conf.

If you look in /opt/bitnami/nami/bin/provisioner you will see that memory.conf is a symlink to a file in /opt/bitnami/php/etc/memory which is created at boot by a script the checks the size of your LightSail instance.

You can either modify the corresponding file in /opt/bitnami/php/etc/memory, or simply make sure that you put your statement after the include statement in www.conf .

That said - if you are to change this - make sure you are mindful of the implications regarding memory and other resources on your instance.

AWS
EXPERT
answered a month ago
profile picture
EXPERT
reviewed 5 days ago
  • Thank you for the quick response. I actually commented out the memory.conf include, and added my settings below it. Note that I also restarted server.

    Here is my conf:

    include=/opt/bitnami/php/etc/environment.conf include=/opt/bitnami/php/etc/common.conf pm=dynamic listen=/opt/bitnami/php/var/run/www.sock listen.allowed_clients=127.0.0.1 ; Memory settings adapted to the machine; The file below will be overwritten after restarts ; include=/opt/bitnami/php/etcmemory.conf pm.max_children=50 pm.start_servers=5 pm.min_spare_servers=5 pm.max_spare_servers=10 pm.max_requests=5000

    However, I'm still not able to get more than 10 connections. The 11th connection simply infinity loads, which is what I would expect when max_children is reached. My previous 10 connections continue to work fine and use very little RAM and CPU. If I close some connections I can go ahead and open more without an issue, but the 11th always infinity loads. Its behaving like max_children is set to 10.

    Here is the details on status page:

    pool: www process manager: dynamic start time: 27/Mar/2024:18:28:19 +0000 start since: 9413 accepted conn: 85 listen queue: 0 max listen queue: 0 listen queue len: 0 idle processes: 4 active processes: 10 total processes: 14 max active processes: 10 max children reached: 0 slow requests: 0

  • It seems the problem was not related to max_children but rather how many open SSE connections you can have in the same browser. It seems 10 for firefox, and 6 for chrome!

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions