Skocz do zawartości
Gość kucziapa

Optymalizacja Bazy

Polecane posty

Gość kucziapa

Witam mysql mi czasami szaleje i obciąża serwer po wykonaniu ./tuning-primer.sh dostałem coś takiego

 

s1:~# ./tuning-primer.sh

	-- MYSQL PERFORMANCE TUNING PRIMER --
	- By: Matthew Montgomery -

MySQL Version 5.0.81 i686

Uptime = 18 days 7 hrs 12 min 41 sec
Avg. qps = 1090
Total Questions = 1723908414
Threads Connected = 3

Server has been running for over 48hrs.
It should be safe to follow these recommendations

To find out more information on how each of these
runtime variables effects performance visit:
http://dev.mysql.com/doc/refman/5.0/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 sec.
You have 251 out of 1723908446 that take longer than 10 sec. to complete
Your long_query_time may be too high, I typically set this under 5 sec.

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.0/en/point-in-time-recovery.html

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

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

MEMORY USAGE
Max Memory Ever Allocated : 388 M
Configured Max Per-thread Buffers : 1.92 G
Configured Max Global Buffers : 192 M
Configured Max Memory Limit : 2.11 G
Physical Memory : 1.91 G

Max memory limit exceeds 90% of physical memory

KEY BUFFER
Current MyISAM index space = 438 M
Current key_buffer_size = 150 M
Key cache miss rate is 1 : 818
Key buffer free ratio = 84 %
Your key_buffer_size seems to be fine

QUERY CACHE
Query cache is enabled
Current query_cache_size = 32 M
Current query_cache_used = 22 M
Current query_cache_limit = 1 M
Current Query cache Memory fill ratio = 69.98 %
Current query_cache_min_res_unit = 4 K
MySQL won't cache query results that are larger than query_cache_limit in size

SORT OPERATIONS
Current sort_buffer_size = 1 M
Current read_rnd_buffer_size = 768 K
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 1.00 M
You have had 36281 queries where a join could not use an index properly
You have had 2368 joins without keys that check for key usage after each row
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 = 2500 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_cache value = 512 tables
You have a total of 25859 tables
You have 512 open tables.
Current table_cache hit rate is 0%, while 100% of your table cache is in use
You should probably increase your table_cache

TEMP TABLES
Current max_heap_table_size = 16 M
Current tmp_table_size = 32 M
Of 1496979 temp tables, 23% were created on disk
Effective in-memory tmp_table_size is limited to max_heap_table_size.
Created disk tmp tables ratio seems fine

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

TABLE LOCKING
Current Lock Wait ratio = 1 : 102
You may benefit from selective use of InnoDB.
If you have long running SELECT's against MyISAM tables and perform
frequent updates consider setting 'low_priority_updates=1'
If you have a high concurrency of inserts on Dynamic row-length tables
consider setting 'concurrent_insert=2'.

 

moża coś poradzić albo jakiś tuning ?

Udostępnij ten post


Link to postu
Udostępnij na innych stronach

SLOW QUERIES

The slow query log is NOT enabled.

Current long_query_time = 10 sec.

You have 251 out of 1723908446 that take longer than 10 sec. to complete

Your long_query_time may be too high, I typically set this under 5 sec.

 

wlacz i ustaw na 2sekundy albo nawet na 1s

 

zobaczysz jakie zapytania ida powoli

 

popatrze jeszcze pod katem ramu na cache - jesli sa duze tabele to pomoze

Udostępnij ten post


Link to postu
Udostępnij na innych stronach

Jakie proponujecie ustawić wartości i co zmienić w konfiguracji mysql ?

 

Wynik z mysqltuner.pl

 

 >> MySQLTuner 1.0.1 - Major Hayden <major@mhtx.net>
>> Bug reports, feature requests, and downloads at http://mysqltuner.com/
>> Run with '--help' for additional options and output filtering
Please enter your MySQL administrative login: root
Please enter your MySQL administrative password:

-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.0.51a-24+lenny2-log
[OK] Operating on 32-bit architecture with less than 2GB RAM

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 59M (Tables: 351)
[--] Data in InnoDB tables: 48M (Tables: 271)
[!!] Total fragmented tables: 19

-------- Performance Metrics -------------------------------------------------
[--] Up for: 1d 5h 48m 17s (749K q [6.987 qps], 36K conn, TX: 1B, RX: 138M)
[--] Reads / Writes: 53% / 47%
[--] Total buffers: 600.0M global + 2.6M per thread (100 max threads)
[OK] Maximum possible memory usage: 862.5M (43% of installed RAM)
[OK] Slow queries: 0% (0/749K)
[OK] Highest usage of available connections: 13% (13/100)
[OK] Key buffer size / total MyISAM indexes: 512.0M/61.4M
[OK] Key buffer hit rate: 100.0% (212M cached / 48K reads)
[OK] Query cache efficiency: 30.8% (123K cached / 400K selects)
[!!] Query cache prunes per day: 106079
[OK] Sorts requiring temporary tables: 0% (2 temp sorts / 35K sorts)
[!!] Temporary tables created on disk: 27% (6K on disk / 23K total)
[OK] Thread cache hit rate: 99% (45 created / 36K connections)
[OK] Table cache hit rate: 86% (1K open / 1K opened)
[OK] Open file limit used: 1% (919/65K)
[OK] Table locks acquired immediately: 99% (640K immediate / 640K locks)
[!!] InnoDB data size / buffer pool: 48.3M/38.0M

-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
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 (> 32M)
tmp_table_size (> 32M)
max_heap_table_size (> 16M)
innodb_buffer_pool_size (>= 48M)

 

Mój 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/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.
[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 	= 512M
max_allowed_packet 	= 16M
thread_stack 	= 128K
thread_cache_size 	= 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover 	= BACKUP
wait_timeout 	= 30
#max_connections 	= 100
table_cache 	= 1M
#thread_concurrency 	= 10
#
# * Query Cache Configuration
#
query_cache_limit 	= 4M
query_cache_size 	= 32M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
#log 	= /var/log/mysql/mysql.log
#
# Error logging goes to syslog. This is a Debian improvement 
#
# Here you can see queries with especially long duration
#log_slow_queries 	= /var/log/mysql/mysql-slow.log
log-slow-queries 	= /var/log/mysql/log-slow-queries.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
#
# * BerkeleyDB
#
# Using BerkeleyDB is now discouraged as its support will cease in 5.1.12.
skip-bdb
#
# * 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!
# You might want to disable InnoDB to shrink the mysqld process by circa 100MB.
#skip-innodb
#
# * 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
innodb_buffer_pool_size = 38M


[mysqldump]
quick
quote-names
max_allowed_packet 	= 16M

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

[isamchk]
key_buffer 	= 16M

#
# * NDB Cluster
#
# See /usr/share/doc/mysql-server-*/README.Debian for more information.
#
# The following configuration is read by the NDB Data Nodes (ndbd processes)
# not from the NDB Management Nodes (ndb_mgmd processes).
#
# [MYSQL_CLUSTER]
# ndb-connectstring=127.0.0.1


#
# * 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/

Udostępnij ten post


Link to postu
Udostępnij na innych stronach

Ponieważ mysqltuner powiadomił, że tabele są pofragmentowane, to warto uruchomić na nich optymalizację:

 

myisamchk -r --sort-index /var/lib/mysql/*/*.MYI
mysqladmin reload;mysqladmin refresh;

 

a w my.cnf proponowałbym następujące zmiany:

 

#
# indeksy zajmuja jedynie 62MB, wiec mozna spokojnie zmniejszyc
# key_buffer do 96MB
#

key_buffer      = 96M


#
# Zwiekszyc rozmiar tymczasowych tablic tworzonych w pamieci RAM, gdyz
# za duze zapisywane sa niepotrzebnie na dysku, co spowalnia dzialanie
#

tmp_table_size = 128M
max_heap_table_size = 128M

#
# bufor dla InnoDB jest za maly, trzeba zwiekszyc
#

innodb_buffer_pool_size = 64M

Udostępnij ten post


Link to postu
Udostępnij na innych stronach

Ponieważ mysqltuner powiadomił, że tabele są pofragmentowane, to warto uruchomić na nich optymalizację:

 

myisamchk -r --sort-index /var/lib/mysql/*/*.MYI
mysqladmin reload;mysqladmin refresh;

 

a w my.cnf proponowałbym następujące zmiany:

 

#
# indeksy zajmuja jedynie 62MB, wiec mozna spokojnie zmniejszyc
# key_buffer do 96MB
#

key_buffer = 96M


#
# Zwiekszyc rozmiar tymczasowych tablic tworzonych w pamieci RAM, gdyz
# za duze zapisywane sa niepotrzebnie na dysku, co spowalnia dzialanie
#

tmp_table_size = 128M
max_heap_table_size = 128M

#
# bufor dla InnoDB jest za maly, trzeba zwiekszyc
#

innodb_buffer_pool_size = 64M

 

Ustawiłem tak jak napisałeś i teraz mam

 >> MySQLTuner 1.0.1 - Major Hayden <major@mhtx.net>
>> Bug reports, feature requests, and downloads at http://mysqltuner.com/
>> Run with '--help' for additional options and output filtering
Please enter your MySQL administrative login: root
Please enter your MySQL administrative password:

-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.0.51a-24+lenny2-log
[OK] Operating on 32-bit architecture with less than 2GB RAM

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 59M (Tables: 351)
[--] Data in InnoDB tables: 53M (Tables: 271)
[!!] Total fragmented tables: 3

-------- Performance Metrics -------------------------------------------------
[--] Up for: 2m 33s (2K q [17.131 qps], 495 conn, TX: 3M, RX: 302K)
[--] Reads / Writes: 79% / 21%
[--] Total buffers: 802.0M global + 2.6M per thread (100 max threads)
[OK] Maximum possible memory usage: 1.0G (53% of installed RAM)
[OK] Slow queries: 0% (0/2K)
[OK] Highest usage of available connections: 9% (9/100)
[OK] Key buffer size / total MyISAM indexes: 96.0M/57.9M
[OK] Key buffer hit rate: 98.1% (529K cached / 9K reads)
[!!] Query cache efficiency: 12.0% (192 cached / 1K selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 146 sorts)
[OK] Temporary tables created on disk: 19% (33 on disk / 172 total)
[OK] Thread cache hit rate: 97% (14 created / 495 connections)
[OK] Table cache hit rate: 49% (643 open / 1K opened)
[OK] Open file limit used: 1% (741/65K)
[OK] Table locks acquired immediately: 99% (1K immediate / 1K locks)
[OK] InnoDB data size / buffer pool: 53.3M/64.0M

-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
MySQL started within last 24 hours - recommendations may be inaccurate
Variables to adjust:
query_cache_limit (> 256M, or use smaller result sets)

 

Na ile ustawić ten query_cache_limit ? query_cache_size mam na 512M

Udostępnij ten post


Link to postu
Udostępnij na innych stronach

Wydaje mi się, że query_cache_size = 512M to zdecydowanie za dużo. Szkoda pamięci. Zostawiłbym tak jak było albo ostatecznie trochę zwiększyć query_cache_size = 128MB i query_cache_limit = 6M (ten parametr zalezy od tego, jak wielkie sa wyniki zapytan do bazy). Ale jak informował mysqltuner cache jest często czyszczony w Twoim przypadku, więc zmiana tych parametrów i tak wiele nie zmieni... chyba że właśnie dasz za dużo (np. 512M), to serwer może zacząć swapować.

Udostępnij ten post


Link to postu
Udostępnij na innych stronach

Na serwerze jest kilkanaście stron i kilkanaście baz danych :) To wynik wykonany po paru dniach od zmiany ustawień:

 

-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.0.51a-24+lenny2-log
[OK] Operating on 32-bit architecture with less than 2GB RAM

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster 
[--] Data in MyISAM tables: 65M (Tables: 351)
[--] Data in InnoDB tables: 86M (Tables: 271)
[!!] Total fragmented tables: 30

-------- Performance Metrics -------------------------------------------------
[--] Up for: 5d 19h 51m 19s (3M q [6.361 qps], 144K conn, TX: 829M, RX: 569M)
[--] Reads / Writes: 53% / 47%
[--] Total buffers: 418.0M global + 2.6M per thread (100 max threads)
[OK] Maximum possible memory usage: 680.5M (34% of installed RAM)
[OK] Slow queries: 0% (0/3M)
[OK] Highest usage of available connections: 15% (15/100)
[OK] Key buffer size / total MyISAM indexes: 96.0M/66.9M
[OK] Key buffer hit rate: 100.0% (587M cached / 78K reads)
[OK] Query cache efficiency: 33.1% (585K cached / 1M selects)
[!!] Query cache prunes per day: 57852
[OK] Sorts requiring temporary tables: 0% (5 temp sorts / 158K sorts)
[!!] Temporary tables created on disk: 27% (30K on disk / 111K total)
[OK] Thread cache hit rate: 99% (321 created / 144K connections)
[OK] Table cache hit rate: 98% (722 open / 732 opened)
[OK] Open file limit used: 1% (805/65K)
[OK] Table locks acquired immediately: 99% (2M immediate / 2M locks)
[!!] InnoDB data size / buffer pool: 86.6M/64.0M

-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
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 (> 128M)
tmp_table_size (> 128M)
max_heap_table_size (> 128M)
innodb_buffer_pool_size (>= 86M)

 

Co teraz zrobić / zmienić i na ile ? :)

Udostępnij ten post


Link to postu
Udostępnij na innych stronach

Jeśli serwer nie swapuje i masz jeszcze trochę wolnej pamięci, to możesz zwiększyć:

 

tmp_table_size = 256M
max_heap_table_size = 256M
innodb_buffer_pool_size = 128M

Udostępnij ten post


Link to postu
Udostępnij na innych stronach

Teraz mam wynik z innego serwera. Są na nim 2 fora jedno małe drugie troszkę większe. Fora są oparte o skrypt vBulletin. Rozmiar większej bazy to 90 MB a mniejszej to 20 MB. Jak mam ustawić poszczególne wartości w my.cnf żeby było najoptymalniej.

 

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/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.
[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		= 8M
max_allowed_packet	= 8M
thread_stack		= 128K
thread_cache_size	= 128K
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover		= BACKUP
wait_timeout 		= 30
#max_connections 	= 100
table_cache 	= 8M
tmp_table_size 	= 32M
max_heap_table_size 	= 32M

#thread_concurrency 	= 10
#
# * Query Cache Configuration
#
query_cache_limit 	= 8M
query_cache_size 	= 32M

join_buffer_size	= 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
#log		= /var/log/mysql/mysql.log
#
# Error logging goes to syslog. This is a Debian improvement 
#
# Here you can see queries with especially long duration
#log_slow_queries	= /var/log/mysql/mysql-slow.log
log-slow-queries 	= /var/log/mysql/log-slow-queries.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
#
# * BerkeleyDB
#
# Using BerkeleyDB is now discouraged as its support will cease in 5.1.12.
skip-bdb
#
# * 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!
# You might want to disable InnoDB to shrink the mysqld process by circa 100MB.
#skip-innodb
#
# * 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
innodb_buffer_pool_size = 32M


[mysqldump]
quick
quote-names
max_allowed_packet	= 16M

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

[isamchk]
key_buffer		= 32M
#
# * NDB Cluster
#
# See /usr/share/doc/mysql-server-*/README.Debian for more information.
#
# The following configuration is read by the NDB Data Nodes (ndbd processes)
# not from the NDB Management Nodes (ndb_mgmd processes).
#
# [MYSQL_CLUSTER]
# ndb-connectstring=127.0.0.1


#
# * 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/

 

Wynik mysqltuner.pl

 

-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.0.51a-24+lenny2-log
[OK] Operating on 32-bit architecture with less than 2GB RAM

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster 
[--] Data in MyISAM tables: 81M (Tables: 364)
[--] Data in InnoDB tables: 96K (Tables: 6)
[--] Data in MEMORY tables: 252K (Tables: 4)
[!!] Total fragmented tables: 15

-------- Performance Metrics -------------------------------------------------
[--] Up for: 4m 59s (6K q [20.706 qps], 899 conn, TX: 267M, RX: 1M)
[--] Reads / Writes: 87% / 13%
[--] Total buffers: 106.0M global + 18.5M per thread (100 max threads)
[!!] Maximum possible memory usage: 1.9G (97% of installed RAM)
[OK] Slow queries: 0% (0/6K)
[OK] Highest usage of available connections: 5% (5/100)
[OK] Key buffer size / total MyISAM indexes: 8.0M/25.7M
[OK] Key buffer hit rate: 99.5% (159K cached / 753 reads)
[OK] Query cache efficiency: 54.2% (2K cached / 4K selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 336 sorts)
[!!] Joins performed without indexes: 2
[OK] Temporary tables created on disk: 9% (22 on disk / 236 total)
[OK] Thread cache hit rate: 99% (5 created / 899 connections)
[OK] Table cache hit rate: 98% (397 open / 403 opened)
[OK] Open file limit used: 1% (768/65K)
[OK] Table locks acquired immediately: 99% (3K immediate / 3K locks)
[OK] InnoDB data size / buffer pool: 96.0K/32.0M

-------- 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
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 ***
join_buffer_size (> 16.0M, or always use indexes with joins)

Udostępnij ten post


Link to postu
Udostępnij na innych stronach
Gość N3T5kY

Zacznij od tego

 

wget http://day32.com/MySQL/[i]tuning[/i]-[i]primer[/i].sh; sh tuning-primer.sh

 

I zmień na ustawienia jakie doradzi ci skrypt. Mysql musi działać 48h aby test był obiektywny.

Udostępnij ten post


Link to postu
Udostępnij na innych stronach

Jeśli fora działają na vBulletinie, to zainstaluj sobie XCache ( http://xcache.lighttpd.net ), a w pliku konfiguracyjnym includes/config.php ustaw:

$config['Datastore']['class'] = 'vB_Datastore_XCache';

 

nie dość, że xcache przyśpieszy kilkukrotnie uruchamianie skryptów php, to jeszcze z pomocą tego wpisu w konfiguracji najczęstsze zapytaqnia do serwera MySQL będą cacheowane w pamięci podręcznej XCache (zmniejsza przynajmniej o połowę liczbę zapytań do serwera baz danych.

Udostępnij ten post


Link to postu
Udostępnij na innych stronach

Zainstalowałem ten xcache z repozytoriów i mi vB wywala

Warning: xcache_isset() [function.xcache-isset]: xcache.var_size is either 0 or too small to enable var data caching in [path]/includes/class_datastore.php on line 557

Warning: xcache_isset() [function.xcache-isset]: xcache.var_size is either 0 or too small to enable var data caching in [path]/includes/class_datastore.php on line 557

Warning: xcache_unset() [function.xcache-unset]: xcache.var_size is either 0 or too small to enable var data caching in [path]/includes/class_datastore.php on line 596

Warning: xcache_set() [function.xcache-set]: xcache.var_size is either 0 or too small to enable var data caching in [path]/includes/class_datastore.php on line 597

Warning: xcache_unset() [function.xcache-unset]: xcache.var_size is either 0 or too small to enable var data caching in [path]/includes/class_datastore.php on line 596

Warning: xcache_set() [function.xcache-set]: xcache.var_size is either 0 or too small to enable var data caching in [path]/includes/class_datastore.php on line 597

Warning: xcache_unset() [function.xcache-unset]: xcache.var_size is either 0 or too small to enable var data caching in [path]/includes/class_datastore.php on line 596

Udostępnij ten post


Link to postu
Udostępnij na innych stronach

xcache.optimizer na on + daj jakieś 16M dla var cache :(

Udostępnij ten post


Link to postu
Udostępnij na innych stronach

Kurde zmieniałem nie ten size co miałem :( Dzięki :)

 

Would you like me to create a ~/.my.cnf file for you? [y/N] : N

-- MYSQL PERFORMANCE TUNING PRIMER --
 	- By: Matthew Montgomery -

MySQL Version 5.0.51a-24+lenny2-log i486

Uptime = 0 days 16 hrs 55 min 41 sec
Avg. qps = 11
Total Questions = 725330
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.0/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 enabled.
Current long_query_time = 10 sec.
You have 0 out of 725351 that take longer than 10 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.0/en/point-in-time-recovery.html

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

MAX CONNECTIONS
Current max_connections = 100
Current threads_connected = 1
Historic max_used_connections = 11
The number of used connections is 11% of the configured maximum.
Your max_connections variable seems to be fine.

INNODB STATUS
Current InnoDB index space = 160 K
Current InnoDB data space = 96 K
Current InnoDB buffer pool free = 96 %
Current innodb_buffer_pool_size = 32 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 : 277 M
Configured Max Per-thread Buffers : 1.80 G
Configured Max Global Buffers : 74 M
Configured Max Memory Limit : 1.87 G
Physical Memory : 1.95 G

nMax memory limit exceeds 90% of physical memory

KEY BUFFER
Current MyISAM index space = 25 M
Current key_buffer_size = 8 M
Key cache miss rate is 1 : 1040
Key buffer free ratio = 4 %
You could increase key_buffer_size
It is safe to raise this up to 1/4 of total system memory;
assuming this is a dedicated database server.

QUERY CACHE
Query cache is enabled
Current query_cache_size = 32 M
Current query_cache_used = 16 M
Current query_cache_limit = 8 M
Current Query cache Memory fill ratio = 50.48 %
Current query_cache_min_res_unit = 4 K
MySQL won't cache query results that are larger than query_cache_limit in size

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

JOINS
Current join_buffer_size = 16.00 M
You have had 333 queries where a join could not use an index properly
join_buffer_size >= 4 M
This is not advised
You should enable "log-queries-not-using-indexes"
Then look for non indexed joins in the slow query log.

OPEN FILES LIMIT
Current open_files_limit = 65535 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_cache value = 32712 tables
You have a total of 391 tables
You have 423 open tables.
The table_cache value seems to be fine

TEMP TABLES
Current max_heap_table_size = 32 M
Current tmp_table_size = 32 M
Of 11053 temp tables, 3% were created on disk
Created disk tmp tables ratio seems fine

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

TABLE LOCKING
Current Lock Wait ratio = 1 : 2644
You may benefit from selective use of InnoDB.
If you have long running SELECT's against MyISAM tables and perform
frequent updates consider setting 'low_priority_updates=1'
If you have a high concurrency of inserts on Dynamic row-length tables
consider setting 'concurrent_insert=2'.

Udostępnij ten post


Link to postu
Udostępnij na innych stronach

Bądź aktywny! Zaloguj się lub utwórz konto

Tylko zarejestrowani użytkownicy mogą komentować zawartość tej strony

Utwórz konto

Zarejestruj nowe konto, to proste!

Zarejestruj nowe konto

Zaloguj się

Posiadasz własne konto? Użyj go!

Zaloguj się


×