Skocz do zawartości
Zaloguj się, aby obserwować  
Pitu

Optymalizacja my.cnf

Polecane posty

Witam

 

Prosiłbym o porady dotyczące optymalnego ustawienia my.cnf

 

Serwer:

2GB pamięci

2x2,8GHz procesor

 

Bazy danych:

1. ok. 300MB - baza forum vBulletin

2. ok. 150MB - baza forum vBulletin

3. ok. 100MB - baza CMS DataLife Engine

4. ok. 10MB - baza OSCommerce

5. ok. 6MB - baza OSCommerce

 

Pamięć wolna to ponad 1GB tak więc gdzie mógłbym zwiększyć wartość?

 

[mysqld]
bind-address=127.0.0.1
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
query_cache_limit=1M
query_cache_size=32M
query_cache_type=1
max_connections=3000
max_user_connections=600
interactive_timeout=100
wait_timeout=100
connect_timeout=10
thread_cache_size=128
key_buffer=128M
join_buffer_size=2M
max_allowed_packet=32M
table_cache=1024
sort_buffer_size=2M
read_buffer_size=2M
read_rnd_buffer_size=1536K
max_connect_errors=10
thread_concurrency=4
myisam_sort_buffer_size=64M
skip-locking
server-id=1

[mysql.server]
user=mysql
basedir=/var/lib

[safe_mysqld]
bind-address=127.0.0.1
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
open_files_limit=8192
SAFE_MYSQLD_OPTIONS=”–defaults-file=/etc/my.cnf
–log-slow-queries=/var/log/slow-queries.log”

#[mysqldump]
#quick
#max_allowed_packet=16M

[mysql]
no-auto-rehash

[isamchk]
key_buffer=128M
sort_buffer=128M
read_buffer=32M
write_buffer=32M

[myisamchk]
key_buffer=128M
sort_buffer=128M
read_buffer=32M
write_buffer=32M

[mysqlhotcopy]
interactive-timeout

 

Wynik z Tuning Primer

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

MySQL Version 5.0.45 i686

Uptime = 0 days 0 hrs 13 min 12 sec
Avg. qps = 112
Total Questions = 88735
Threads Connected = 6

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 NOT enabled.
Current long_query_time = 10 sec.
You have 0 out of 88775 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 = 128
Current threads_cached = 8
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine

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

INNODB STATUS
Current InnoDB index space = 2 M
Current InnoDB data space = 2 M
Current InnoDB buffer pool free = 29 %
Current innodb_buffer_pool_size = 8 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 : 254 M
Configured Max Per-thread Buffers : 22.48 G
Configured Max Global Buffers : 170 M
Configured Max Memory Limit : 22.65 G
Physical Memory : 1.95 G

nMax memory limit exceeds 90% of physical memory

KEY BUFFER
Current MyISAM index space = 235 M
Current key_buffer_size = 128 M
Key cache miss rate is 1 : 1040
Key buffer free ratio = 81 %
Your key_buffer_size seems to be fine

QUERY CACHE
Query cache is enabled
Current query_cache_size = 32 M
Current query_cache_used = 9 M
Current query_cache_limit = 1 M
Current Query cache Memory fill ratio = 29.44 %
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 = 1 M
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 2.00 M
You have had 0 queries where a join could not use an index properly
Your joins seem to be using indexes properly

OPEN FILES LIMIT
Current open_files_limit = 15000 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 = 1024 tables
You have a total of 1508 tables
You have 1024 open tables.
Current table_cache hit rate is 21%
, 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 1382 temp tables, 1% 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 = 4134 : 1
You have a high ratio of sequential access requests to SELECTs
You may benefit from raising read_buffer_size and/or improving your use of indexes.

TABLE LOCKING
Current Lock Wait ratio = 1 : 603
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

Uptime = 0 days 0 hrs 13 min 12 sec

 

tuning-primer powie dużo, ale na pewno nie po 13 minutach od włączenia mysql ;)

Udostępnij ten post


Link to postu
Udostępnij na innych stronach

Co zresztą sam tuner-primer mówi

Warning: Server has not been running for at least 48hrs.

It may not be safe to use these recommendations

Więc czego autorze od nas oczekujesz, skoro sam nie przeczytałeś nawet tego co masz na ekranie?!

Udostępnij ten post


Link to postu
Udostępnij na innych stronach

Przegapiłem informację, za dwa dni odpalę jeszcze raz i spróbuję sam coś działać oraz dam tutaj wynik.

 

Pozdrawiam

Udostępnij ten post


Link to postu
Udostępnij na innych stronach

Nowy wynik z Tunera, trochę go przejrzałem nie do końca wiem co mogę poprawić, np. jak piszę, że dana wartość ustawiona za duża na ile zmniejszyć itp.:

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

MySQL Version 5.0.45 i686

Uptime = 2 days 9 hrs 4 min 49 sec
Avg. qps = 108
Total Questions = 22201301
Threads Connected = 2

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 69 out of 22201342 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 = 128
Current threads_cached = 63
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine

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

INNODB STATUS
Current InnoDB index space = 2 M
Current InnoDB data space = 2 M
Current InnoDB buffer pool free = 23 %
Current innodb_buffer_pool_size = 8 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 : 676 M
Configured Max Per-thread Buffers : 22.48 G
Configured Max Global Buffers : 170 M
Configured Max Memory Limit : 22.65 G
Physical Memory : 1.95 G

nMax memory limit exceeds 90% of physical memory

KEY BUFFER
Current MyISAM index space = 238 M
Current key_buffer_size = 128 M
Key cache miss rate is 1 : 36859
Key buffer free ratio = 47 %
Your key_buffer_size seems to be too high.
Perhaps you can use these resources elsewhere

QUERY CACHE
Query cache is enabled
Current query_cache_size = 32 M
Current query_cache_used = 23 M
Current query_cache_limit = 1 M
Current Query cache Memory fill ratio = 72.90 %
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 = 1 M
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 2.00 M
You have had 448 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 = 15000 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 = 1024 tables
You have a total of 1508 tables
You have 1024 open tables.
Current table_cache hit rate is 7%
, 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 252749 temp tables, 1% 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 = 1152 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 1 : 531
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

Wszystko na oko zmniejszaj ;) i testuj co 48 h

Wynik zwraca wartość jaką masz ustawioną i jaką wykorzystujesz. Zmniejsz na tyle, aby było trochę więcej niż wykorzystujesz.

Udostępnij ten post


Link to postu
Udostępnij na innych stronach

Current innodb_buffer_pool_size = 8 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

 

Current table_cache value = 1024 tables
You have a total of 1508 tables
You have 1024 open tables.
Current table_cache hit rate is 7%
, while 100% of your table cache is in use
You should probably increase your table_cache

 

 

Nie rozumiem co tu jest niezrozumiałe ;>. Mógłbyś też włączyć slow query log bo widać, że 69 zapytań trwało dłużej niż 10sek (no chyba, że te zapytania mają się tyle wykonywać?). Skrypt sugeruje też zmniejszenie max_connections, jednak generalnie nie zrobi ci to dużej różnicy.

Udostępnij ten post


Link to postu
Udostępnij na innych stronach

Skrypt sugeruje też zmniejszenie max_connections, jednak generalnie nie zrobi ci to dużej różnicy.

 

 

Różnica będzie taka, że inną wartość maksymalnie zaalokowanej pamięci przyjmie MySQL ;)

I w sumie to dobrze jest ustawiać wartość odpowiednią, a nie zawyżoną.

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ę

Zaloguj się, aby obserwować  

×