From f0fa8e0e821675bff6b5f627bd0ef39e568eedda Mon Sep 17 00:00:00 2001 From: laurent dangeard Date: Thu, 5 Apr 2018 09:38:10 +0000 Subject: [PATCH] add performance_schema property --- docs/configuration.md | 19 +++++++++++++++++++ jobs/mysql/spec | 3 +++ jobs/mysql/templates/my.cnf.erb | 14 ++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/docs/configuration.md b/docs/configuration.md index ad9d0d4d..340c0f68 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -74,3 +74,22 @@ See the [proxy](jobs/proxy/spec) and [acceptance-tests](jobs/acceptance-tests/sp The slow query log is enabled and you can find long query exceeded 10 seconds (by default) in `/var/vcap/sys/log/mysql/mysql_slow_query.log` To change the threshold above which SQL queries get logged in the slow query log file, update `cf_mysql.mysql.long_query_time` (time in seconds/microseconds). + +### Performance schema ### + +The Performance Schema is a feature for monitoring server performance, see related mariadb documentation : [https://mariadb.com/kb/en/library/performance-schema/](https://mariadb.com/kb/en/library/performance-schema/ "https://mariadb.com/kb/en/library/performance-schema/"). +Performance_schema database, consists of a number of tables that can be queried with regular SQL statements, returning specific performance information. + +To activate Performance_schema, update `cf_mysql.mysql.performance_schema_enabled` property in mysql instance group. + +Performance_schema uses a memory engine (performance_schema) which can potentially increase memory usage when enabled. +To see memory used by performance_schema in bytes: + +``` +MariaDB [(none)]> show engine performance_schema status; ++--------------------+--------------------------------------------------------------+-----------+ +| Type | Name | Status | ++--------------------+--------------------------------------------------------------+-----------+ +... +| performance_schema | performance_schema.memory | 131117680 | ++--------------------+--------------------------------------------------------------+-----------+ diff --git a/jobs/mysql/spec b/jobs/mysql/spec index 38be11fb..d8044a1b 100644 --- a/jobs/mysql/spec +++ b/jobs/mysql/spec @@ -256,3 +256,6 @@ properties: default: 10 description: 'Threshold in seconds above which SQL queries get logged in the slow query log file' + cf_mysql.mysql.performance_schema_enabled: + default: false + description: "Enables Mariadb Performance Schema when set to true" diff --git a/jobs/mysql/templates/my.cnf.erb b/jobs/mysql/templates/my.cnf.erb index 514acdd5..f9b9a14f 100644 --- a/jobs/mysql/templates/my.cnf.erb +++ b/jobs/mysql/templates/my.cnf.erb @@ -202,6 +202,20 @@ ssl_cert = /var/vcap/jobs/mysql/certificates/server-cert. ssl_key = /var/vcap/jobs/mysql/certificates/server-key.pem <% end %> +<% if p('cf_mysql.mysql.performance_schema_enabled') %> +performance_schema = ON +# Specifies the maximum number of few instruments to limit memory consumption under 125Mb with 1500 connections +performance_schema_max_cond_instances = 1270 #Specifies the maximum number of instrumented condition objects. (default automated sizing : 2540) +performance_schema_max_mutex_instances = 2215 #Specifies the maximum number of instrumented mutex instances. (default automated sizing : 8860) +performance_schema_max_rwlock_instances = 1000 #Specifies the maximum number of instrumented rwlock objects. (default automated sizing : 4620) +performance_schema_max_socket_instances = 230 #Specifies the maximum number of instrumented socket objects. (default automated sizing : 640) +performance_schema_max_table_handles = 1000 #Specifies the maximum number of opened table objects (default automated sizing : 2000) +performance_schema_max_table_instances = 1000 #Specifies the maximum number of instrumented table objects (default automated sizing : 12500) +performance_schema_max_thread_instances = 360 #Specifies how many of the running server threads can be instrumented. (default automated sizing : 720) +<% else %> +performance_schema = OFF +<% end %> + [mysqldump] quick quote-names