We are in the process of migrating this forum. A new space will be available soon. We are sorry for the inconvenience.

mysql optymalizacja


amator
19-10-2014, 09:56
Wrzuć do "praca dla admina". Chyba, że szukasz darmowego admina to polecam http://www.e-mlodzi.com/gimnazjum-vf15.htm

Drakos
18-10-2014, 16:21
Witam , potrzebuje pomocy przy optymalizacje mysql , jestem kompletnie zielony, prowadze serwer gry i generuje on duze obiciazenie , przy save nawet do 80k zapytań

Mytop
qps now: 4 Slow qps: 0.0 Threads: 7 ( 1/ 2) 00/00/00/00
Key Efficiency: 100.0% Bps in/out: 0.7/140.3 Now in/out: 83.3/15.8k

Id User Host/IP DB Time Cmd Query or State
-- ---- ------- -- ---- --- --------------
5034 root localhost 2 0 Sleep
10138 root localhost 0 Query show full proce
10067 root localhost 710 Sleep
7649 root localhost 2483 Sleep
5313 root localhost 4552 Sleep
2845 root localhost 6014 Sleep
375 root localhost 2 7630 Sleep
MySQL on localhost (5.1.66-0+squeeze1) up 0+02:11:49 [15:53:04]
Queries: 281.0 qps: 0 Slow: 0.0 Se/In/Up/De(%): 4028/00/00/

MYSQLTUNER

>
> MySQLTuner 1.3.0 - Major Hayden
>> Bug reports, feature requests, and downloads at http://mysqltuner.com/
>> Run with '--help' for additional options and output filtering
[OK] Logged in using credentials from debian maintenance account.
[OK] Currently running supported MySQL version 5.1.66-0+squeeze1
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MRG_MYISAM
[--] Data in MyISAM tables: 5M (Tables: 310)
[--] Data in InnoDB tables: 836M (Tables: 497)
[!!] Total fragmented tables: 513

-------- Security Recommendations -------------------------------------------
[OK] All database users have passwords assigned

-------- Performance Metrics -------------------------------------------------
[--] Up for: 2h 12m 7s (772K q [97.478 qps], 10K conn, TX: 415M, RX: 126M)
[--] Reads / Writes: 51% / 49%
[--] Total buffers: 830.0M global + 123.8M per thread (151 max threads)
[!!] Maximum possible memory usage: 19.1G (121% of installed RAM)
[OK] Slow queries: 0% (6/772K)
[OK] Highest usage of available connections: 5% (9/151)
[OK] Key buffer size / total MyISAM indexes: 16.0M/1.7M
[OK] Key buffer hit rate: 100.0% (78 cached / 0 reads)
[!!] Query cache efficiency: 3.9% (11K cached / 292K selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 77K sorts)
[!!] Joins performed without indexes: 989
[OK] Temporary tables created on disk: 7% (322 on disk / 4K total)
[OK] Thread cache hit rate: 99% (9 created / 10K connections)
[OK] Table cache hit rate: 25% (852 open / 3K opened)
[OK] Open file limit used: 8% (668/8K)
[OK] Table locks acquired immediately: 100% (43K immediate / 43K locks)
[!!] InnoDB buffer pool / data size: 556.0M/837.0M
[OK] InnoDB log waits: 0
-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
MySQL started within last 24 hours - recommendations may be inaccurate
Reduce your overall MySQL memory footprint for system stability
Enable the slow query log to troubleshoot bad queries
Adjust your join queries to always utilize indexes
Variables to adjust:
*** MySQL's maximum memory usage is dangerously high ***
*** Add RAM before increasing MySQL buffer variables ***
query_cache_limit (> 800M, or use smaller result sets)
join_buffer_size (> 120.0M, or always use indexes with joins)
innodb_buffer_pool_size (>= 836M)

MY.cnf
#
# 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/se...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.
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock

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

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[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
language = /usr/share/mysql/english
skip-external-locking
#
# 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 = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover = BACKUP
table_cache = 2000
sort_buffer_size = 3M
read_rnd_buffer_size = 550K
innodb_buffer_pool_size = 556M
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 800M
query_cache_size = 240M
join_buffer_size = 120M
#
# * 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 logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf.
#
# Here you can see queries with especially long duration
log_slow_queries = /var/log/mysql/mysql-slow.log
long_query_time = 2
#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!
#
# * 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



[mysqldump]
quick
quote-names
max_allowed_packet = 16M

[mysql]
#no-auto-rehash # faster start of mysql but no tab completition

[isamchk]
key_buffer = 16M

#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/