FPM tuning
Starting with Hawkeye 4.0 php-fpm thread, tuning is available. This allows the Hawkeye system to scale performance better and to balance both the load of the system and the resources available to it. Tuning of the php-fpm process can be performed with the following file:
/opt/hawkeye/conf/fpm.d/tuning.conf
The tuning file you will edit by uncommenting (“ ; ”) the variables listed below and changing them to the following tuning starting points based on the following table. Use the table with the following logic to find the correct starting points:
If your system has A number of endpoints connected or B number of tests running per hour and has C for system resources, use the following values as starting points for tuning your system.
After making the changes, run the hawkeyeServices command to restart the services for your changes to take effect.
| #Endpoint | Tests / Hour | Sys. Resources | pm.max_children | pm.start_servers | pm.min_spare_servers | pm.max_spare_servers |
|---|---|---|---|---|---|---|
| 25 | <150 | 4 vCPU 8GB RAM | 10 | 2 | 2 | 5 |
| 100 | <1000 | 6 vCPU 16GB RAM | 20 | 6 | 2 | 10 |
| 400 | <10000 | 8 vCPU 24GB RAM | 30 | 7 | 5 | 10 |
For systems with 8 GB of RAM, if your MariaDB innodb_buffer is set above 4GB, reduce it to 4GB before modifying the FPM tuning file. Otherwise, you will be at risk of running into an Out of Memory Error.
Example Config file:
[root@hawkeye-server ~]# cat /opt/hawkeye/conf/fpm.d/tuning.conf
[hawkeye]
; Choose how the process manager will control the number of child processes.
; Possible Values:
; static - a fixed number (pm.max_children) of child processes;
; dynamic - the number of child processes are set dynamically based on the
; following directives:
; pm.max_children - the maximum number of children that can
; be alive at the same time.
; pm.start_servers - the number of children created on startup.
; pm.min_spare_servers - the minimum number of children in 'idle'
; state (waiting to process). If the number
; of 'idle' processes is less than this
; number then some children will be created.
; pm.max_spare_servers - the maximum number of children in 'idle'
; state (waiting to process). If the number
; of 'idle' processes is greater than this
; number then some children will be killed.
; Note: This value is mandatory.
;pm = dynamic
; The number of child processes to be created when pm is set to 'static' and the
; maximum number of child processes to be created when pm is set to 'dynamic'.
; This value sets the limit on the number of simultaneous requests that will be
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
; CGI.
; Note: Used when pm is set to either 'static' or 'dynamic'
; Note: This value is mandatory.
pm.max_children = 10
; The number of child processes created on startup.
; Note: Used only when pm is set to 'dynamic'
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
pm.start_servers = 2
; The desired minimum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.min_spare_servers = 2
; The desired maximum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.max_spare_servers = 10
; The number of requests each child process should execute before respawning.
; This can be useful to work around memory leaks in 3rd party libraries. For
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
; Default Value: 0
;pm.max_requests = 500
; The timeout for serving a single request after which the worker process will
; be killed. This option should be used when the 'max_execution_time' ini option
; does not stop script execution for some reason. A value of '0' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
;request_terminate_timeout = 0
; The timeout for serving a single request after which a PHP backtrace will be
; dumped to the 'slowlog' file. A value of '0s' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
;request_slowlog_timeout = 0
; The log file for slow requests
; Default Value: not set
; Note: slowlog is mandatory if request_slowlog_timeout is set;
;slowlog = /var/logs/php/slow.log
; Set open file descriptor rlimit.
; Default Value: system defined value
;rlimit_files = 1024
; Set max core size rlimit.
; Possible Values: 'unlimited' or an integer greater or equal to 0
; Default Value: system defined value
;rlimit_core = 0
; Chroot to this directory at the start. This value must be defined as an
; absolute path. When this value is not set, chroot is not used.
; Note: chrooting is a great security feature and should be used whenever
; possible. However, all PHP paths will be relative to the chroot
; (error_log, sessions.save_path, ...).
; Default Value: not set
;chroot =
; Chdir to this directory at the start. This value must be an absolute path.
; Default Value: current directory or / when chroot
;chdir = /var/www
; Redirect worker stdout and stderr into main error log. If not set, stdout and
; stderr will be redirected to /dev/null according to FastCGI specs.
; Default Value: no
;catch_workers_output = yes
Defaults:
pm.max_children 10
pm.start_servers 2
pm.min_spare_servers 2
pm.max_spare_servers 5
Servers running 100-250 tests per hour.
pm.max_children 20
pm.start_servers 6
pm.min_spare_servers 2
pm.max_spare_servers 10
Vision Appliance running 12,000 tests per hour
pm.max_children 30
pm.start_servers 7
pm.min_spare_servers 5
pm.max_spare_servers 10