mariadb: Tweak query cache settings

We used to set query_cache_type to 0 in the default settings but we were
also setting query_cache_size to a non-zero/non-default value, which was
in turn re-enabling the query cache. Update the configuration to reflect
the actual cache state and make sure query_cache_size is set to zero for
the "query_cache_type = 0" case.

Now that the setting controls the real state of the query cache, disable
it for bbs.archlinux.org; its hit rate is small compared to insert rate.
This commit is contained in:
Evangelos Foutras 2021-08-18 19:56:50 +03:00
parent 1b2cfa7120
commit 6534413cf3
No known key found for this signature in database
GPG key ID: 51E8B148A9999C34
3 changed files with 11 additions and 5 deletions

View file

@ -10,7 +10,7 @@
- { role: root_ssh }
- { role: certbot }
- { role: nginx }
- { role: mariadb }
- { role: mariadb, mariadb_query_cache_type: '0' }
- { role: sudo }
- { role: php_fpm, php_extensions: ['apcu', 'iconv', 'intl', 'mysqli'], zend_extensions: ['opcache'] }
- { role: fluxbb }

View file

@ -9,7 +9,7 @@ mariadb_net_buffer_length: '8K'
mariadb_read_buffer_size: '256K'
mariadb_read_rnd_buffer_size: '512K'
mariadb_myisam_sort_buffer_size: '8M'
mariadb_query_cache_type: '0'
mariadb_query_cache_type: '1'
mariadb_query_cache_limit: '16M'
mariadb_query_cache_size: '32M'
mariadb_max_connections: '400'

View file

@ -23,13 +23,19 @@ net_buffer_length = {{ mariadb_net_buffer_length }}
read_buffer_size = {{ mariadb_read_buffer_size }}
read_rnd_buffer_size = {{ mariadb_read_rnd_buffer_size }}
myisam_sort_buffer_size = {{ mariadb_myisam_sort_buffer_size }}
query_cache_type = {{ mariadb_query_cache_type }}
query_cache_limit = {{ mariadb_query_cache_limit }}
query_cache_size = {{ mariadb_query_cache_size }}
max_connections = {{ mariadb_max_connections }}
thread_cache_size = {{ mariadb_thread_cache_size }}
userstat = 1
# Query cache settings
query_cache_type = {{ mariadb_query_cache_type }}
query_cache_limit = {{ mariadb_query_cache_limit }}
{% if mariadb_query_cache_type == '0' %}
query_cache_size = 0
{% else %}
query_cache_size = {{ mariadb_query_cache_size }}
{% endif %}
# Single server setup
server-id = 1