( NoMan | 2018. 08. 22., sze – 13:06 )

A top és a htop kombót használom, ahogy egyértelműen a CPU oszlopba jelentik meg a terhelés. Be van kapcsolva IO és egyéb kijelzések is, de azoknál nem látok olyat, ami terhelést indokolna.

IOWait-et nem tudom, hogy hol lehetne érdembe nézni. Jó tanács?

A terhelés néhány másodperctől, a néhány percig is eltart. Teljesen véletlenszerűen jön és mindenféle előjel nélkül, illetve eltűnni is így tűnik el.

MySQL telepítés 5.7.23-as verzióval (Ubuntu 16.07 default repojában lévő MySQL, mindenféle repo módosítás nélkül)

InnoDB enginet használ minden adatbázis. Két adatbázist használ, az egyik 450MB-s, abból egy tábla (statisztikát gyűjt, ritkán írja, belekérdezni még ritkábban kérdez, az 220MB), táblából 48 db van benne. A másik adatbázis nincs egész 1MB 4 táblával.

Jelenleg nincs semmilyen grafikonos megjelenés. Munint lehet rá dobni, azt ismerem, sokat használtam. De pont a MySQL-ről nem szokott túl sok érdemi infót adni.

Áttúrtam a webszerver access logját... találtam valami cseh indexelő botot... kitiltottam az IP-jét. Valami bohóc oldalnak gyűjtött adatokat 1 IP-ről, másodpercenként többször jött. Ezen kívül semmi rendellenes bejegyzés és access log alapján sem látom, hogy DoS lenne, mert ránézésre valósnak tűnnek a kérések és nincs is olyan ördöngösen sok. Apache error log semmit nem tartalmaz, elvétve egy két olyan bejegyzést, hogy nincs beállítva egy változó, vagy ilyesmi (php warning), de ezeket javítgatom, ahogy időm engedi. De semmi olyan, ami a terhelést indokolná. MySQL log ugyan ez. Megnéztem error semmi, slow_query alapján napi 5-10 olyan query, ami mondjuk 1 és 1,3 mp között fut le.

processlist-ben látottak nem indokolnak terhelést, mert pillanatok alatt kikerül onnan minden query. Nem láttam még ott beragadni semmit.
Ha gyorsan végez egy query, akkor terelése se lehet nagy. Nem?? Tehát ha 0.32mp alatt végez egy query, annak a cost-ja sem akkora, ami ilyen mértékű kilengést okozhatna. Vagy rosszul gondolom? slow_query-t elkezdem 0-as kvótával logolni és majd valami scriptet gyártok, ami használható adatot ad belőle. De félek, nem fogok találni benne semmit.

Alább a MySQL config... A Fine Tuning rész az egy aktuális állapot, az már volt minden. mysqltunnel éppen aktuális ajánlása alapján és a google féle perf. tuningok ajánlásai alapján variálgatom, de áttörést még egyetlen beállítás sem hozott.


#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0

[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
skip-name-resolve

connect_timeout = 5 # alap beallitasa: 10
interactive_timeout = 2 # alap beallitasa: 100
wait_timeout = 2 # alap beallitasa: 100

#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1

#
# * Fine Tuning
#
key_buffer_size = 8M
join_buffer_size = 8M
max_allowed_packet = 4M
table_open_cache = 4M
sort_buffer_size = 4M
net_buffer_length = 2M
read_buffer_size = 4M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 8M
thread_stack = 192K
thread_cache_size = 0
tmp_table_size = 4M
max_heap_table_size = 4M

# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover-options = BACKUP
max_connections = 50
#table_cache = 64

#
# * Query Cache Configuration
#
query_cache_type = 0
query_cache_size = 0
query_cache_limit = 8M

#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1

#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log

#
# Here you can see queries with especially long duration
slow_query_log = 1
slow_query_log_file = /var/log/mysql/mysqld_slow_queries.log
long_query_time = 1
log-queries-not-using-indexes

#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name

#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
# the rest of the innodb config follows:
# don't eat too much memory, we're trying to be safe on 64Mb boxes
# you might want to bump this up a bit on boxes with more RAM
innodb_buffer_pool_size = 512M
# you may wish to change this size to be more suitable for your system
# the max is there to avoid run-away growth on your machine
innodb_data_file_path = ibdata1:10M:autoextend
# we keep this at around 25% of of innodb_buffer_pool_size
# sensible values range from 1MB to (1/innodb_log_files_in_group*innodb_buffer_pool_size)
innodb_log_file_size = 128M
# this is the default, increase it if you have very large transactions going on
innodb_log_buffer_size = 8M
# this is the default and won't hurt you
# you shouldn't need to tweak it
innodb_log_files_in_group=2
# see the innodb config docs, the other options are not always safe
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
innodb_file_per_table

innodb_fast_shutdown=0
innodb_flush_method=O_DIRECT

# Uncomment this to get FEDERATED engine support
#plugin-load=federated=ha_federated.so
loose-federated

#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem