Diferència entre revisions de la pàgina «ASIX/M10/UF2/A05/E3»

De Lordwektabyte Wiki
Salta a la navegació Salta a la cerca
m
m (Guillem ha mogut M10/UF2/A05/E3 a ASIX/M10/UF2/A05/E3 sense deixar una redirecció: Crear subnivell ASIX)
 
(Cap diferència)

Revisió de 11:30, 15 abr 2020

Guillem Solà i Boeck (host A10BPC22)

Fent servir scripts de monitorització per optimitzar el rendiment de l'SGBD

  • Indicar quins scripts i eines de monitoratge hi ha de BBDD
  • Identificar diferents tipus d'optimització: emmagatzematge, espai de disc i procediments de transferències i comunicacions. Indica els resultats obtinguts.
  • Identifica tècniques d'optimització de consultes en un SGBD. Indica els resultats obtinguts.

Fer les modificacions al fitxer de configuració que es necessitin

Indicar quins scripts i eines de monitoratge hi ha de BBDD

  • Un script escrit en Perl és molt conegut en el món MariaDB/MySQL. Es tracta de mysqltuner.
  • Un altre script conegut com a mysql tuning primer. Aquest està escrit en bash i és molt semblant a l'anterior a nivell de funcionalitat.
  • El Percona Toolkit és tota una caixa d'eines per a monitoritzar i extreure informació llegible per persones humanes des d'un SGBD.

Com a conclusió, crec que aquests 2 scripts hem de veure'ls com un conjunt ja que és difícil dir si un és millor que l'altre. Com a administradors de sistemes hem de ser capaços de poder treure bones conclusions a partir dels resultats de cadascun.

Identificar diferents tipus d'optimització

  • Emmagatzematge
A nivell d'emmagatzematge es pot destacar el tipus de suport on tindrem instal·lat el sistema operatiu+SGBD i les dades de la Base de Dades en general. Com a norma general, descartarem discos durs mecànics perquè tenen temps d'accés molt lents en comparació als discos durs sòlids (SSD) basats en memòria flash. Encara que el SGBD carregarà les dades més accedides en RAM per a evitar lectures a disc (infinitament més lentes encara que es llegeixi d'un SSD), sempre serà millor un disc ràpid per si s'ha de fer una consulta sobre unes dades que no estiguin cachejades en memòria.
  • Espai de disc
Generalment, com més espai disponible en disc, millor en termes d'escalabilitat del sistema que suporta el SGBD; de manera que no fem curt al cap d'un temps quan la BBDD creixi i haguem de migrar a discos durs més grans o, fins i tot, haver de canviar el servidor sencer. El que és interessant és trobar un balanç entre rendiment de velocitat i espai disponible; ja que com més gran sigui el disc, més car serà. Això potser no és problema per una empresa més o menys gran, però normalment, a les empreses, els sol costar bastant buidar la butxaca per a equipament informàtic i aquest tema serà més delicat. Per tant, tampoc podem donar una conclusió genèrica sinó que haurem d'estudiar cada cas en concret i prendre decisions basant-nos en aquella situació.
  • Procediments de transferències i comunicacions
Per suposat que l'estàndard de comunicacions serà a velocitat de gigabit per qüestions òbvies. Llavors el servidor hauria de tenir, com a mínim, 2 targetes de xarxa en sistema failover per a evitar downtimes en cas que una interfície falli o tingui problemes.

Exemple de funcionament

MySQL Tuning Primer

Per a utilitzar aquest script necessitem tenir instal·lat el programari bc. L'instal·larem amb

yum install bc -y

Una vegada instal·lat el podem fer executable amb

chmod +x tuning-primer.sh

i executar-lo pròpiament amb

./tuning-primer.sh

El meu resultat d'execució és el següent:

Using login values from ~/.my.cnf
- INITIAL LOGIN ATTEMPT FAILED -
Testing for stored webmin passwords:
 None Found
Could not auto detect login info!
Found potential sockets: /var/lib/mysql/mysql.sock
Using: /var/lib/mysql/mysql.sock
Would you like to provide a different socket?: [y/N] n
Do you have your login handy ? [y/N] : n
User: root
Password: asix
 
Would you like me to create a ~/.my.cnf file for you? [y/N] : y
 
        -- MYSQL PERFORMANCE TUNING PRIMER --
             - By: Matthew Montgomery -

MySQL Version 5.5.56-MariaDB x86_64

Uptime = 0 days 1 hrs 10 min 48 sec
Avg. qps = 4
Total Questions = 19165
Threads Connected = 1

Warning: Server has not been running for at least 48hrs.
It may not be safe to use these recommendations

To find out more information on how each of these
runtime variables effects performance visit:                                                                                                                            
http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html
Visit http://www.mysql.com/products/enterprise/advisors.html
for info about MySQL's Enterprise Monitoring and Advisory Service

SLOW QUERIES
The slow query log is NOT enabled.
Current long_query_time = 10.000000 sec.
You have 0 out of 19186 that take longer than 10.000000 sec. to complete
Your long_query_time seems to be fine

BINARY UPDATE LOG
The binary update log is NOT enabled.
You will not be able to do point in time recovery
See http://dev.mysql.com/doc/refman/5.5/en/point-in-time-recovery.html

WORKER THREADS
Current thread_cache_size = 0
Current threads_cached = 0
Current threads_per_sec = 1
Historic threads_per_sec = 0
Your thread_cache_size is fine

MAX CONNECTIONS
Current max_connections = 151
Current threads_connected = 1
Historic max_used_connections = 8
The number of used connections is 5% of the configured maximum.
You are using less than 10% of your configured max_connections.
Lowering max_connections could help to avoid an over-allocation of memory                                                                                               
See "MEMORY USAGE" section to make sure you are not over-allocating                                                                                                     

INNODB STATUS
Current InnoDB index space = 6 M
Current InnoDB data space = 17 M
Current InnoDB buffer pool free = 88 %
Current innodb_buffer_pool_size = 128 M
Depending on how much space your innodb indexes take up it may be safe
to increase this value to up to 2 / 3 of total system memory

MEMORY USAGE
Max Memory Ever Allocated : 294 M
Configured Max Per-thread Buffers : 419 M
Configured Max Global Buffers : 272 M
Configured Max Memory Limit : 691 M
Physical Memory : 487 M

Max memory limit exceeds 90% of physical memory

KEY BUFFER
Current MyISAM index space = 462 K
Current key_buffer_size = 128 M
Key cache miss rate is 1 : 81
Key buffer free ratio = 81 %
Your key_buffer_size seems to be fine

QUERY CACHE
Query cache is supported but not enabled
Perhaps you should set the query_cache_size                                                                                                                             

SORT OPERATIONS
Current sort_buffer_size = 2 M
Current read_rnd_buffer_size = 256 K
Sort buffer seems to be fine

JOINS
./tuning-primer.sh: line 402: export: `2097152': not a valid identifier
Current join_buffer_size = 132.00 K
You have had 0 queries where a join could not use an index properly
Your joins seem to be using indexes properly

OPEN FILES LIMIT
Current open_files_limit = 1024 files
The open_files_limit should typically be set to at least 2x-3x
that of table_cache if you have heavy MyISAM usage.                                                                                                                     
Your open_files_limit value seems to be fine

TABLE CACHE
Current table_open_cache = 400 tables
Current table_definition_cache = 400 tables
You have a total of 89 tables
You have 93 open tables.
The table_cache value seems to be fine

TEMP TABLES
Current max_heap_table_size = 16 M
Current tmp_table_size = 16 M
Of 559 temp tables, 6% were created on disk
Created disk tmp tables ratio seems fine

TABLE SCANS
Current read_buffer_size = 128 K
Current table scan ratio = 0 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 0 : 19444
Your table locking seems to be fine

MySQL Tuner

Per al MySQL Tuner necessitem una llibreria de Perl que haurem d'instal·lar, sinó l'script no podrà córrer.

yum install -y perl-Switch

Una vegada instal·lat, executarem l'script especificant que volem veure recomanacions, ja que per defecte només se'ns llistaran els paràmetres i els seus valors actuals, només. També haurem d'especificar un arxiu de configuració d'execució; jo he triat un default que ja ve:

perl mysqltuner.pl --recommend --config tuner-default.cnf
Uptime in seconds: 4479.00
Uptime: 1h 14m 39s
Questions: 22558.00
% slow queries: 0.00
slow query rate: 0.00 per day
Long query time: 10.00
Slow query logging: OFF
% reads: 94.77
% writes: 5.23
qps: 5.04
reads per sec: 18.28 per day
writes per sec: 1.01 per day
Queries: 5.04 per second
Connections: 560.00
Bytes sent: 98 Million
Bytes received: 4 Million
Supported Version: 5
Release Series: 5.5
Minor Version: 56
Distribution: MariaDB Server
Distribution: MariaDB Server
MySQL Architecture: x86_64
Query cache efficiency (%): 0.00
Use of uninitialized value $num in pattern match (m//) at mysqltuner.pl line
        223 (#1)
    (W uninitialized) An undefined value was used as if it were already
    defined.  It was interpreted as a "" or a 0, but maybe it was a mistake.
    To suppress this warning assign a defined value to your variables.
    
    To help you figure out what was undefined, perl will try to tell you
    the name of the variable (if any) that was undefined.  In some cases
    it cannot do this, so it also tells you what operation you used the
    undefined value in.  Note, however, that perl optimizes your program
    anid the operation displayed in the warning may not necessarily appear
    literally in your program.  For example, "that $foo" is usually
    optimized into "that " . $foo, and the warning will refer to the
    concatenation (.) operator, even though there is no . in
    your program.
    
Use of uninitialized value $compval in concatenation (.) or string at
        mysqltuner.pl line 230 (#1)
Use of uninitialized value in string eq at mysqltuner.pl line 231 (#1)
% query cache used: 
Query cache low memory prunes: 0.00 per day
Query cache size: 0 bytes
Query cache min result size: 1.0 Mb
Total sorts: 1.00
% sorts that cause temporary tables: 0.00
rate of sorts that cause temporary tables: 0.00 per day
sort_buffer_size: 2.0 Mb
read_rnd_buffer_size: 256.0 Kb
Sort rows: 16.88 per hour
rate of joins without indexes: 6.70 per minute
rate of reading first index entry: 1.46 per minute
rate of reading fixed position: 28.13 per hour
rate of reading next table row: 53.50 per minute
tmp_table_size-max_heap_table_size: 0.00
tmp_table_size: 16.0 Mb
max_heap_table_size: 16.0 Mb
% temp disk tables: 5.61
temp disk rate: 28.94 per hour
temp table rate: 8.12 per minute
MyISAM key buffer size: 128.0 Mb
max % MyISAM key buffer ever used: 0.22
% MyISAM key buffer used: 18.45
% index reads from memory: 99.12
table open cache size (5.1+): 400.00
rate of table open: 53.85 per hour
% open files: 5.18
rate of open files: 42.60 per hour
Immediate table locks %: 100.00
Table lock wait rate: 0.00 per day
thread cache: 0.00
Total threads created: 559.00
thread cache hit rate %: 1.00
Threads that are slow to launch: 0.00
Slow launch time: 2.00
% connections used: 5.30
Max connections used: 8.00
Max connections limit: 151.00
% aborted connections: 0.36
rate of aborted connections: 1.61 per hour
% aborted clients: 0.00
rate of aborted clients: 0.00 per day
Is InnoDB enabled?: YES
% innoDB log size: 3.91

Number found where operator expected at (eval 140) line 1, near "AUTOeq 0" (#2)
    (S syntax) The Perl lexer knows whether to expect a term or an operator.
    If it sees what it knows to be a term when it was expecting to see an
    operator, it gives you this warning.  Usually it indicates that an
    operator or delimiter was omitted, such as a semicolon.
    
        (Do you need to predeclare AUTOeq?)
MyISAM concurrent inserts: 


RECOMMENDATIONS:
Uptime is less than 1 day, performance tuning may not be accurate
long_query_time is set to 10 seconds or more.  This may not be appropriate for your environment.
Enable the slow query log to troubleshoot bad queries.
version less then 5.1, upgrade!
query cache not efficient, consider increasing query_cache_limit.
The query_cache is not turned on.  It may be useful to turn it on.
The max size of the result set in the query cache is the default of 1 Mb.  Changing this (usually by increasing) may increase efficiency.
There are too many joins without indexes -- this means that joins are doing full table scans.
The rate of reading the first index entry is high; this usually indicates frequent full index scans.
The rate of reading the next table row is high; this indicates many queries are doing full table scans.
Too many intermediate temporary tables are being created; consider increasing sort_buffer_size (sorting), read_rnd_buffer_size (random read buffer, ie, post-sort), read_buffer_size (sequential scan).
MyISAM key buffer (index cache) % used is low.  You may need to decrease the size of key_buffer_size, re-examine your tables to see if indexes have been removed, or examine queries and expectations about what indexes are being used.
MyISAM key buffer (index cache) % used is low.  You may need to decrease the size of key_buffer_size, re-examine your tables to see if indexes have been removed, or examine queries and expectations about what indexes are being used.
Size of the table cache
Enable the thread cache by setting thread_cache_size>0 for less overhead from new connections to MySQL.
InnoDB log file size is not an appropriate size, in relation to the InnoDB buffer pool.  Consider changing either\ninnodb_log_file_size or innodb_buffer_pool_size

Percona Toolkit

El descarregarem de la seva pàgina i instal·larem l'rpm o bé podem optar per una solució "portable" i desempaquetar un tar i executar-ne els scripts de dins. A la seva [documentació https://www.percona.com/doc/percona-toolkit/LATEST/index.html] s'hi detallen les diverses eines que tenim disponibles. N'hi ha moltes, però la que m'ha cridat l'atenció ha sigut la pt-mysql-summary que ens permet veure sobretot, en comptes d'optimitzar com a tal, els paràmetres que tenim configurats pel SGBD en aquell moment. Un exemple de sortida seria el següent:

# Percona Toolkit MySQL Summary Report #######################
              System time | 2018-05-24 15:24:07 UTC (local TZ: CEST +0200)
# Instances ##################################################
  Port  Data Directory             Nice OOM Socket
  ===== ========================== ==== === ======
                                   0    0   
        /home/guillem/.local/share/akonadi/db_data/ 0    0   /tmp/akonadi-guillem.8z3Bop/mysql.socket
# MySQL Executable ###########################################
       Path to executable | /usr/libexec/mysqld
              Has symbols | Yes
# Slave Hosts ################################################
No slaves found
# Report On Port 3306 ########################################
                     User | root@%
                     Time | 2018-05-24 17:24:07 (CEST)
                 Hostname | mediawiki.virtual
                  Version | 5.5.56-MariaDB MariaDB Server
                 Built On | Linux x86_64
                  Started | 2018-05-24 15:03 (up 0+02:21:02)
                Databases | 4
                  Datadir | /var/lib/mysql/
                Processes | 1 connected, 1 running
              Replication | Is not a slave, has 0 slaves connected
                  Pidfile | /var/run/mariadb/mariadb.pid (exists)
# Processlist ################################################

  Command                        COUNT(*) Working SUM(Time) MAX(Time)
  ------------------------------ -------- ------- --------- ---------
  Query                                 1       1         0         0

  User                           COUNT(*) Working SUM(Time) MAX(Time)
  ------------------------------ -------- ------- --------- ---------
  root                                  1       1         0         0

  Host                           COUNT(*) Working SUM(Time) MAX(Time)
  ------------------------------ -------- ------- --------- ---------
  192.168.56.1                          1       1         0         0

  db                             COUNT(*) Working SUM(Time) MAX(Time)
  ------------------------------ -------- ------- --------- ---------
  NULL                                  1       1         0         0

  State                          COUNT(*) Working SUM(Time) MAX(Time)
  ------------------------------ -------- ------- --------- ---------
  NULL                                  1       1         0         0

# Status Counters (Wait 10 Seconds) ##########################
Variable                                Per day  Per second     11 secs
Aborted_connects                             40                        
Access_denied_errors                         40                        
Aria_pagecache_blocks_unused             150000           1            
Aria_pagecache_blocks_used                  100                        
Aria_pagecache_read_requests               6000                        
Aria_pagecache_reads                        250                        
Aria_pagecache_write_requests               450                        
Bytes_received                        125000000        1250         200
Bytes_sent                           4500000000       50000        2250
Com_admin_commands                           30                        
Com_begin                                 22500                        
Com_change_db                             22500                        
Com_commit                                17500                        
Com_delete                                 7000                        
Com_insert                                 1500                        
Com_lock_tables                              10                        
Com_replace                               15000                        
Com_select                               500000           6            
Com_set_option                            25000                        
Com_show_binlogs                             20                        
Com_show_create_db                           10                        
Com_show_create_table                       500                        
Com_show_databases                           20                        
Com_show_engine_status                       20                        
Com_show_fields                             500                        
Com_show_master_status                       20                        
Com_show_plugins                             20                        
Com_show_processlist                         20                        
Com_show_slave_hosts                         20                        
Com_show_slave_status                        20                        
Com_show_status                             600                        
Com_show_storage_engines                     10                        
Com_show_table_status                       500                        
Com_show_tables                              10                        
Com_show_triggers                           500                        
Com_show_variables                        15000                        
Com_unlock_tables                            10                        
Com_update                                 1500                        
Connections                               25000                       1
Created_tmp_disk_tables                    1750                        
Created_tmp_files                            60                        
Created_tmp_tables                        20000                        
Empty_queries                             80000                        
Feature_subquery                             60                        
Feature_timezone                             10                        
Flush_commands                               20                        
Handler_commit                           600000           6            
Handler_delete                             8000                        
Handler_icp_attempts                     400000           4            
Handler_icp_match                        400000           4            
Handler_read_first                         5000                        
Handler_read_key                         600000           7            
Handler_read_next                         70000                        
Handler_read_prev                          6000                        
Handler_read_rnd                           8000                        
Handler_read_rnd_next                    350000           3          40
Handler_rollback                           4000                        
Handler_tmp_update                          150                        
Handler_tmp_write                         80000                      40
Handler_update                             9000                        
Handler_write                             17500                        
Innodb_adaptive_hash_cells              3000000          35            
Innodb_adaptive_hash_hash_searches       450000           5            
Innodb_adaptive_hash_heap_buffers           100                        
Innodb_adaptive_hash_non_hash_searches     3000000          35            
Innodb_background_log_sync                50000                       1
Innodb_buffer_pool_bytes_data         250000000        3000            
Innodb_buffer_pool_pages_flushed          60000                        
Innodb_buffer_pool_pages_old               6000                        
Innodb_buffer_pool_read_requests       10000000         125            
Innodb_buffer_pool_reads                  15000                        
Innodb_buffer_pool_write_requests        200000           2            
Innodb_checkpoint_max_age              80000000         900            
Innodb_checkpoint_target_age           80000000         900            
Innodb_data_fsyncs                        30000                        
Innodb_data_read                      300000000        3500            
Innodb_data_reads                         17500                        
Innodb_data_writes                        90000           1            
Innodb_data_written                  2000000000       25000            
Innodb_dblwr_pages_written                60000                        
Innodb_dblwr_writes                        1500                        
Innodb_descriptors_memory                 80000                        
Innodb_dict_tables                          600                        
Innodb_history_list_length                20000                        
Innodb_ibuf_free_list                        50                        
Innodb_ibuf_merged_inserts                   50                        
Innodb_ibuf_merges                           50                        
Innodb_ibuf_segment_size                     70                        
Innodb_ibuf_size                             10                        
Innodb_log_write_requests                 50000                        
Innodb_log_writes                         25000                        
Innodb_lsn_current                   2000000000       22500            
Innodb_lsn_flushed                   2000000000       22500            
Innodb_lsn_last_checkpoint           2000000000       22500            
Innodb_master_thread_1_second_loops       15000                        
Innodb_master_thread_10_second_loops        1250                        
Innodb_master_thread_background_loops        1000                        
Innodb_master_thread_main_flush_loops        1000                        
Innodb_master_thread_sleeps               15000                        
Innodb_max_trx_id                       5000000          60            
Innodb_mem_adaptive_hash               25000000         300            
Innodb_mem_dictionary                  10000000         125            
Innodb_mem_total                     1500000000       17500            
Innodb_mutex_os_waits                       500                        
Innodb_mutex_spin_rounds                  17500                        
Innodb_mutex_spin_waits                     600                        
Innodb_oldest_view_low_limit_trx_id     5000000          60            
Innodb_os_log_fsyncs                      30000                        
Innodb_os_log_written                  35000000         400            
Innodb_pages_created                        800                        
Innodb_pages_read                         15000                        
Innodb_pages_written                      60000                        
Innodb_purge_trx_id                     5000000          60            
Innodb_read_views_memory                   2000                        
Innodb_row_lock_time                      30000                        
Innodb_row_lock_waits                        30                        
Innodb_rows_deleted                        8000                        
Innodb_rows_inserted                       9000                        
Innodb_rows_read                         800000           9            
Innodb_rows_updated                        9000                        
Innodb_s_lock_os_waits                     1500                        
Innodb_s_lock_spin_rounds                 45000                        
Innodb_s_lock_spin_waits                   1500                        
Innodb_x_lock_os_waits                      125                        
Innodb_x_lock_spin_rounds                  5000                        
Innodb_x_lock_spin_waits                     60                        
Key_read_requests                        600000           6            
Key_reads                                  3000                        
Key_write_requests                       175000           2            
Key_writes                                40000                        
Open_table_definitions                      900                        
Opened_files                               8000                        
Opened_table_definitions                    600                        
Opened_tables                              1750                        
Queries                                  700000           8           3
Questions                                700000           8           3
Rows_read                                800000           9            
Rows_sent                                800000           9          40
Rows_tmp_read                             90000           1          40
Select_range                               8000                        
Select_scan                               22500                        
Sort_range                                  175                        
Sort_rows                                  8000                        
Sort_scan                                   250                        
Syncs                                        20                        
Table_locks_immediate                    600000           6            
Threads_created                           25000                       1
Uptime                                    90000           1           1
# Table cache ################################################
                     Size | 400
                    Usage | 50%
# Key Percona Server features ################################
      Table & Index Stats | Disabled
     Multiple I/O Threads | Enabled
     Corruption Resilient | Enabled
      Durable Replication | Disabled
     Import InnoDB Tables | Disabled
     Fast Server Restarts | Disabled
         Enhanced Logging | Disabled
     Replica Perf Logging | Not Supported
      Response Time Hist. | Not Supported
          Smooth Flushing | Enabled
      HandlerSocket NoSQL | Not Supported
           Fast Hash UDFs | Unknown
# Percona XtraDB Cluster #####################################
# Plugins ####################################################
       InnoDB compression | ACTIVE
# Query cache ################################################
         query_cache_type | ON
                     Size | 0.0
                    Usage | 0%
         HitToInsertRatio | 0%
# Schema #####################################################
Specify --databases or --all-databases to dump and summarize schemas
# Noteworthy Technologies ####################################
                      SSL | No
     Explicit LOCK TABLES | Yes
           Delayed Insert | No
          XA Transactions | No
              NDB Cluster | No
      Prepared Statements | No
 Prepared statement count | 0
# InnoDB #####################################################
                  Version | 5.5.52-MariaDB-38.3
         Buffer Pool Size | 128.0M
         Buffer Pool Fill | 20%
        Buffer Pool Dirty | 0%
           File Per Table | OFF
                Page Size | 16k
            Log File Size | 2 * 5.0M = 10.0M
          Log Buffer Size | 8M
             Flush Method | 
      Flush Log At Commit | 1
               XA Support | ON
                Checksums | ON
              Doublewrite | ON
          R/W I/O Threads | 4 4
             I/O Capacity | 200
       Thread Concurrency | 0
      Concurrency Tickets | 500
       Commit Concurrency | 0
      Txn Isolation Level | REPEATABLE-READ
        Adaptive Flushing | ON
      Adaptive Checkpoint | 
           Checkpoint Age | 0
             InnoDB Queue | 0 queries inside InnoDB, 0 queries in queue
       Oldest Transaction | 0 Seconds
         History List Len | 2056
               Read Views | 1
         Undo Log Entries | 0 transactions, 0 total undo, 0 max undo
        Pending I/O Reads | 0 buf pool reads, 0 normal AIO, 0 ibuf AIO, 0 preads
       Pending I/O Writes | 0 buf pool (0 LRU, 0 flush list, 0 page); 0 AIO, 0 sync, 0 log IO (0 log, 0 chkp); 0 pwrites
      Pending I/O Flushes | 0 buf pool, 0 log
       Transaction States | 1xnot started
# MyISAM #####################################################
                Key Cache | 128.0M
                 Pct Used | 20%
                Unflushed | 0%
# Security ###################################################
                    Users | 3 users, 0 anon, 0 w/o pw, 0 old pw
            Old Passwords | OFF
# Encryption #################################################
No keyring plugins found
# Binary Logging #############################################
# Noteworthy Variables #######################################
     Auto-Inc Incr/Offset | 1/1
   default_storage_engine | InnoDB
               flush_time | 0
             init_connect | 
                init_file | 
                 sql_mode | 
         join_buffer_size | 128k
         sort_buffer_size | 2M
         read_buffer_size | 128k
     read_rnd_buffer_size | 256k
       bulk_insert_buffer | 0.00
      max_heap_table_size | 16M
           tmp_table_size | 16M
       max_allowed_packet | 1M
             thread_stack | 288k
                      log | OFF
                log_error | /var/log/mariadb/mariadb.log
             log_warnings | 1
         log_slow_queries | OFF
log_queries_not_using_indexes | OFF
        log_slave_updates | OFF
# Configuration File #########################################
              Config File | /etc/my.cnf

[client-server]

[mysqld]
symbolic-links                      = 0
# Memory management library ##################################
grep: /proc/1162/environ: Permission denied
jemalloc is not enabled in mysql config for process with id 1162
grep: /proc/1162/environ: Permission denied
jemalloc is not enabled in mysql config for process with id 1162
# The End ####################################################

Aquest script, com he dit abans, ens permet llistar paràmetres referents al MariaDB que està corrent a la meva màquina que allotja la MediaWiki. L'avantatge és que es llista de manera "llegible" per una persona i permet fer un diagnòstic si veiessim, per exemple, que aquell servidor no tira bé o dóna problemes.

Conclusions

Aquests scripts els he executat sobre la màquina virtual on hi tinc la Mediawiki funcionant, perquè no tenia gaire sentit fer-ho a la màquina on he instal·lat el Moodle en les pràctiques anteriors. Això ho he fet pensant que seria interessant veure el resultat d'aquests scripts en un SGBD que hagi estat corrent (interrompudament) durant un període de temps llarg i que hagi tingut activitat; tot i això, no han sortit paràmetres estranys ni mal configurats segons els scripts. Com a molt es pot veure que el Tuning Primer notifica un paràmetre referent a la memòria:

(...)
MEMORY USAGE
Max Memory Ever Allocated : 294 M
Configured Max Per-thread Buffers : 419 M
Configured Max Global Buffers : 272 M
Configured Max Memory Limit : 691 M
Physical Memory : 487 M
 
Max memory limit exceeds 90% of physical memory
(...)

Veiem que la memòria màxima configurada és igual a 691 MB, mentre que la memòria física que té la màquina és de 487 MB. Llavors l'avís és que el lñimit màxim de memòria és superior al 90% de la memòria RAM de la màquina. Aquest paràmetre es devia quedar així al moment de la instal·lació perquè en aquell moment la màquina tenia 1 GB de RAM però vaig creure convenient reduir recursos perquè no és una màquina que demani molta potència ni molta memòria per a mantenir la Mediawiki corrent; i per això actualment té 512 MB assignats. Això fa incoherent que el valor màxim de memòria que pot utilitzar el servidor sigui superior a la memòria disponible i s'hauria d'ajustar. Veient que la memòria màxima alocada per al servidor ha sigut d'aproximadament 300 MB, i tenint 487 MB en total podria modificar aquest paràmetre i deixar-lo en un terme mig de 350 MB.