2016-09-08 4 views
1

Ich habe MariaDB (10.0.20) auf der Maschine mit 256 GB RAM installiert. Die Speicherbelegung wächst den ganzen Tag bis zu 100%, bis sie neu gestartet wird. Nach einigen Neustarts nimmt die Speicherbelegung auf 70% zu - aber in einigen Stunden beginnt sie erneut zu wachsen.MySQL Speicherverbrauch wächst bis zu 100%

Was ist das Problem mit meinem Server oder Konfiguration?

Red line - memory. Falling to 0% - reboots

MySQLTuner Info:

-------- Performance Metrics ----------------------------------------------------------------------- 
[--] Up for: 4h 50m 27s (28M q [1K qps], 305K conn, TX: 157G, RX: 29G) 
[--] Reads/Writes: 14%/86% 
[--] Binary logging is disabled 
[--] Physical Memory  : 251.6G 
[--] Max MySQL memory : 197.1G 
[--] Other process memory: 1.5G 
[--] Total buffers: 182.9G global + 48.5M per thread (300 max threads) 
[--] P_S Max memory usage: 0B 
[--] Galera GCache Max memory usage: 0B 
[OK] Maximum reached memory usage: 187.3G (74.44% of installed RAM) 
[OK] Maximum possible memory usage: 197.1G (78.34% of installed RAM) 
[OK] Overall possible memory usage with other process is compatible with memory available 
[OK] Slow queries: 0% (3/28M) 
[OK] Highest usage of available connections: 31% (93/300) 
[OK] Aborted connections: 0.00% (1/305591) 
[OK] Query cache is disabled by default due to mutex contention on multiprocessor machines. 
[OK] Sorts requiring temporary tables: 0% (1K temp sorts/339K sorts) 
[!!] Joins performed without indexes: 187 
[!!] Temporary tables created on disk: 61% (170K on disk/278K total) 
[OK] Thread cache hit rate: 99% (93 created/305K connections) 
[OK] Table cache hit rate: 110% (693 open/630 opened) 
[OK] Open file limit used: 0% (63/8K) 
[OK] Table locks acquired immediately: 100% (26M immediate/26M locks) 

-------- InnoDB Metrics ---------------------------------------------------------------------------- 
[--] InnoDB is enabled. 
[!!] InnoDB buffer pool/data size: 180.0G/304.6G 
[OK] InnoDB buffer pool instances: 64 
[--] InnoDB Buffer Pool Chunk Size not used or defined in your version 
[OK] InnoDB Read buffer efficiency: 99.98% (55901943340 hits/ 55911688878 total) 
[OK] InnoDB Write log efficiency: 92.03% (161171609 hits/ 175129277 total) 
[OK] InnoDB log waits: 0.00% (0 waits/13957668 writes) 

my.cnf:

[mysqld] 
#pid-file = /var/run/mysqld/mysqld.pid 
datadir=/var/lib/mysql 
socket=/var/lib/mysql/mysql.sock 
skip-name-resolve 
# Disabling symbolic-links is recommended to prevent assorted security risks 
symbolic-links=0 

ft_min_word_len   = 3 

## Cache 
thread-cache-size    = 128 
table-open-cache    = 1024 
table-definition-cache   = 1024 
query-cache-size    = 768M 
query-cache-limit    = 2048M 
query-cache-type   = 0 

## Per-thread Buffers 
sort-buffer-size    = 16M 
read-buffer-size    = 256K 
read-rnd-buffer-size   = 16M 
join-buffer-size    = 16M 

## Temp Tables 
tmp-table-size     = 2G 
max-heap-table-size    = 2G 

## Networking 
back-log      = 300 
open-files-limit  = 8192 
open-files   = 1024 
max-connections     = 300 
max-connect-errors    = 100 
concurrent-insert  = 2 
max-allowed-packet    = 512M 
interactive-timeout    = 30 
wait-timeout     = 30 

### Storage Engines 
#default-storage-engine   = InnoDB 
innodb       = FORCE 

## MyISAM 
key-buffer-size     = 10M 
key_buffer_size     = 10M 
myisam-sort-buffer-size   = 128M 
myisam-max-sort-file-size = 256M 

## InnoDB 
innodb-buffer-pool-size   = 160G 
innodb_buffer_pool_size   = 160G 
innodb_buffer_pool_instances   = 150 
innodb-buffer-pool-instances   = 150 
innodb-log-buffer-size   = 32M 
innodb-log-file-size   = 1512M 
innodb-file-per-table   = 1 
#innodb-open-files    = 300 
innodb-flush-method  = O_DIRECT 
innodb-autoinc-lock-mode = 0 
#innodb_max_dirty_pages_pct  = 0 
#innodb-max-dirty-pages-pct  = 0 
#innodb_io_capacity = 2000 
#innodb-io-capacity = 2000 
#innodb_read_io_threads = 64 
#innodb_write_io_threads = 64 
#innodb-read-io-threads = 64 
#innodb-write-io-threads = 64 


#server_audit_logging=ON 
#server_audit_events=connect 

## Logging 
log-output      = FILE 
slow-query-log     = 1 
slow-query-log-file    = /var/log/mariadb/slow-log.log 
long-query-time     = 200 
max-binlog-size   = 256M 

[mysqld_safe] 
log-error=/var/log/mariadb/mariadb.log 
pid-file=/var/run/mariadb/mariadb2.pid 

# 
# include all files from the config directory 
# 
!includedir /etc/my.cnf.d 
+0

Haben Sie Ihre Prozesse auf Ausreißer überprüft? 'SHOW PROCESSLIST;' –

+0

Ja, die Liste enthält nur aktuelle Kurzzeitabfragen – user1964654

Antwort

1

Sie haben einige Doppel Referenzen wie:

innodb-buffer-pool-size   = 160G 

innodb_buffer_pool_size   = 160G 

denke ich nur die ‚- ' auf es sind gültig.

Überprüfen Sie auch Ihre wait_timeout Paramenter mit:

mysql> show variables like 'innodb_lock_wait_timeout'; 
+0

innodb_lock_wait_timeout = 50 – user1964654

+0

Beide Varianten sind gültig, Bindestriche und Unterstriche haben in den Konfigurationsvariablennamen die gleiche Bedeutung. Wenn ein Parameter mehr als einmal gegeben wird, gewinnt der letzte. –

1
thread-cache-size    = 128 -- drop to 30 
query-cache-size    = 768M -- bad for performance, drop to 50M 
query-cache-limit    = 2048M -- make less than the query_cache_size 
query-cache-type   = 0 -- good 
tmp-table-size   = 2G -- drop to 1G 
max-heap-table-size  = 2G -- drop to 1G 
max-connections   = 300 -- drop to 150 
innodb_buffer_pool_size = 160G -- good 
innodb_buffer_pool_instances = 150 -- lower to 32 
slow-query-log   = 1 -- good 
long-query-time   = 200 -- slow log is useless unless this is low enough, say =2 

The slowlog wird Ihnen helfen „[!!] Temporäre Tabellen auf der Festplatte erstellt (nachdem Sie long_query_time geändert haben): 61% (170K auf Festplatte/278K insgesamt) ", was wahrscheinlich wichtig ist.

In Linux setzen Sie swappiness auf 1 (wie in 1%).

+0

Ich könnte einige weitere Dinge entdecken, wenn Sie 'SHOW VARIABLES;' und 'SHOW GLOBAL STATUS;' kurz vor dem Neustart bereitstellen. (Möglicherweise benötigen Sie post.it oder etwas; die Größe in diesem Forum ist begrenzt.) –