From f7fc175c9adbe282c7dc2c990de918d8a7960c61 Mon Sep 17 00:00:00 2001 From: JoshuaLicense Date: Fri, 30 Aug 2024 10:39:22 +0100 Subject: [PATCH 1/4] feat(docker): update PHP-FPM config --- infra/docker/api/php-fpm.conf | 8 ++++---- infra/docker/cli/php-fpm.conf | 8 ++++---- infra/docker/internal/php-fpm.conf | 8 ++++---- infra/docker/selfserve/php-fpm.conf | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/infra/docker/api/php-fpm.conf b/infra/docker/api/php-fpm.conf index 0e34ccf43e..25cac6dcbb 100644 --- a/infra/docker/api/php-fpm.conf +++ b/infra/docker/api/php-fpm.conf @@ -11,19 +11,19 @@ access.log = /dev/null ; forget to tweak pm.* to fit your needs. ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' ; Note: This value is mandatory. -pm.max_children = 40 +pm.max_children = 80 ; 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) / 2 -pm.start_servers = 4 +pm.start_servers = 64 ; 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 +pm.min_spare_servers = 24 ; 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 = 4 +pm.max_spare_servers = 64 diff --git a/infra/docker/cli/php-fpm.conf b/infra/docker/cli/php-fpm.conf index 0e34ccf43e..25cac6dcbb 100644 --- a/infra/docker/cli/php-fpm.conf +++ b/infra/docker/cli/php-fpm.conf @@ -11,19 +11,19 @@ access.log = /dev/null ; forget to tweak pm.* to fit your needs. ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' ; Note: This value is mandatory. -pm.max_children = 40 +pm.max_children = 80 ; 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) / 2 -pm.start_servers = 4 +pm.start_servers = 64 ; 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 +pm.min_spare_servers = 24 ; 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 = 4 +pm.max_spare_servers = 64 diff --git a/infra/docker/internal/php-fpm.conf b/infra/docker/internal/php-fpm.conf index 0e34ccf43e..25cac6dcbb 100644 --- a/infra/docker/internal/php-fpm.conf +++ b/infra/docker/internal/php-fpm.conf @@ -11,19 +11,19 @@ access.log = /dev/null ; forget to tweak pm.* to fit your needs. ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' ; Note: This value is mandatory. -pm.max_children = 40 +pm.max_children = 80 ; 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) / 2 -pm.start_servers = 4 +pm.start_servers = 64 ; 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 +pm.min_spare_servers = 24 ; 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 = 4 +pm.max_spare_servers = 64 diff --git a/infra/docker/selfserve/php-fpm.conf b/infra/docker/selfserve/php-fpm.conf index 0e34ccf43e..25cac6dcbb 100644 --- a/infra/docker/selfserve/php-fpm.conf +++ b/infra/docker/selfserve/php-fpm.conf @@ -11,19 +11,19 @@ access.log = /dev/null ; forget to tweak pm.* to fit your needs. ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' ; Note: This value is mandatory. -pm.max_children = 40 +pm.max_children = 80 ; 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) / 2 -pm.start_servers = 4 +pm.start_servers = 64 ; 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 +pm.min_spare_servers = 24 ; 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 = 4 +pm.max_spare_servers = 64 From 87bdaf4b12610d1acf725a1cf800b71dc6d8d86c Mon Sep 17 00:00:00 2001 From: JoshuaLicense Date: Fri, 30 Aug 2024 10:54:45 +0100 Subject: [PATCH 2/4] ci: performance tweaks --- infra/docker/selfserve/php-fpm.conf | 6 +++--- infra/terraform/environments/dev/main.tf | 6 +++--- infra/terraform/environments/int/main.tf | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/infra/docker/selfserve/php-fpm.conf b/infra/docker/selfserve/php-fpm.conf index 25cac6dcbb..83817d9b5e 100644 --- a/infra/docker/selfserve/php-fpm.conf +++ b/infra/docker/selfserve/php-fpm.conf @@ -16,14 +16,14 @@ pm.max_children = 80 ; 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) / 2 -pm.start_servers = 64 +pm.start_servers = 8 ; 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 = 24 +pm.min_spare_servers = 4 ; 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 = 64 +pm.max_spare_servers = 8 diff --git a/infra/terraform/environments/dev/main.tf b/infra/terraform/environments/dev/main.tf index 0421677859..961236a98e 100644 --- a/infra/terraform/environments/dev/main.tf +++ b/infra/terraform/environments/dev/main.tf @@ -149,7 +149,7 @@ module "service" { services = { "api" = { - cpu = 1024 + cpu = 2048 memory = 4096 version = var.api_image_tag @@ -168,7 +168,7 @@ module "service" { } "internal" = { - cpu = 1024 + cpu = 2048 memory = 4096 version = var.internal_image_tag @@ -208,7 +208,7 @@ module "service" { } "selfserve" = { - cpu = 1024 + cpu = 2048 memory = 4096 version = var.selfserve_image_tag diff --git a/infra/terraform/environments/int/main.tf b/infra/terraform/environments/int/main.tf index 47ec7d12eb..95939c3f5a 100644 --- a/infra/terraform/environments/int/main.tf +++ b/infra/terraform/environments/int/main.tf @@ -149,7 +149,7 @@ module "service" { services = { "api" = { - cpu = 1024 + cpu = 2048 memory = 4096 version = var.api_image_tag @@ -168,7 +168,7 @@ module "service" { } "internal" = { - cpu = 1024 + cpu = 2048 memory = 4096 version = var.internal_image_tag @@ -208,7 +208,7 @@ module "service" { } "selfserve" = { - cpu = 1024 + cpu = 2048 memory = 4096 version = var.selfserve_image_tag From cf9924b4d49bab95ba95b89eb06e3707bbb841c7 Mon Sep 17 00:00:00 2001 From: JoshuaLicense Date: Fri, 30 Aug 2024 10:56:27 +0100 Subject: [PATCH 3/4] ci: update the rest --- infra/docker/api/php-fpm.conf | 6 +++--- infra/docker/cli/php-fpm.conf | 6 +++--- infra/docker/internal/php-fpm.conf | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/infra/docker/api/php-fpm.conf b/infra/docker/api/php-fpm.conf index 25cac6dcbb..83817d9b5e 100644 --- a/infra/docker/api/php-fpm.conf +++ b/infra/docker/api/php-fpm.conf @@ -16,14 +16,14 @@ pm.max_children = 80 ; 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) / 2 -pm.start_servers = 64 +pm.start_servers = 8 ; 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 = 24 +pm.min_spare_servers = 4 ; 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 = 64 +pm.max_spare_servers = 8 diff --git a/infra/docker/cli/php-fpm.conf b/infra/docker/cli/php-fpm.conf index 25cac6dcbb..83817d9b5e 100644 --- a/infra/docker/cli/php-fpm.conf +++ b/infra/docker/cli/php-fpm.conf @@ -16,14 +16,14 @@ pm.max_children = 80 ; 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) / 2 -pm.start_servers = 64 +pm.start_servers = 8 ; 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 = 24 +pm.min_spare_servers = 4 ; 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 = 64 +pm.max_spare_servers = 8 diff --git a/infra/docker/internal/php-fpm.conf b/infra/docker/internal/php-fpm.conf index 25cac6dcbb..83817d9b5e 100644 --- a/infra/docker/internal/php-fpm.conf +++ b/infra/docker/internal/php-fpm.conf @@ -16,14 +16,14 @@ pm.max_children = 80 ; 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) / 2 -pm.start_servers = 64 +pm.start_servers = 8 ; 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 = 24 +pm.min_spare_servers = 4 ; 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 = 64 +pm.max_spare_servers = 8 From a5a1656fa7d2f9f02bafa9b86d0b3b0ef4eb9d76 Mon Sep 17 00:00:00 2001 From: JoshuaLicense Date: Fri, 30 Aug 2024 11:00:12 +0100 Subject: [PATCH 4/4] ci: remove the FPM config from the CLI image --- infra/docker/cli/Dockerfile | 3 --- infra/docker/cli/php-fpm.conf | 29 ----------------------------- 2 files changed, 32 deletions(-) delete mode 100644 infra/docker/cli/php-fpm.conf diff --git a/infra/docker/cli/Dockerfile b/infra/docker/cli/Dockerfile index 8307c1b446..72c8d3247c 100644 --- a/infra/docker/cli/Dockerfile +++ b/infra/docker/cli/Dockerfile @@ -18,9 +18,6 @@ RUN apk add --no-cache icu-dev \ # PHP config file COPY ./php.ini ${PHP_INI_DIR}/conf.d/zzzz-php.ini -# PHP-FPM config file -COPY php-fpm.conf /usr/local/etc/php-fpm.d/zzzz-www.conf - EXPOSE 8080 FROM cli AS production diff --git a/infra/docker/cli/php-fpm.conf b/infra/docker/cli/php-fpm.conf deleted file mode 100644 index 83817d9b5e..0000000000 --- a/infra/docker/cli/php-fpm.conf +++ /dev/null @@ -1,29 +0,0 @@ -; The access log file. -; Default value: not set -access.log = /dev/null - -; The number of child processes to be created when pm is set to 'static' and the -; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. -; 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. The below defaults are based on a server without much resources. Don't -; forget to tweak pm.* to fit your needs. -; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' -; Note: This value is mandatory. -pm.max_children = 80 - -; 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) / 2 -pm.start_servers = 8 - -; 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 = 4 - -; 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 = 8