From 6fe0afaa39271bbd75cf068abd67b19fd062a843 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Fri, 6 Oct 2017 12:28:33 -0400 Subject: Bug 1406235 - Cleanup httpd config and expose server limits as env settings --- Dockerfile | 7 ++++++- README.rst | 42 +++++++++++++++++++++++++++++++++++++--- httpd/httpd.conf | 58 ++++++++++++++++---------------------------------------- 3 files changed, 61 insertions(+), 46 deletions(-) diff --git a/Dockerfile b/Dockerfile index ef226da56..604f12c14 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,11 @@ FROM mozillabteam/bmo-slim:20170927.1 -ENV BUNDLE=https://s3.amazonaws.com/moz-devservices-bmocartons/bmo/vendor.tar.gz +ENV HTTPD_StartServers=8 +ENV HTTPD_MinSpareServers=5 +ENV HTTPD_MaxSpareServers=20 +ENV HTTPD_ServerLimit=256 +ENV HTTPD_MaxClients=256 +ENV HTTPD_MaxRequestsPerChild=4000 ENV PORT=8000 WORKDIR /app diff --git a/README.rst b/README.rst index a417de810..a3c731d16 100644 --- a/README.rst +++ b/README.rst @@ -73,7 +73,7 @@ After editing files in the bmo directory, you will need to run vagrant rsync && vagrant provision --provision-with update -to see the changes applied to your vagrant VM. If the above command fails +to see the changes applied to your vagrant VM. If the above command fails or db is changed, do a full provision: .. code-block:: bash @@ -171,6 +171,7 @@ Environmental Variables PORT This must be a value >= 1024. The httpd will listen on this port for incoming plain-text HTTP connections. + Default: 8000 BMO_db_driver What SQL database to use. Default is mysql. List of supported databases can be @@ -194,7 +195,7 @@ BMO_site_wide_secret This secret key is used by your installation for the creation and validation of encrypted tokens. These tokens are used to implement security features in Bugzilla, to protect against certain types of attacks. - It's very important that this key is kept secret. + It's very important that this key is kept secret. BMO_inbound_proxies This is a list of IP addresses that we expect proxies to come from. @@ -206,7 +207,7 @@ BMO_memcached_namespace BMO_memcached_servers A list of memcached servers (ip addresses or host names). Can be empty. - + BMO_shadowdb The database name of the read-only database. @@ -220,6 +221,41 @@ BMO_apache_size_limit This is the max amount of unshared memory (in kb) that the apache process is allowed to use before Apache::SizeLimit kills it. +HTTPD_StartServers + Sets the number of child server processes created on startup. + As the number of processes is dynamically controlled depending on the load, + there is usually little reason to adjust this parameter. + Default: 8 + +HTTPD_MinSpareServers + Sets the desired minimum number of idle child server processes. An idle + process is one which is not handling a request. If there are fewer than + MinSpareServers idle, then the parent process creates new children at a + maximum rate of 1 per second. + Default: 5 + +HTTPD_MaxSpareServers + Sets the desired maximum number of idle child server processes. An idle + process is one which is not handling a request. If there are more than + MaxSpareServers idle, then the parent process will kill off the excess + processes. + Default: 20 + +HTTPD_MaxClients + Sets the maximum number of child processes that will be launched to serve requests. + Default: 256 + +HTTPD_ServerLimit + Sets the maximum configured value for MaxClients for the lifetime of the + Apache process. + Default: 256 + +HTTPD_MaxRequestsPerChild + Sets the limit on the number of requests that an individual child server + process will handle. After MaxRequestsPerChild requests, the child process + will die. If MaxRequestsPerChild is 0, then the process will never expire. + Default: 4000 + Persistent Data Volume ---------------------- diff --git a/httpd/httpd.conf b/httpd/httpd.conf index 472b734fc..9df26b9db 100644 --- a/httpd/httpd.conf +++ b/httpd/httpd.conf @@ -1,60 +1,40 @@ +ServerName 127.0.0.1 ServerTokens Prod ServerRoot "/etc/httpd" +ServerAdmin root@localhost + PidFile /tmp/httpd.pid Timeout 60 KeepAlive Off MaxKeepAliveRequests 100 KeepAliveTimeout 15 - -StartServers 8 -MinSpareServers 5 -MaxSpareServers 20 -ServerLimit 256 -MaxClients 256 -MaxRequestsPerChild 4000 - - -StartServers 4 -MaxClients 300 -MinSpareThreads 25 -MaxSpareThreads 75 -ThreadsPerChild 25 -MaxRequestsPerChild 0 - + +StartServers ${HTTPD_StartServers} +MinSpareServers ${HTTPD_MinSpareServers} +MaxSpareServers ${HTTPD_MaxSpareServers} +ServerLimit ${HTTPD_ServerLimit} +MaxClients ${HTTPD_MaxClients} +MaxRequestsPerChild ${HTTPD_MaxRequestsPerChild} + Listen ${PORT} +User app +Group app + LoadModule authz_host_module modules/mod_authz_host.so -LoadModule include_module modules/mod_include.so LoadModule log_config_module modules/mod_log_config.so -LoadModule logio_module modules/mod_logio.so LoadModule env_module modules/mod_env.so -LoadModule ext_filter_module modules/mod_ext_filter.so LoadModule mime_magic_module modules/mod_mime_magic.so LoadModule expires_module modules/mod_expires.so LoadModule deflate_module modules/mod_deflate.so LoadModule headers_module modules/mod_headers.so -LoadModule usertrack_module modules/mod_usertrack.so LoadModule setenvif_module modules/mod_setenvif.so LoadModule mime_module modules/mod_mime.so -LoadModule dav_module modules/mod_dav.so -LoadModule status_module modules/mod_status.so -LoadModule autoindex_module modules/mod_autoindex.so -LoadModule info_module modules/mod_info.so -LoadModule dav_fs_module modules/mod_dav_fs.so -LoadModule vhost_alias_module modules/mod_vhost_alias.so LoadModule negotiation_module modules/mod_negotiation.so LoadModule dir_module modules/mod_dir.so -LoadModule actions_module modules/mod_actions.so -LoadModule speling_module modules/mod_speling.so LoadModule alias_module modules/mod_alias.so -LoadModule substitute_module modules/mod_substitute.so LoadModule rewrite_module modules/mod_rewrite.so -LoadModule cache_module modules/mod_cache.so -LoadModule disk_cache_module modules/mod_disk_cache.so -LoadModule version_module modules/mod_version.so LoadModule perl_module modules/mod_perl.so -User app -Group app -ServerAdmin root@localhost + UseCanonicalName Off Options FollowSymLinks @@ -68,9 +48,7 @@ AccessFileName .htaccess TypesConfig /etc/mime.types DefaultType text/plain - - MIMEMagicFile conf/magic - +MIMEMagicFile conf/magic HostnameLookups Off ErrorLog /dev/stderr LogLevel warn @@ -80,10 +58,6 @@ LogFormat "%{Referer}i -> %U" referer LogFormat "%{User-agent}i" agent ServerSignature Off AddDefaultCharset UTF-8 -AddType application/x-compress .Z -AddType application/x-gzip .gz .tgz -AddType application/x-x509-ca-cert .crt -AddType application/x-pkcs7-crl .crl PerlSwitches -wT PerlRequire /app/mod_perl.pl -- cgit v1.2.3-24-g4f1b