Fixes #393 Be able to customize worker_processes and worker_connections

This commit is contained in:
cytopia 2019-03-04 08:50:04 +01:00
parent ec1d312c41
commit 6c851a5772
No known key found for this signature in database
GPG Key ID: 6D56EDB8695128A2
3 changed files with 60 additions and 1 deletions

View File

@ -210,7 +210,7 @@ services:
# Web Server
# ------------------------------------------------------------
httpd:
image: devilbox/${HTTPD_SERVER}:0.29
image: devilbox/${HTTPD_SERVER}:0.30
hostname: httpd
environment:
@ -233,6 +233,12 @@ services:
- NEW_UID
- NEW_GID
##
## Nginx specific worker/connection settings
##
- WORKER_PROCESSES=${HTTPD_NGINX_WORKER_PROCESSES:-auto}
- WORKER_CONNECTIONS=${HTTPD_NGINX_WORKER_CONNECTIONS:-1024}
##
## Disable default vhost?
##

View File

@ -1518,6 +1518,47 @@ than ``max_execution_time``, you will get a proper PHP error message in the brow
| ``HTTPD_TIMEOUT_TO_PHP_FPM`` | positive integer | ``180`` |
+------------------------------+-------------------+------------------+
HTTPD_NGINX_WORKER_PROCESSES
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Defines the number of worker processes for Nginx, i.e, the number of CPU cores.
The optimal value depends on many factors including (but not limited to) the number of CPU cores,
the number of hard disk drives that store data, and load pattern. When one is in doubt, setting it
to the number of available CPU cores would be a good start
(the value “auto” will try to autodetect it).
+----------------------------------+-----------------------------+------------------+
| Name | Allowed values | Default value |
+==================================+=============================+==================+
| ``HTTPD_NGINX_WORKER_PROCESSES`` | positive integer \| `auto` | ``auto`` |
+----------------------------------+-----------------------------+------------------+
.. note:: This setting only applies to Nginx and has no effect for Apache.
.. seealso:: https://nginx.org/en/docs/ngx_core_module.html#worker_processes
HTTPD_NGINX_WORKER_CONNECTIONS
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sets the maximum number of simultaneous connections that can be opened by a worker process.
It should be kept in mind that this number includes all connections (e.g. connections with proxied
servers, among others), not only connections with clients. Another consideration is that the actual
number of simultaneous connections cannot exceed the current limit on the maximum number of open
files, which can be changed by worker_rlimit_nofile.
+------------------------------------+-------------------+------------------+
| Name | Allowed values | Default value |
+====================================+===================+==================+
| ``HTTPD_NGINX_WORKER_CONNECTIONS`` | positive integer | ``1024`` |
+------------------------------------+-------------------+------------------+
.. note:: This setting only applies to Nginx and has no effect for Apache.
.. seealso:: https://nginx.org/en/docs/ngx_core_module.html#worker_connections
MySQL
-----

View File

@ -561,6 +561,18 @@ HTTPD_TEMPLATE_DIR=.devilbox
HTTPD_TIMEOUT_TO_PHP_FPM=180
###
### NGINX ONLY
###
### Set worker_processes and worker_connections
###
### https://nginx.org/en/docs/ngx_core_module.html#worker_processes
### https://nginx.org/en/docs/ngx_core_module.html#worker_connections
###
HTTPD_NGINX_WORKER_PROCESSES=auto
HTTPD_NGINX_WORKER_CONNECTIONS=1024
################################################################################
###