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
This commit is contained in:
Clark Boylan 2020-09-10 11:41:08 -07:00
parent c0d75862c4
commit 9c68191ce8
2 changed files with 16 additions and 8 deletions

View File

@ -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 %}
<VirtualHost *:80>
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 @@
<IfModule mod_mem_cache.c>
# 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 @@
</IfModule>
<IfModule mod_cache_disk.c>
CacheEnable disk /api/status
CacheEnable disk /static/.*
CacheEnable disk /static/
CacheRoot /var/cache/apache2/mod_cache_disk
CacheMaxFileSize 10000000
</IfModule>

View File

@ -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 %}
<VirtualHost *:80>
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 @@
<IfModule mod_mem_cache.c>
# 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 @@
</IfModule>
<IfModule mod_cache_disk.c>
CacheEnable disk /api/tenant/.*/status
CacheEnable disk /static/.*
CacheEnable disk /static/
CacheRoot /var/cache/apache2/mod_cache_disk
CacheMaxFileSize 10000000
</IfModule>