2

I am running a 24 GB KVM with 8 Xeon 3.2 SSD RAID 0. And I would like to get the most from my MariaDB sql server.

I am using following my.cfg

#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
[client]
# hostname                                      = panel.uhlhosting.ch
#default-character-set                          = utf8mb4

[mysqld]
max_allowed_packet=268435456
max_connect_errors                              = 10
max_connections                                 = 50
#safe-show-database
#skip-innodb
#skip-locking
skip-networking


open_files_limit                                = 25000
local-infile                                    = 0
performance_schema                              = OFF

# Enable logs
general-log                                     = ON

explicit_defaults_for_timestamp = true

# Character collation
#character_set_server                           = utf8mb4
#collation_server                               = utf8mb4_unicode_ci

bulk_insert_buffer_size                         = 8M
connect_timeout                                 = 10
interactive_timeout                             = 50


query_cache_type                                = 1
query_cache_limit                               = M
query_cache_min_res_unit                        = 2k
query_cache_size                                = 0

table_open_cache                                = 2048

#ft_min_word_len                                = 2

# Skip reverse DNS lookup of clients
# skip-name-resolve

thread_stack                                    = 256K

transaction_isolation                           = REPEATABLE-READ

read_buffer_size                                = 2M
read_rnd_buffer_size                            = 16M
sort_buffer_size                                = 8M
table_cache                                     = 4096
join_buffer_size                                = 2M
key_buffer_size                                 = 256M

max_allowed_packet                              = 16M
read_buffer_size                                = 2M

bulk_insert_buffer_size                         = 64M
default-storage-engine                          = MYISAM
myisam_recover_options                          = BACKUP,FORCE
myisam_sort_buffer_size                         = 128M
myisam_max_sort_file_size                       = 5G
myisam_repair_threads                           = 4
myisam-recover-options

thread_cache_size                               = 1024
thread_concurrency                              = 8

max_heap_table_size                             = 64M
tmp_table_size                                  = 64M
wait_timeout                                    = 200

innodb_large_prefix                             = true
innodb_file_format                              = barracuda
innodb_file_format_max                          = barracuda
innodb_file_per_table                           = true
innodb_file_per_table                           = 1
innodb_buffer_pool_size                         = 3G
innodb_buffer_pool_instances                    = 8
innodb_flush_method                             = O_DIRECT
innodb_io_capacity                              = 100
innodb_read_io_threads                          = 8
innodb_thread_concurrency                       = 16
innodb_write_io_threads                         = 8
innodb_log_file_size                            = 256M
innodb_fast_shutdown                            = 1
innodb_additional_mem_pool_size                 = 16M
innodb_data_file_path                           = ibdata1:10M:autoextend
innodb_flush_log_at_trx_commit                  = 1
innodb_log_buffer_size                          = 8M
innodb_log_files_in_group                       = 3
innodb_max_dirty_pages_pct                      = 90
innodb_lock_wait_timeout                        = 120

log-queries-not-using-indexes   = 1

# Error log
#err-log                                        = /var/log/mysql/error.log
binlog_cache_size                               = 1M

# Slow Query Log
slow_query_log_file                             = /var/log/mysql/slow.log
long_query_time                                 = 5


# General Log
general_log_file                                = /var/log/mysql/general.log

[mysqld_safe]
nice                                            = -5
open_files_limit                                = 8192

[myisamchk]
key_buffer_size                                 = 256M
sort_buffer_size                                = 256M
read_buffer                                     = 16M
write_buffer                                    = 16M

[mysqldump]
# Do not buffer the whole result set in memory before writing it to
# file. Required for dumping very large tables
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash

# Only allow UPDATEs and DELETEs that use keys.
#safe-updates

I got this from from mysqlreport:

MariaDB 10.1.12-MariaDB     uptime 0 0:5:20     Fri Mar 11 15:33:00 2016

__ Key _________________________________________________________________
Buffer used   897.00k of  256.00M   %Used:   0.34
  Current      47.57M              %Usage:  18.58
Write hit      14.81%
Read hit       98.43%

__ Questions ___________________________________________________________
Total           3.24k      10.1/s
  DMS           3.05k       9.5/s  %Total:  94.29
  Com_            135       0.4/s            4.17
  COM_QUIT         51       0.2/s            1.57
  -Unknown          1       0.0/s            0.03
Slow 5 s            0         0/s            0.00  %DMS:   0.00 Log:
DMS             3.05k       9.5/s           94.29
  SELECT        3.00k       9.4/s           92.56         98.17
  INSERT           32       0.1/s            0.99          1.05
  UPDATE           13       0.0/s            0.40          0.43
  DELETE            9       0.0/s            0.28          0.29
  REPLACE           2       0.0/s            0.06          0.07
Com_              135       0.4/s            4.17
  set_option       83       0.3/s            2.56
  change_db        23       0.1/s            0.71
  show_fields      21       0.1/s            0.65

__ Rows ________________________________________________________________
Rows          781.09k      2.4k/s
  Using idx   224.56k     701.7/s  %Index:  28.75
Rows/question  241.15

__ SELECT and Sort _____________________________________________________
Scan              232       0.7/s %SELECT:   7.74
Range             325       1.0/s           10.84
Full join          22       0.1/s            0.73
Range check         0         0/s            0.00
Full rng join       1       0.0/s            0.03
Sort scan         476       1.5/s
Sort range        382       1.2/s
Sort mrg pass       0         0/s

__ Table Locks _________________________________________________________
Waited              0         0/s  %Total:   0.00
Immediate       4.12k      12.9/s

__ Tables ______________________________________________________________
Open              127 of   4096    %Cache:   3.10
Opened            116       0.4/s

__ Connections _________________________________________________________
Max used            3 of     50      %Max:   6.00
Total              53       0.2/s

__ Created Temp ________________________________________________________
Disk table        222       0.7/s   %Disk:  51.39
Table             432       1.4/s    Size:  64.0M
File                6       0.0/s

__ Threads _____________________________________________________________
Running             1 of      1
Created             3       0.0/s
Slow                0         0/s
Cached              2 of     50      %Hit:  94.34

__ Aborted _____________________________________________________________
Clients             0         0/s
Connects            0         0/s

__ Bytes _______________________________________________________________
Sent           13.73M     42.9k/s
Received      802.94k      2.5k/s

__ InnoDB Buffer Pool __________________________________________________
Usage          30.67M of    3.00G  %Usage:   1.00
Read hit       99.66%
Pages
  Free        194.64k              %Total:  99.00
  Data          1.90k                        0.96  %Drty:   0.00
  Misc             68                        0.03
  Latched           0                        0.00
Reads         476.66k      1.5k/s
  From disk     1.63k       5.1/s   %Disk:   0.34
  Ahead Rnd         0         0/s
Writes            384       1.2/s
Wait Free           0         0/s   %Wait:   0.00
Flushes           131       0.4/s
  LRU               0         0/s  %Flush:   0.00

__ InnoDB Lock _________________________________________________________
Waits               0         0/s
Current             0
Time acquiring
  Total             0 ms
  Average           0 ms
  Max               0 ms
Trx history        664

__ InnoDB Data, Pages, Rows ____________________________________________
Data
  Reads         2.45k       7.6/s
  Writes          206       0.6/s
  fsync           104       0.3/s
  Pending
    Reads           0
    Writes          0
    fsync           0

Pages
  Created           8       0.0/s
  Read          1.89k       5.9/s
  Written         131       0.4/s

Rows
  Deleted           8       0.0/s
  Inserted         12       0.0/s
  Read        378.27k      1.2k/s
  Updated           8       0.0/s

__ Aria Pagecache ______________________________________________________
Buffer used    40.00k of  128.00M   %Used:   0.03
  Current       5.30M              %Usage:   4.14
Write hit     100.00%
Read hit       98.17%

Here is my mysqltunnerl.pl report:

root@panel [~/uhlhosting/mysql]# ./mysqltuner.pl
 >>  MySQLTuner 1.5.1 - Major Hayden <major@mhtx.net>
 >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/
 >>  Modified by George Liu (eva2000) at http://vbtechsupport.com/
 >>  Run with '--help' for additional options and output filtering
[OK] Currently running supported MySQL version 10.1.12-MariaDB
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Aria +CSV +InnoDB +MRG_MyISAM +SEQUENCE
[--] Data in MyISAM tables: 92M (Tables: 257)
[--] Data in InnoDB tables: 108M (Tables: 481)
[!!] Total fragmented tables: 21

-------- Security Recommendations  -------------------------------------------
[OK] There is no anonymous account in all database users
[OK] All database users have passwords assigned
[--] There is 605 basic passwords in the list.

-------- Performance Metrics -------------------------------------------------
[--] Up for: 6m 20s (4K q [10.624 qps], 65 conn, TX: 18M, RX: 937K)
[--] Reads / Writes: 98% / 2%
[--] Binary logging is disabled
[--] Total buffers: 3.5G global + 28.2M per thread (50 max threads)
[OK] Maximum reached memory usage: 3.5G (15.15% of installed RAM)
[OK] Maximum possible memory usage: 4.8G (20.70% of installed RAM)
[OK] Slow queries: 0% (0/4K)
[OK] Highest usage of available connections: 6% (3/50)
[OK] Aborted connections: 0.00%  (0/65)
[!!] Query cache is disabled
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 973 sorts)
[!!] Joins performed without indexes: 22
[!!] Temporary tables created on disk: 52% (245 on disk / 467 total)
[OK] Thread cache hit rate: 95% (3 created / 65 connections)
[OK] Table cache hit rate: 107% (151 open / 140 opened)
[OK] Open file limit used: 1% (121/10K)
[OK] Table locks acquired immediately: 100% (5K immediate / 5K locks)

-------- MyISAM Metrics -----------------------------------------------------
[!!] Key buffer used: 18.7% (50M used / 268M cache)
[OK] Key buffer size / total MyISAM indexes: 256.0M/18.3M
[OK] Read Key buffer hit rate: 98.9% (109K cached / 1K reads)
[!!] Write Key buffer hit rate: 14.1% (85 cached / 73 writes)

-------- InnoDB Metrics -----------------------------------------------------
[--] InnoDB is enabled.
[OK] InnoDB buffer pool / data size: 3.0G/108.6M
[!!] InnoDB buffer pool instances: 8
[!!] InnoDB Used buffer: 1.07% (2107 used/ 196600 total)
[OK] InnoDB Read buffer efficiency: 99.64% (492623 hits/ 494395 total)
[!!] InnoDB Write buffer efficiency: 0.00% (0 hits/ 1 total)
[OK] InnoDB log waits: 0.00% (0 waits / 44 writes)

-------- AriaDB Metrics -----------------------------------------------------
[--] AriaDB is disabled.

-------- Replication Metrics -------------------------------------------------
[--] No replication slave(s) for this server.
[--] This is a standalone server..

-------- Recommendations -----------------------------------------------------
General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    MySQL started within last 24 hours - recommendations may be inaccurate
    Adjust your join queries to always utilize indexes. Please note this
    calculation is made by adding Select_full_join + Select_range_check
    status values and triggered when the total >250
    When making adjustments, make tmp_table_size/max_heap_table_size equal
    Reduce your SELECT DISTINCT queries without LIMIT clauses
Variables to adjust:
    query_cache_size (>= 8M)
    join_buffer_size (> 2.0M, or always use indexes with joins)
    tmp_table_size (> 64M)
    max_heap_table_size (> 64M)
    innodb_buffer_pool_instances(=3)
root@panel [~/uhlhosting/mysql]#

And last tunningprimer report:

MySQL Version 10.1.12-MariaDB x86_64

Uptime = 0 days 0 hrs 7 min 15 sec
Avg. qps = 25
Total Questions = 10953
Threads Connected = 2

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/10.1/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 = 5.000000 sec.
You have 0 out of 10974 that take longer than 5.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/10.1/en/point-in-time-recovery.html

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

MAX CONNECTIONS
Current max_connections = 50
Current threads_connected = 2
Historic max_used_connections = 3
The number of used connections is 6% 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

No InnoDB Support Enabled!

MEMORY USAGE
Max Memory Ever Allocated : 3.35 G
Configured Max Per-thread Buffers : 1.37 G
Configured Max Global Buffers : 3.27 G
Configured Max Memory Limit : 4.65 G
Physical Memory : 23.38 G
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 18 M
Current key_buffer_size = 256 M
Key cache miss rate is 1 : 90
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 = 8 M
Current read_rnd_buffer_size = 16 M
Sort buffer seems to be fine

JOINS
./tuning-primer.sh: line 402: export: `2097152': not a valid identifier
Current join_buffer_size = 2.00 M
You have had 26 queries where a join could not use an index properly
You should enable "log-queries-not-using-indexes"
Then look for non indexed joins in the slow query log.
If you are unable to optimize your queries you may want to increase your
join_buffer_size to accommodate larger joins in one pass.

Note! This script will still suggest raising the join_buffer_size when
ANY joins not using indexes are found.

OPEN FILES LIMIT
Current open_files_limit = 10000 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 = 4096 tables
Current table_definition_cache = 400 tables
You have a total of 820 tables
You have 842 open tables.
The table_cache value seems to be fine
You should probably increase your table_definition_cache value.

TEMP TABLES
Current max_heap_table_size = 64 M
Current tmp_table_size = 64 M
Of 1035 temp tables, 28% were created on disk
Perhaps you should increase your tmp_table_size and/or max_heap_table_size
to reduce the number of disk-based temporary tables
Note! BLOB and TEXT columns are not allow in memory tables.
If you are using these columns raising these values might not impact your
ratio of on disk temp tables.

TABLE SCANS
Current read_buffer_size = 2 M
Current table scan ratio = 91 : 1
read_buffer_size seems to be fine

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

Any help, guidance would be really at use.

Regards C.

2

Executive summary: You have a relatively idle system, with very little data. No worries yet. Use the slowlog to watch for problems.

Details

long_query_time -- set to 1 and watch the slowlog.

Do not enable log-queries-not-using-indexes, it just clutters the slowlog with (a) queries with tiny tables, or (b) queries that would show up anyway with a smaller long_query_time.

You have a lot of cruft (duplicate rows, etc) in my.cnf.

thread_cache_size -- 10 is a reasonable setting, not 1024

Some cache settings are low for your 24GB of RAM, but you don't have much data.

Sounds like you are missing some indexes. When they show up in the slowlog, you can address them -- by reformulating the queries and/or adding composite indexes.

"fragmentation" -- bogus, ignore it. Do not run OPTIMIZE TABLE.

"Query cache is disabled" -- that is good for production systems.

Mixture of InnoDB and MyISAM -- consider moving entirely to InnoDB.

"Uptime = 0 days 0 hrs 7 min 15 sec" -- You should run the system for at least a day before running such tools.

Since you have raided SSDs, increase the innodb...io_capacity significantly.

Do not worry about tmp_table_size until you determine whether the tmp table would spill to disk for other reasons (such as selecting a TEXT column).

6
  • is there a way to move all DB's at once to innoDB? – Uhl Hosting Mar 13 '16 at 12:10
  • Sorry, no. ALTER TABLE foo ENGINE=InnoDB; Recommend you review my blog on conversion to check for gotchas. You could write a single SELECT ... FROM information_schema.TABLES ... that would generate all the ALTERs. – Rick James Mar 14 '16 at 0:10
  • OK, I added the SELECT to my blog – Rick James Mar 14 '16 at 0:22
  • Oh, that blog needed some refreshing; did that, too. – Rick James Mar 14 '16 at 0:57
  • So in my case with 30 DB's what would be a final cmd in mysql? to migrate them all safe to innodb? – Uhl Hosting Mar 14 '16 at 1:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.