From 9c68191ce848066acc23db8b801525ab950991ce Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Thu, 10 Sep 2020 11:41:08 -0700 Subject: [PATCH] Improve logging and cache config for zuul web proxy We attempt to cache things served by zuul-web in our apache proxy. This is to reduce the load on the zuul-web process which has to query gearman, the sql database, and eventuall the zookeeper database to produce its responses. Things are currently operating slowly and it isn't clear if we're caching properly. To check that better update our logging format to record cache hits and misses. Also drop an unnecessary .* in the CacheEnable url-strings for /static/ as it is unclear if the .* is treated as a regex here. Change-Id: Ib57c085fa15365b89b3276e037339dbeddb094e3 --- .../roles/zuul-web/templates/openstack.vhost.j2 | 12 ++++++++---- playbooks/roles/zuul-web/templates/zuul.vhost.j2 | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/playbooks/roles/zuul-web/templates/openstack.vhost.j2 b/playbooks/roles/zuul-web/templates/openstack.vhost.j2 index 328d1a38cb..0e99a5aacf 100644 --- a/playbooks/roles/zuul-web/templates/openstack.vhost.j2 +++ b/playbooks/roles/zuul-web/templates/openstack.vhost.j2 @@ -1,3 +1,7 @@ +{% raw %} +LogFormat "%h %l %u [%{%F %T}t.%{msec_frac}t] \"%r\" %>s %b %{cache-status}e \"%{Referer}i\" \"%{User-agent}i\"" combined-cache +{% endraw %} + ServerName zuul.openstack.org ServerAdmin webmaster@openstack.org @@ -6,7 +10,7 @@ LogLevel warn - CustomLog ${APACHE_LOG_DIR}/zuul-access.log combined + CustomLog ${APACHE_LOG_DIR}/zuul-access.log combined-cache Redirect / https://zuul.openstack.org/ @@ -23,7 +27,7 @@ LogLevel warn - CustomLog ${APACHE_LOG_DIR}/zuul-ssl-access.log combined + CustomLog ${APACHE_LOG_DIR}/zuul-ssl-access.log combined-cache SSLEngine on SSLProtocol All -SSLv2 -SSLv3 @@ -55,7 +59,7 @@ # TODO: Should we cache the rest of the API too? CacheEnable mem /api/status - CacheEnable mem /static/.* + CacheEnable mem /static/ # 80MB max cache size. 10 objects at 8MB max each. MCacheSize 81920 MCacheMaxObjectCount 10 @@ -66,7 +70,7 @@ CacheEnable disk /api/status - CacheEnable disk /static/.* + CacheEnable disk /static/ CacheRoot /var/cache/apache2/mod_cache_disk CacheMaxFileSize 10000000 diff --git a/playbooks/roles/zuul-web/templates/zuul.vhost.j2 b/playbooks/roles/zuul-web/templates/zuul.vhost.j2 index a633022127..c46066346d 100644 --- a/playbooks/roles/zuul-web/templates/zuul.vhost.j2 +++ b/playbooks/roles/zuul-web/templates/zuul.vhost.j2 @@ -1,3 +1,7 @@ +{% raw %} +LogFormat "%h %l %u [%{%F %T}t.%{msec_frac}t] \"%r\" %>s %b %{cache-status}e \"%{Referer}i\" \"%{User-agent}i\"" combined-cache +{% endraw %} + ServerName zuul.opendev.org ServerAdmin webmaster@openstack.org @@ -6,7 +10,7 @@ LogLevel warn - CustomLog ${APACHE_LOG_DIR}/zuul-access.log combined + CustomLog ${APACHE_LOG_DIR}/zuul-access.log combined-cache Redirect / https://zuul.opendev.org/ @@ -23,7 +27,7 @@ LogLevel warn - CustomLog ${APACHE_LOG_DIR}/zuul-ssl-access.log combined + CustomLog ${APACHE_LOG_DIR}/zuul-ssl-access.log combined-cache SSLEngine on SSLProtocol All -SSLv2 -SSLv3 @@ -53,7 +57,7 @@ # TODO: Should we cache the rest of the API too? CacheEnable mem /api/tenant/.*/status - CacheEnable mem /static/.* + CacheEnable mem /static/ # 80MB max cache size. 10 objects at 8MB max each. MCacheSize 81920 MCacheMaxObjectCount 10 @@ -64,7 +68,7 @@ CacheEnable disk /api/tenant/.*/status - CacheEnable disk /static/.* + CacheEnable disk /static/ CacheRoot /var/cache/apache2/mod_cache_disk CacheMaxFileSize 10000000