UPDATE

TUTORIALTEKNOLOGI

How to Optimize PHP-FPM for High Performance

Here’s what the first few lines of this file look like:

;;;;;;;;;;;;;;;;;;;;;  ; FPM Configuration ;  ;;;;;;;;;;;;;;;;;;;;;    ; All relative paths in this configuration file are relative to PHP's install  ; prefix (/usr). This prefix can be dynamically changed by using the  ; '-p' argument from the command line.    ;;;;;;;;;;;;;;;;;;  ; Global Options ;  ;;;;;;;;;;;;;;;;;;    [global]  ; Pid file  ; Note: the default prefix is /var  ; Default Value: none  pid = /run/php/php7.2-fpm.pid    ; Error log file  ; If it's set to "syslog", log is sent to syslogd instead of being written  ; into a local file.  ; Note: the default prefix is /var  ; Default Value: log/php-fpm.log  error_log = /var/log/php7.2-fpm.log

A few things should be immediately obvious: the line pid = /run/php/php7.2-fpm.pid tells us which file contains the process id of the php-fpm process.

We also see that /var/log/php7.2-fpm.log is where php-fpm is going to store its logs.

Inside this file, add three more variables like this:

emergency_restart_threshold 10  emergency_restart_interval 1m  process_control_timeout 10s

The first two settings are cautionary and are telling the php-fpm process that if ten child processes fail within a minute, the main php-fpm process should restart itself.

This might not sound robust, but PHP is a short-lived process that does leak memory, so restarting the main process in cases of high failure can solve a lot of problems.

The third option, process_control_timeout, tells the child processes to wait for this much time before executing the signal received from the parent process. This is useful in cases where the child processes are in the middle of something when the parent processes send a KILL signal, for example. With ten seconds on hand, they’ll have a better chance of finishing their tasks and exiting gracefully.

Surprisingly, this isn’t the meat of php-fpm configuration! That’s because for serving web requests, the php-fpm creates a new pool of processes, which will have a separate configuration. In my case, the pool name turned out to be www and the file I wanted to edit was /etc/php/7.2/fpm/pool.d/www.conf.

Let’s see what this file starts like:

; Start a new pool named 'www'.
; the variable $pool can be used in any directive and will be replaced by the
; pool name ('www' here)
[www]

; Per pool prefix
; It only applies on the following directives:
; - 'access.log'
; - 'slowlog'
; - 'listen' (unixsocket)
; - 'chroot'
; - 'chdir'
; - 'php_values'
; - 'php_admin_values'
; When not set, the global prefix (or /usr) applies instead.
; Note: This directive can also be relative to the global prefix.
; Default Value: none
;prefix = /path/to/pools/$pool

Sumber data: BMKG (Badan Meteorologi, Klimatologi, dan Geofisika)
1 2 3 4 5
Story Terbaru
MEMUAT STORY...

Bagaimana reaksi Kamu?

Beri Komentar

Terkait

Tampilkan Lainnya Loading...Tidak ada lagi data informasi lainnya.