İyinet'e Hoşgeldiniz!

Türkiye'nin En Eski Webmaster Forum'una Hemen Kayıt Olun!

Kayıt Ol!

tuning-primer.sh mysql tuning scripti - mysql performans raporu

ENVER

0
İyinet Üyesi
Katılım
21 Eylül 2006
Mesajlar
492
Reaction score
0
Buyrun:

thread_cache_size = 384
key_buffer = 512M
table_cache = 5000
low_priority_updates = 1

İyinet teşekkürler son değerleri girdikten sonra yine çalıştırdım. Çeşitli uyarılar mevcut yardımcı olursan sevinirim.

[root@sunucu ~]# ./tuning-primer.sh

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

MySQL Version 4.1.22-standard i686

Uptime = 2 days 0 hrs 46 min 40 sec
Avg. qps = 95
Total Questions = 16692415
Threads Connected = 5

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/4.1/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
Current long_query_time = 10 sec.
You have 50 out of 16692429 that take longer than 10 sec. to complete
The slow query log is NOT enabled.
Your long_query_time may be too high, I typically set this under 5 sec.

WORKER THREADS
Current thread_cache_size = 384
Current threads_cached = 157
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 = 159
The number of used connections is 31% of the configured maximum.
Your max_connections variable seems to be fine.

MEMORY USAGE
Max Memory Ever Allocated : 1 G
Configured Max Per-thread Buffers : 4 G
Configured Max Global Buffers : 266 M
Configured Max Memory Limit : 4 G
Physical Memory : 3.95 G

Max memory limit exceeds 90% of physical memory


KEY BUFFER
Current MyISAM index space = 573 M
Current key_buffer_size = 128 M
Key cache miss rate is 1 : 42162
Key buffer fill ratio = 100.00 %
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 = 128 M
Current query_cache_used = 67 M
Current query_cache_limit = 8 M
Current Query cache Memory fill ratio = 52.50 %
Current query_cache_min_res_unit = 4 K
Query Cache is 24 % fragmented
Run "FLUSH QUERY CACHE" periodically to defragment the query cache memory
If you have many small queries lower 'query_cache_min_res_unit' to reduce fragmentation.

MySQL won't cache query results that are larger than query_cache_limit in size

SORT OPERATIONS
Current sort_buffer_size = 4 M
Current record/read_rnd_buffer_size = 764 K
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 2.00 M
You have had 1310 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 = 10510 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 = 5000 tables
You have a total of 1044 tables
You have 1315 open tables.
The table_cache value seems to be fine

TEMP TABLES
Current max_heap_table_size = 127 M
Current tmp_table_size = 128 M
Of 530867 temp tables, 0% 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 = 760 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 1 : 501
You may benefit from selective use of InnoDB.
 

ENVER

0
İyinet Üyesi
Katılım
21 Eylül 2006
Mesajlar
492
Reaction score
0
Herşey güzel ama key_buffer = 512M bunu atlamışşın, halen 128M görünüyor.

2 tane key_buffer değeri varmış acaba bi aksilik mi var my.cnf içeriğine bakmanız mümkün mü acaba

Kod:
[mysqld]
safe-show-database
#old_passwords
back_log = 75
skip-innodb
max_connections = 500
key_buffer = 512M
myisam_sort_buffer_size = 64M
join_buffer_size = 2M
read_buffer_size = 2M
sort_buffer_size = 4M
table_cache = 5000
thread_cache_size = 384
wait_timeout = 30
connect_timeout = 10
tmp_table_size = 128M
max_heap_table_size = 128M
max_allowed_packet = 64M
net_buffer_length = 16384
max_connect_errors = 10
thread_concurrency = 8
read_rnd_buffer_size = 786432
bulk_insert_buffer_size = 8M
query_cache_limit = 8M
query_cache_size = 128M
query_cache_type = 1
query_prealloc_size = 262144
query_alloc_block_size = 65536
transaction_alloc_block_size = 8192
transaction_prealloc_size = 4096
default-storage-engine = MyISAM
low_priority_updates = 1

[mysqld_safe]
nice = -10
open_files_limit = 8192

[mysqldump]
quick
max_allowed_packet = 16M

[myisamchk]
key_buffer = 512M
sort_buffer = 64M
read_buffer = 16M
write_buffer = 16M

[mysqlhotcopy]
interactive-timeout
 

iyinet

Root
Admin
Hosting Firması
Katılım
2 Eylül 2002
Mesajlar
5,028
Reaction score
66
Konum
Sakarya
2 tane key_buffer değeri varmış acaba bi aksilik mi var my.cnf içeriğine bakmanız mümkün mü acaba

Kod:
[mysqld]
safe-show-database
#old_passwords
back_log = 75
skip-innodb
max_connections = 500
key_buffer = 512M
myisam_sort_buffer_size = 64M
join_buffer_size = 2M
read_buffer_size = 2M
sort_buffer_size = 4M
table_cache = 5000
thread_cache_size = 384
wait_timeout = 30
connect_timeout = 10
tmp_table_size = 128M
max_heap_table_size = 128M
max_allowed_packet = 64M
net_buffer_length = 16384
max_connect_errors = 10
thread_concurrency = 8
read_rnd_buffer_size = 786432
bulk_insert_buffer_size = 8M
query_cache_limit = 8M
query_cache_size = 128M
query_cache_type = 1
query_prealloc_size = 262144
query_alloc_block_size = 65536
transaction_alloc_block_size = 8192
transaction_prealloc_size = 4096
default-storage-engine = MyISAM
low_priority_updates = 1

[mysqld_safe]
nice = -10
open_files_limit = 8192

[mysqldump]
quick
max_allowed_packet = 16M

[myisamchk]
key_buffer = 512M
sort_buffer = 64M
read_buffer = 16M
write_buffer = 16M

[mysqlhotcopy]
interactive-timeout

Benim verdiğim tüm değerler sadece [mysqld] bölümü içindir.
[mysqld] bölümü altında 1 tane key_buffer var o da 512M, 128M nereden geliyor acaba?
 

ENVER

0
İyinet Üyesi
Katılım
21 Eylül 2006
Mesajlar
492
Reaction score
0
ilk veriyi girdiğimde alttaki kısmı düzeltmişim
[myisamchk]
key_buffer = 512M
sort_buffer = 64M
read_buffer = 16M
write_buffer = 16M

mysqld kısmını yeni 512 yaptım
 

WoLeRiNe

0
İyinet Üyesi
Katılım
11 Ekim 2004
Mesajlar
1,145
Reaction score
0
Konum
IstanbuL
-- MYSQL PERFORMANCE TUNING PRIMER --
- By: Matthew Montgomery -

MySQL Version 5.0.45-community-log i686

Uptime = 2 days 5 hrs 8 min 39 sec
Avg. qps = 111
Total Questions = 21319801
Threads Connected = 5

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
Current long_query_time = 3 sec.
You have 555 out of 21319859 that take longer than 3 sec. to complete
The slow query log is enabled.
Your long_query_time seems to be fine

WORKER THREADS
Current thread_cache_size = 384
Current threads_cached = 43
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 = 1
Historic max_used_connections = 44
The number of used connections is 8% 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 : 385 M
Configured Max Per-thread Buffers : 2 G
Configured Max Global Buffers : 202 M
Configured Max Memory Limit : 2 G
Physical Memory : 3.90 G
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 846 M
Current key_buffer_size = 128 M
Key cache miss rate is 1 : 4071
Key buffer fill ratio = 99.00 %
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 = 64 M
Current query_cache_used = 51 M
Current query_cache_limit = 4 M
Current Query cache Memory fill ratio = 81.08 %
Current query_cache_min_res_unit = 4 K
Query Cache is 11 % fragmented
Run "FLUSH QUERY CACHE" periodically to defragment the query cache memory
If you have many small queries lower 'query_cache_min_res_unit' to reduce fragmentation.
However, 230763 queries have been removed from the query cache due to lack of memory
Perhaps you should raise query_cache_size
MySQL won't cache query results that are larger than query_cache_limit in size

SORT OPERATIONS
Current sort_buffer_size = 1 M
Current record/read_rnd_buffer_size = 1020 K
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 1.00 M
You have had 2465 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 = 20510 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 = 10000 tables
You have a total of 4093 tables
You have 8084 open tables.
The table_cache value seems to be fine

TEMP TABLES
Current max_heap_table_size = 16 M
Current tmp_table_size = 32 M
Of 1026975 temp tables, 4% 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 = 1020 K
Current table scan ratio = 4 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 1 : 1915
You may benefit from selective use of InnoDB.
If you have a high concurrency of inserts on Dynamic row-length tables
consider setting 'concurrent_insert=2'.

Yeni durum bu. Yorumlarsanız sevinirim. Teşekkürler.
 

Efsane

0
İyinet Üyesi
Katılım
12 Ekim 2007
Mesajlar
1,553
Reaction score
1
Konum
bilecen (:
Teşekkürler iyinet

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

MySQL Version 4.1.22-standard i686

Uptime = 3 days 4 hrs 44 min 25 sec
Avg. qps = 58
Total Questions = 16246651
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/4.1/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
Current long_query_time = 10 sec.
You have 2809 out of 16246663 that take longer than 10 sec. to complete
The slow query log is NOT enabled.
Your long_query_time may be too high, I typically set this under 5 sec.

WORKER THREADS
Current thread_cache_size = 0
Current threads_cached = 0
Current threads_per_sec = 5
Historic threads_per_sec = 2
Threads created per/sec are overrunning threads cached
You should raise thread_cache_size

MAX CONNECTIONS
Current max_connections = 500
Current threads_connected = 2
Historic max_used_connections = 150
The number of used connections is 30% of the configured maximum.
Your max_connections variable seems to be fine.

MEMORY USAGE
Max Memory Ever Allocated : 421 M
Configured Max Per-thread Buffers : 1 G
Configured Max Global Buffers : 17 M
Configured Max Memory Limit : 1 G
Physical Memory : 1.97 G
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 1 G
Current key_buffer_size = 7 M
Key cache miss rate is 1 : 32
Key buffer fill ratio = 50.00 %
Your key_buffer_size seems to be too high.
Perhaps you can use these resources elsewhere

QUERY CACHE
Query cache is supported but not enabled
Perhaps you should set the query_cache_size

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

JOINS
Current join_buffer_size = 132.00 K
You have had 60423 queries where a join could not use an index properly
You have had 190 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 = 10000 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 = 64 tables
You have a total of 15106 tables
You have 64 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 1012201 temp tables, 12% 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 = 128 K
Current table scan ratio = 179 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 1 : 5196
Your table locking seems to be fine

Sunucu ;
Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz
2 GB RAM
 

iyinet

Root
Admin
Hosting Firması
Katılım
2 Eylül 2002
Mesajlar
5,028
Reaction score
66
Konum
Sakarya
Teşekkürler iyinet

Sunucu ;
Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz
2 GB RAM

Bu ayarları yap, yoksa ekle varsa bu şekilde değiştir, bunlar sadece [mysqld] altına girecek.

skip-locking
skip-name-resolve
max_connections = 300
thread_cache_size = 128
key_buffer = 128M
query_cache_type = 1
query_cache_size = 32M
query_cache_limit = 4M
table_cache = 30000
low_priority_updates = 1
Dikkatimi çeken ya henüz bu db üzerinde uygulama çalışmıyor yada indexler kullanılamıyor.
 

Efsane

0
İyinet Üyesi
Katılım
12 Ekim 2007
Mesajlar
1,553
Reaction score
1
Konum
bilecen (:
Bu ayarları yap, yoksa ekle varsa bu şekilde değiştir, bunlar sadece [mysqld] altına girecek.

Dikkatimi çeken ya henüz bu db üzerinde uygulama çalışmıyor yada indexler kullanılamıyor.



Bu Şekildeydi.
[mysqld]
set-variable = max_connections=500
safe-show-database



Bu şekilde değiştirdim, umarım doğrudur.
[mysqld]
skip-locking
skip-name-resolve
max_connections = 300
thread_cache_size = 128
key_buffer = 128M
query_cache_type = 1
query_cache_size = 32M
query_cache_limit = 4M
table_cache = 30000
low_priority_updates = 1
set-variable = max_connections=500
safe-show-database

4-5 Forum DB si aktif olarak çalışıyor..
 

iyinet

Root
Admin
Hosting Firması
Katılım
2 Eylül 2002
Mesajlar
5,028
Reaction score
66
Konum
Sakarya
vbulletin ve vbseo kullanan PHP kullanıcılarına memcached kurmalarını öneririm, yükde %30-50 lere kadar varan bir düşüş oluyor.
sar ile baktığımızda eskiden 20 lerde olan server kullanıcı yükü 10-15 ler arasında dolaşıyor.

Kod:
$ sar

       CPU     [B]%user[/B]     %nice   %system   %iowait     %idle
       all      [B]12.21[/B]      0.00      0.88      0.73     86.18

Özellikle vbseo memcached den oldukça iyi faydalanıyor.
 

Efsane

0
İyinet Üyesi
Katılım
12 Ekim 2007
Mesajlar
1,553
Reaction score
1
Konum
bilecen (:
Başka bir sunucum için my.cnf ayarı alabilirmiyim ?

-- MYSQL PERFORMANCE TUNING PRIMER --
- By: Matthew Montgomery -
MySQL Version 4.1.22-standard i686
Uptime = 37 days 0 hrs 17 min 15 sec
Avg. qps = 20
Total Questions = 64850071
Threads Connected = 4
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/4.1/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
Current long_query_time = 10 sec.
You have 11263 out of 64850083 that take longer than 10 sec. to complete
The slow query log is NOT enabled.
Your long_query_time may be too high, I typically set this under 5 sec.
WORKER THREADS
Current thread_cache_size = 0
Current threads_cached = 0
Current threads_per_sec = 3
Historic threads_per_sec = 1
Threads created per/sec are overrunning threads cached
You should raise thread_cache_size
MAX CONNECTIONS
Current max_connections = 500
Current threads_connected = 4
Historic max_used_connections = 148
The number of used connections is 29% of the configured maximum.
Your max_connections variable seems to be fine.
MEMORY USAGE
Max Memory Ever Allocated : 415 M
Configured Max Per-thread Buffers : 1 G
Configured Max Global Buffers : 17 M
Configured Max Memory Limit : 1 G
Physical Memory : 1.97 G
Max memory limit seem to be within acceptable norms
KEY BUFFER
Current MyISAM index space = 649 M
Current key_buffer_size = 7 M
Key cache miss rate is 1 : 97
Key buffer fill ratio = 100.00 %
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 supported but not enabled
Perhaps you should set the query_cache_size
SORT OPERATIONS
Current sort_buffer_size = 2 M
Current record/read_rnd_buffer_size = 256 K
Sort buffer seems to be fine
JOINS
Current join_buffer_size = 132.00 K
You have had 6465 queries where a join could not use an index properly
You have had 12 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 = 4096 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 = 64 tables
You have a total of 2403 tables
You have 64 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 2117988 temp tables, 0% 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 = 128 K
Current table scan ratio = 19 : 1
read_buffer_size seems to be fine
TABLE LOCKING
Current Lock Wait ratio = 1 : 1192
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'

Sunucu ;
Intel(R) Pentium(R) 4 CPU 3.60GHz
2 GB RAM
 

iyinet

Root
Admin
Hosting Firması
Katılım
2 Eylül 2002
Mesajlar
5,028
Reaction score
66
Konum
Sakarya
Başka bir sunucum için my.cnf ayarı alabilirmiyim ?



Sunucu ;
Intel(R) Pentium(R) 4 CPU 3.60GHz
2 GB RAM

Bu ayarları yapın, değerler yoksa ekleyin varsa bu şekilde değiştirin, bunlar sadece [mysqld] altına eklenecek.

skip-locking
skip-name-resolve
max_connections = 300
thread_cache_size = 128
key_buffer = 256M
query_cache_type = 1
query_cache_size = 32M
query_cache_limit = 4M
table_cache = 5000
low_priority_updates = 1
 

Efsane

0
İyinet Üyesi
Katılım
12 Ekim 2007
Mesajlar
1,553
Reaction score
1
Konum
bilecen (:
Bu ayarları yapın, değerler yoksa ekleyin varsa bu şekilde değiştirin, bunlar sadece [mysqld] altına eklenecek.

skip-locking
skip-name-resolve
max_connections = 300
thread_cache_size = 128
key_buffer = 256M
query_cache_type = 1
query_cache_size = 32M
query_cache_limit = 4M
table_cache = 5000
low_priority_updates = 1

Teşekkürler aynen yaptım..

Bu gerekli ayarlamayı yaptıkdan sonra tuning-primer.sh yi kaldırmamız gerekiyor mu ? Evetse nasıl kaldıracağız ?
 

iyinet

Root
Admin
Hosting Firması
Katılım
2 Eylül 2002
Mesajlar
5,028
Reaction score
66
Konum
Sakarya
Teşekkürler aynen yaptım..

Bu gerekli ayarlamayı yaptıkdan sonra tuning-primer.sh yi kaldırmamız gerekiyor mu ? Evetse nasıl kaldıracağız ?

Hayır kaldırmanıza gerek yok, o zaten ufak bir script sadece, çalıştırılmadıkça sistem kaynağı kullanan birşey değil.

Hatta ayda bir çalıştırıp sonuçlara bakın.
 

Türkiye’nin ilk webmaster forum sitesi iyinet.com'da forum üyeleri tarafından yapılan tüm paylaşımlardan; Türk Ceza Kanunu’nun 20. Maddesinin, 5651 Sayılı Kanununun 4. maddesinin 2. fıkrasına göre, paylaşım yapan üyeler sorumludur.

Üst