İ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

stewie

0
İyinet Üyesi
Katılım
11 Mart 2008
Mesajlar
31
Reaction score
0
Merhaba iyinet bana yardımcı olurmusun sunucum donanım olarak çok iyibir makine fakat serverde en ufak sql işlemi olsa makıne kasıyor biçok sitemi kullanmayıyorum 1k hitli video sitemin sqli bile kaıyo nerdeyse aşagıda degerler var bu değerler 1k lik site ile olusan değerler 20k ya yakın bir sitemi actım an makşnem down olucak hale geliyor.
PHP:
        -- MYSQL PERFORMANCE TUNING PRIMER --
             - By: Matthew Montgomery -

MySQL Version 4.1.22-standard i686

Uptime = 3 days 1 hrs 45 min 8 sec
Avg. qps = 7
Total Questions = 2010204
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/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
The slow query log is NOT enabled.
Current long_query_time = 10 sec.
You have 3454 out of 2010218 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/4.1/en/point-in-time-recovery.html

WORKER THREADS
Current thread_cache_size = 0
Current threads_cached = 0
Current threads_per_sec = 5
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 = 2
Historic max_used_connections = 340
The number of used connections is 68% of the configured maximum.
Your max_connections variable seems to be fine.

MEMORY USAGE
Max Memory Ever Allocated : 931 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 = 5 M
Current key_buffer_size = 7 M
Key cache miss rate is 1 : 7699
Key buffer fill ratio = 14.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 read_rnd_buffer_size = 256 K
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 132.00 K
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 = 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 = 64 tables
You have a total of 170 tables
You have 64 open tables.
Current table_cache hit rate is 1%, 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 45706 temp tables, 29% were created on disk
Effective in-memory tmp_table_size is limited to max_heap_table_size.
Perhaps you should increase your tmp_table_size and/or max_heap_table_size
to reduce the number of disk-based temporary tables
Note! BLOB and TEXT columns are not allow in memory tables.
If you are using these columns raising these values might not impact your
ratio of on disk temp tables.

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

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

nasıl configre ederim cpanel kullanıyorum yadımıc olursan sevinirim
 

Bumber

0
İyinet Üyesi
Katılım
15 Şubat 2008
Mesajlar
216
Reaction score
1
Konum
Istanbul
Kafam basmadı bu işe :)

Intel e6600 fs 2.4 Core2duo
2 gb ram

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

MySQL Version 4.1.22 i386

Uptime = 5 days 1 hrs 31 min 12 sec
Avg. qps = 26
Total Questions = 11764611
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
The slow query log is NOT enabled.
Current long_query_time = 10 sec.
You have 1 out of 11764632 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/4.1/en/point-in-time-recovery.html

WORKER THREADS
Current thread_cache_size = 0
Current threads_cached = 0
Current threads_per_sec = 2
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 = 2
Historic max_used_connections = 16
The number of used connections is 3% 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 : 92 M
Configured Max Per-thread Buffers : 1 G
Configured Max Global Buffers : 49 M
Configured Max Memory Limit : 1 G
Physical Memory : 1.99 G
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 301 K
Current key_buffer_size = 7 M
Key cache miss rate is 1 : 281
Key buffer fill ratio = 100.00 %
Your key_buffer_size seems to be fine

QUERY CACHE
Query cache is enabled
Current query_cache_size = 32 M
Current query_cache_used = 21 M
Current query_cache_limit = 1 M
Current Query cache Memory fill ratio = 68.65 %
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 = 132.00 K
You have had 3753 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 = 11095 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 = 128 tables
You have a total of 808 tables
You have 128 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 = 10 M
Of 118038 temp tables, 99% were created on disk
Perhaps you should increase your tmp_table_size and/or max_heap_table_size
to reduce the number of disk-based temporary tables
Note! BLOB and TEXT columns are not allow in memory tables.
If you are using these columns raising these values might not impact your 
ratio of on disk temp tables.

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

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

iyinet

Root
Admin
Hosting Firması
Katılım
2 Eylül 2002
Mesajlar
5,028
Reaction score
62
Konum
Sakarya
Merhaba iyinet bana yardımcı olurmusun sunucum donanım olarak çok iyibir makine fakat serverde en ufak sql işlemi olsa makıne kasıyor biçok sitemi kullanmayıyorum 1k hitli video sitemin sqli bile kaıyo nerdeyse aşagıda degerler var bu değerler 1k lik site ile olusan değerler 20k ya yakın bir sitemi actım an makşnem down olucak hale geliyor.
nasıl configre ederim cpanel kullanıyorum yadımıc olursan sevinirim

Merhabalar, öncelikle belleğe göre my.cnf ayarları bölümüneki hazır paket ayarlardan makinanıza uygun olanı seçip uygulayın.
Değişikliği devreye almanızın ardından mysql 2-3 gün çalışsın.
2-3 gün sonunda my.cnf dosyanızın içeriği ve yeni bir mysql performans raporu ile yeniden yazın, kalan ayarları birlikte yapalım.
 

iyinet

Root
Admin
Hosting Firması
Katılım
2 Eylül 2002
Mesajlar
5,028
Reaction score
62
Konum
Sakarya
Kafam basmadı bu işe :)

Intel e6600 fs 2.4 Core2duo
2 gb ram

Merhabalar, sizden de aynı şeyleri yapmanızı isteyeceğim.
Öncelikle belleğe göre my.cnf ayarları bölümüneki hazır paket ayarlardan makinanıza uygun olanı seçip uygulayın.
Değişikliği devreye almanızın ardından mysql 2-3 gün çalışsın.
2-3 gün sonunda my.cnf dosyanızın içeriği ve yeni bir mysql performans raporu ile yeniden yazın, kalan ayarları birlikte yapalım.
 

stewie

0
İyinet Üyesi
Katılım
11 Mart 2008
Mesajlar
31
Reaction score
0
sağol iyinet peki cpaneldede etc/my.cnf bu dizindemi

etc/my.cnf dizininde

[mysqld]
set-variable = max_connections=500
set-variable = wait_timeout=50
set-variable = interactive_timeout=50
safe-show-database

bu sekılde var fakat bu my.cnf yi arkadaş elıylemi olusturdu ole hatırlıyorum cpanelde faklı biyerde olma itiamli varmı
 

iyinet

Root
Admin
Hosting Firması
Katılım
2 Eylül 2002
Mesajlar
5,028
Reaction score
62
Konum
Sakarya
sağol iyinet peki cpaneldede etc/my.cnf bu dizindemi

etc/my.cnf dizininde

[mysqld]
set-variable = max_connections=500
set-variable = wait_timeout=50
set-variable = interactive_timeout=50
safe-show-database

bu sekılde var fakat bu my.cnf yi arkadaş elıylemi olusturdu ole hatırlıyorum cpanelde faklı biyerde olma itiamli varmı

cpanel konusunu uzmanlık alanım değil. Sorunuzun cevabını bilmiyorum.
 

atay

0
İyinet Üyesi
Katılım
29 Ekim 2005
Mesajlar
3,592
Reaction score
37
rapor şu şekilde:


[root@zeppelin kurulum]# ./tuning-primer.sh

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

MySQL Version 5.0.22 i686

Uptime = 2 days 21 hrs 0 min 56 sec
Avg. qps = 14
Total Questions = 3593733
Threads Connected = 1

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 0 out of 3593755 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 = 128
Current threads_cached = 15
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 = 16
The number of used connections is 3% 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 : 212 M
Configured Max Per-thread Buffers : 1 G
Configured Max Global Buffers : 170 M
Configured Max Memory Limit : 1 G
Physical Memory : 3.83 G
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 34 M
Current key_buffer_size = 128 M
Key cache miss rate is 1 : 18974
Key buffer fill ratio = 14.00 %
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 = 3 M
Current query_cache_limit = 4 M
Current Query cache Memory fill ratio = 10.29 %
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.
Your query_cache_size seems to be too high.
Perhaps you can use these resources elsewhere
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 = 132.00 K
You have had 9 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 = 4510 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 = 2000 tables
You have a total of 261 tables
You have 449 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 62551 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 = 128 K
Current table scan ratio = 819 : 1
read_buffer_size seems to be fine

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

[root@zeppelin kurulum]#


teşekkürler.
 

iyinet

Root
Admin
Hosting Firması
Katılım
2 Eylül 2002
Mesajlar
5,028
Reaction score
62
Konum
Sakarya
@atay, ayarlar olmasi gerektiginden yuksek gorunuyor.
Bu az olmasindan iyidir.
Ancak tam olarak anlayabilmek icin mysqli kapatmadan 10 gun kadar daha bekleyip bu ciktiyi tekrar almak.
 

bilmiyorum

0
İyinet Üyesi
Katılım
10 Şubat 2007
Mesajlar
42
Reaction score
0
tuning-primer.sh ile forumdaki örneklere bakarak yaptığım ayarlar ile 1 haftadır gözle görülür performans artışı sağladım.

Aşağıdaki son rapora göre kalan bir kaç problem var onları da çözmeliyim, kontrol ve yardım ederseniz sevinirim.

AMD 2.8 - 2GB RAM
my.cnf
[mysqld]
set-variable=local-infile=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
log-slow-queries=/var/log/mysql-slow.log
log-queries-not-using-indexes

old_passwords=1
max_allowed_packet=64M
max_connections=200
query_cache_type=1
query_cache_size=32M
query_cache_limit=4M
skip-locking
skip-name-resolve
low_priority_updates=1
table_cache=512
thread_cache_size=256
key_buffer=32M
long_query_time=4

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

[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
-- MYSQL PERFORMANCE TUNING PRIMER --
- By: Matthew Montgomery -

MySQL Version 5.0.54-log i686

Uptime = 2 days 0 hrs 3 min 10 sec
Avg. qps = 67
Total Questions = 11729337
Threads Connected = 1

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 enabled.
Current long_query_time = 4 sec.
You have 154746 out of 11729358 that take longer than 4 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 = 256
Current threads_cached = 78
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine

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

MEMORY USAGE
Max Memory Ever Allocated : 286 M
Configured Max Per-thread Buffers : 537 M
Configured Max Global Buffers : 74 M
Configured Max Memory Limit : 611 M
Physical Memory : 1.97 G
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 2 M
Current key_buffer_size = 32 M
Key cache miss rate is 1 : 216636
Key buffer fill ratio = 3.00 %
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 = 14 M
Current query_cache_limit = 4 M
Current Query cache Memory fill ratio = 44.33 %
Current query_cache_min_res_unit = 4 K
Query Cache is 31 % 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 = 2 M
Current read_rnd_buffer_size = 256 K
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 132.00 K
You have had 7 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 = 1234 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 162 tables
You have 322 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 52129 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 = 128 K
Current table scan ratio = 4774 : 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 : 2574
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'.
 

iyinet

Root
Admin
Hosting Firması
Katılım
2 Eylül 2002
Mesajlar
5,028
Reaction score
62
Konum
Sakarya
tuning-primer.sh ile forumdaki örneklere bakarak yaptığım ayarlar ile 1 haftadır gözle görülür performans artışı sağladım.

Aşağıdaki son rapora göre kalan bir kaç problem var onları da çözmeliyim, kontrol ve yardım ederseniz sevinirim.

AMD 2.8 - 2GB RAM
my.cnf

@bilmiyorum, oncelikle forumdan arastirip - ardindan sonuclari gozlemleyip - sorunu sordugun icin tesekkur ederim. Boylece hem sen ogrenmis oldun hem de biz sadece kalan sorunlar ile ugrasmis oluyoruz.

Veritabaninin bu hali ile my.cnf ayarlarini daha iyi hale getirebilecegimizi sanmiyorum. Veritabaninda sanki yeterince index yok gibi.

"You have 154746 out of 11729358 that take longer than 4 sec."
Bu satir 154746 sorgunun 4 saniyeden fazla surdugunu soyluyor. Sorgular tablo uzerinde index olmayinca uzun surer.

"MyISAM index space = 2 M"
Ya tablo boylarin cok ufak yada yukarida dedigim gibi tablolarinda yeterince index yok.

Innodb kullaniyormusun?

Replication kullanmiyorsan asagidaki satiri kaldir:
set-variable=local-infile=0

Veritabanin uzerinde calisan uygulama nedir (gizli bir bilgi degilse)?
 

bilmiyorum

0
İyinet Üyesi
Katılım
10 Şubat 2007
Mesajlar
42
Reaction score
0
Yukarıya yazdığım son raporu almadan 1 gün önce test amaçlı mysql-indexleri yapılmış olan sitelerin mysql-indexlerini kaldırmıştım, az önce mysql-indexlerini tekrar eski haline düzenledim ve aşağıdaki değerleri düzenledim.

key_buffer=64M #eskideğer-32M
query_cache_size=64M #eskideğer-32M


Innodb özelliğini sadece Plesk panel kullanıyor, myisam kullanıyorum.

Sunucuda toplam 5 adet, boyutları 1-50mb / 500-90.000 satır arası 5 veritabanı var,
gizli değil şahsi sitelerim php+mysql ve sistem kaynaklarını mümkün olduğunca az kullanan scriptler. Forum/portal gibi ağır scriptler yok ve sitelerde file-caching yöntemi ile sql konusunda işlemciye yardımcı oluyorum fakat sunucunun işlemcisi yetmiyor. Online kişilerin yoğun olduğu zamanlarda genelde arama(like) sql sorguları yüzünden CPU %90 lara kadar çıkıyor :)
 

iyinet

Root
Admin
Hosting Firması
Katılım
2 Eylül 2002
Mesajlar
5,028
Reaction score
62
Konum
Sakarya
- Bir onceki mesajimda bahsettigim
set-variable=local-infile=0
satirini my.cnf den kaldir.

- Bunlari eski degerine getir:
key_buffer=64M #eskideğer-32M
query_cache_size=64M #eskideğer-32M

- Innodb icin asagidaki ayarlari ekle
innodb_buffer_pool_size=32M
innodb_additional_mem_pool_size=16M
innodb_thread_concurrency=8
innodb_flush_method=O_DIRECT

PHP ye kurulu degilse Xcache yada eAccelerator kur.
 

aLcadraz

0
İyinet Üyesi
Katılım
24 Mart 2005
Mesajlar
106
Reaction score
0
tuning-primer.sh çıktısı :

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

MySQL Version 4.1.22-standard i686

Uptime = 3 days 17 hrs 10 min 19 sec
Avg. qps = 51
Total Questions = 16455832
Threads Connected = 71

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

WORKER THREADS
Current thread_cache_size = 8
Current threads_cached = 7
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 = 71
Historic max_used_connections = 228
The number of used connections is 45% of the configured maximum.
Your max_connections variable seems to be fine.

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

KEY BUFFER
Current MyISAM index space = 333 M
Current key_buffer_size = 7 M
Key cache miss rate is 1 : 166
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 = 32 M
Current query_cache_used = 22 M
Current query_cache_limit = 4 M
Current Query cache Memory fill ratio = 70.09 %
Current query_cache_min_res_unit = 4 K
Query Cache is 15 % 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 = 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 400 queries where a join could not use an index properly
You have had 3 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 = 4510 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 = 2000 tables
You have a total of 1090 tables
You have 1935 open tables.
Current table_cache hit rate is 52%, while 96% 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 386548 temp tables, 6% 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 = 804 : 1
read_buffer_size seems to be fine

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


şuanki mysql.cnf :
Kod:
[mysqld]
set-variable = max_connections=500
safe-show-database
skip-locking
skip-name-resolve
long_query_time = 5
thread_cache_size = 8
query_cache_type = 1
query_cache_size = 32M
query_cache_limit = 4M
table_cache = 2000
low_priority_updates = 1

4gb ram var ama swap kullanımı çok fazla :s
 

iyinet

Root
Admin
Hosting Firması
Katılım
2 Eylül 2002
Mesajlar
5,028
Reaction score
62
Konum
Sakarya
4gb ram var ama swap kullanımı çok fazla :s

MySQL e baslamadan once makinada neden swap cok kullaniyor once onun kaynagini bulmak lazim.
top
yazip ardindan
M (buyuk harfler)
e basin, en usste en cok bellek tuketen proseslerin listesini gorebilirsiniz.
 

aLcadraz

0
İyinet Üyesi
Katılım
24 Mart 2005
Mesajlar
106
Reaction score
0
MySQL e baslamadan once makinada neden swap cok kullaniyor once onun kaynagini bulmak lazim.
top
yazip ardindan
M (buyuk harfler)
e basin, en usste en cok bellek tuketen proseslerin listesini gorebilirsiniz.

mesajımdan sonra sunucuya restart atmıştım şuan swap kullanımı yok

top çıktısı :
Kod:
[root@host ~]# top
top - 19:19:04 up  2:54,  1 user,  load average: 1.03, 1.00, 1.03
Tasks: 268 total,   3 running, 265 sleeping,   0 stopped,   0 zombie
Cpu(s): 16.7% us,  1.3% sy,  0.0% ni, 81.6% id,  0.2% wa,  0.0% hi,  0.1% si
Mem:   3116652k total,  2707528k used,   409124k free,    58992k buffers
Swap:  2000968k total,        0k used,  2000968k free,   708196k cached

  PID USER      PR  NI %CPU    TIME+  %MEM  VIRT  RES  SHR S COMMAND                                                                          
 4543 mysql     20   0    3  28:13.79  2.9  161m  87m 3596 S mysqld                                                                           
 4987 nobody    20   0    0   0:48.84  1.1 42808  32m 3156 S httpd                                                                            
 4990 nobody    20   0    0   1:17.80  1.0 39696  29m 3312 S httpd                                                                            
 4945 nobody    20   0    2   1:10.89  0.9 37752  27m 3344 S httpd                                                                            
 4983 nobody    20   0    0   1:05.10  0.9 37508  27m 3432 S httpd                                                                            
 4972 nobody    20   0    5   1:03.16  0.9 37716  27m 3148 S httpd                                                                            
 4958 nobody    20   0    0   1:07.71  0.9 37632  27m 3336 S httpd                                                                            
 4994 nobody    20   0    0   0:51.48  0.9 37508  27m 3180 S httpd                                                                            
 4984 nobody    20   0    0   1:34.48  0.9 37284  27m 3308 S httpd                                                                            
 4948 nobody    20   0    0   1:12.47  0.9 37136  27m 3424 S httpd                                                                            
 6127 nobody    20   0    0   0:47.61  0.9 37132  27m 3232 S httpd                                                                            
 5011 nobody    20   0    0   1:18.24  0.9 36892  27m 3312 S httpd                                                                            
 4989 nobody    20   0    0   0:55.59  0.9 37052  27m 3136 S httpd                                                                            
 5008 nobody    20   0    0   1:09.12  0.9 37004  27m 3340 S httpd                                                                            
 4997 nobody    20   0    0   1:08.36  0.9 36648  26m 3312 S httpd                                                                            
 4933 nobody    20   0    0   1:05.80  0.9 36756  26m 3144 S httpd                                                                            
 4961 nobody    20   0    0   1:05.66  0.9 36784  26m 3296 S httpd                                                                            
 6128 nobody    20   0    0   1:12.28  0.9 36668  26m 3208 S httpd                                                                            
 9728 nobody    20   0    0   0:30.39  0.9 36576  26m 3272 S httpd                                                                            
 5002 nobody    20   0    0   1:12.45  0.9 36708  26m 3152 S httpd                                                                            
 4943 nobody    20   0    0   1:15.11  0.9 36500  26m 3216 S httpd                                                                            
 4995 nobody    20   0    0   1:01.13  0.9 36528  26m 3176 S httpd                                                                            
 4964 nobody    20   0    0   1:02.08  0.9 36508  26m 3160 S httpd                                                                            
 4790 nobody    20   0    0   1:05.30  0.9 35996  26m 3220 S httpd                                                                            
 4988 nobody    20   0    0   1:01.13  0.8 35380  25m 3220 S httpd                                                                            
 7273 nobody    20   0    0   0:48.22  0.8 35308  25m 3272 S httpd                                                                            
 4996 nobody    20   0    0   1:04.31  0.8 35260  25m 3292 S httpd                                                                            
 4789 nobody    20   0    0   0:57.84  0.8 35120  25m 3144 S httpd                                                                            
 4734 root      20   0    0   0:01.15  0.8 27524  24m 1956 S spamd                                                                            
 5141 root      20   0    0   0:01.15  0.8 27784  24m 1468 S spamd                                                                            
 5006 nobody    20   0    0   1:17.35  0.8 34352  24m 3312 S httpd

swap kullanıldığında en fazla ram harcayan değerde webarsiv yazıyordu. webarsiv.com vbulletin forum zoints seo kullanıyor
 

iyinet

Root
Admin
Hosting Firması
Katılım
2 Eylül 2002
Mesajlar
5,028
Reaction score
62
Konum
Sakarya
mesajımdan sonra sunucuya restart atmıştım şuan swap kullanımı yok

top çıktısı :
Kod:
[root@host ~]# top
top - 19:19:04 up  2:54,  1 user,  load average: 1.03, 1.00, 1.03
Tasks: 268 total,   3 running, 265 sleeping,   0 stopped,   0 zombie
Cpu(s): 16.7% us,  1.3% sy,  0.0% ni, 81.6% id,  0.2% wa,  0.0% hi,  0.1% si
Mem:   3116652k total,  2707528k used,   409124k free,    58992k buffers
Swap:  2000968k total,        0k used,  2000968k free,   708196k cached

  PID USER      PR  NI %CPU    TIME+  %MEM  VIRT  RES  SHR S COMMAND                                                                          
 4543 mysql     20   0    3  28:13.79  2.9  161m  87m 3596 S mysqld                                                                           
 4987 nobody    20   0    0   0:48.84  1.1 42808  32m 3156 S httpd                                                                            
 4990 nobody    20   0    0   1:17.80  1.0 39696  29m 3312 S httpd                                                                            
 4945 nobody    20   0    2   1:10.89  0.9 37752  27m 3344 S httpd                                                                            
 4983 nobody    20   0    0   1:05.10  0.9 37508  27m 3432 S httpd                                                                            
 4972 nobody    20   0    5   1:03.16  0.9 37716  27m 3148 S httpd                                                                            
 4958 nobody    20   0    0   1:07.71  0.9 37632  27m 3336 S httpd                                                                            
 4994 nobody    20   0    0   0:51.48  0.9 37508  27m 3180 S httpd                                                                            
 4984 nobody    20   0    0   1:34.48  0.9 37284  27m 3308 S httpd                                                                            
 4948 nobody    20   0    0   1:12.47  0.9 37136  27m 3424 S httpd                                                                            
 6127 nobody    20   0    0   0:47.61  0.9 37132  27m 3232 S httpd                                                                            
 5011 nobody    20   0    0   1:18.24  0.9 36892  27m 3312 S httpd                                                                            
 4989 nobody    20   0    0   0:55.59  0.9 37052  27m 3136 S httpd                                                                            
 5008 nobody    20   0    0   1:09.12  0.9 37004  27m 3340 S httpd                                                                            
 4997 nobody    20   0    0   1:08.36  0.9 36648  26m 3312 S httpd                                                                            
 4933 nobody    20   0    0   1:05.80  0.9 36756  26m 3144 S httpd                                                                            
 4961 nobody    20   0    0   1:05.66  0.9 36784  26m 3296 S httpd                                                                            
 6128 nobody    20   0    0   1:12.28  0.9 36668  26m 3208 S httpd                                                                            
 9728 nobody    20   0    0   0:30.39  0.9 36576  26m 3272 S httpd                                                                            
 5002 nobody    20   0    0   1:12.45  0.9 36708  26m 3152 S httpd                                                                            
 4943 nobody    20   0    0   1:15.11  0.9 36500  26m 3216 S httpd                                                                            
 4995 nobody    20   0    0   1:01.13  0.9 36528  26m 3176 S httpd                                                                            
 4964 nobody    20   0    0   1:02.08  0.9 36508  26m 3160 S httpd                                                                            
 4790 nobody    20   0    0   1:05.30  0.9 35996  26m 3220 S httpd                                                                            
 4988 nobody    20   0    0   1:01.13  0.8 35380  25m 3220 S httpd                                                                            
 7273 nobody    20   0    0   0:48.22  0.8 35308  25m 3272 S httpd                                                                            
 4996 nobody    20   0    0   1:04.31  0.8 35260  25m 3292 S httpd                                                                            
 4789 nobody    20   0    0   0:57.84  0.8 35120  25m 3144 S httpd                                                                            
 4734 root      20   0    0   0:01.15  0.8 27524  24m 1956 S spamd                                                                            
 5141 root      20   0    0   0:01.15  0.8 27784  24m 1468 S spamd                                                                            
 5006 nobody    20   0    0   1:17.35  0.8 34352  24m 3312 S httpd
swap kullanıldığında en fazla ram harcayan değerde webarsiv yazıyordu. webarsiv.com vbulletin forum zoints seo kullanıyor

yogun swap baslayinca ayni ciktiyi koy inceleyelim, simdi soylenebilecek fazla bisey yok.
4Gb RAM var demissin ama 3Gb ram gorunuyor.
 

aLcadraz

0
İyinet Üyesi
Katılım
24 Mart 2005
Mesajlar
106
Reaction score
0
şuan ram kullanımı %15 olmasına rağmen swap da kullanılıyor

top - 11:51:36 up 19:26, 1 user, load average: 0.22, 0.55, 1.17
Tasks: 163 total, 2 running, 161 sleeping, 0 stopped, 0 zombie
Cpu(s): 36.8% us, 3.1% sy, 0.0% ni, 58.4% id, 1.6% wa, 0.0% hi, 0.1% si
Mem: 3116652k total, 2826164k used, 290488k free, 11684k buffers
Swap: 2000968k total, 161376k used, 1839592k free, 2314784k cached

PID USER PR NI %CPU TIME+ %MEM VIRT RES SHR S COMMAND
4543 mysql 20 0 20 98:48.68 2.1 153m 63m 2872 S mysqld
5141 root 20 0 0 0:07.69 0.6 27784 17m 1368 S spamd
1162 nobody 20 0 0 0:06.89 0.6 27488 17m 3124 S httpd
1144 nobody 20 0 0 0:05.10 0.6 27228 17m 3140 S httpd
1149 nobody 20 0 0 0:08.18 0.6 26612 16m 3128 S httpd
1142 nobody 20 0 2 0:10.46 0.5 26676 16m 3128 S httpd
1147 nobody 20 0 0 0:05.73 0.5 26604 16m 3204 S httpd
1148 nobody 20 0 0 0:07.84 0.5 26432 16m 3324 S httpd
1157 nobody 20 0 4 0:07.17 0.5 26352 16m 3188 S httpd
1158 nobody 20 0 18 0:07.29 0.5 26400 16m 3216 S httpd
1153 nobody 20 0 5 0:04.82 0.5 26164 16m 3280 S httpd
1138 nobody 20 0 0 0:07.22 0.5 26172 16m 3136 S httpd
1146 nobody 20 0 0 0:03.99 0.5 26156 16m 3204 S httpd
1139 nobody 20 0 0 0:04.62 0.5 26040 16m 3200 S httpd
1150 nobody 20 0 0 0:05.46 0.5 26124 16m 3208 S httpd
1145 nobody 20 0 2 0:06.69 0.5 26012 16m 3144 S httpd
1370 nobody 20 0 5 0:05.24 0.5 25980 16m 3200 S httpd
1143 nobody 20 0 24 0:07.49 0.5 25764 16m 3300 S httpd
1316 nobody 20 0 0 0:02.45 0.5 25772 15m 3176 S httpd
1152 nobody 20 0 0 0:08.01 0.5 25780 15m 3200 S httpd
1155 nobody 20 0 0 0:04.97 0.5 25736 15m 3216 S httpd
1137 nobody 20 0 0 0:07.16 0.5 25632 15m 3292 S httpd
1136 nobody 20 0 0 0:09.38 0.5 25728 15m 3208 S httpd
1154 nobody 20 0 0 0:06.49 0.5 25604 15m 3160 S httpd
1141 nobody 20 0 0 0:03.20 0.5 25764 15m 2944 S httpd
1140 nobody 20 0 0 0:12.32 0.5 24948 15m 3132 S httpd
1161 nobody 20 0 0 0:07.69 0.5 24644 14m 3204 S httpd
1369 nobody 20 0 0 0:04.88 0.5 24388 14m 3064 S httpd
1307 nobody 20 0 0 0:04.91 0.5 24128 14m 3168 S httpd
1135 nobody 20 0 4 0:04.98 0.5 23756 14m 3296 S httpd
1151 nobody 20 0 3 0:04.05 0.5 23728 13m 3132 S httpd
 

bilmiyorum

0
İyinet Üyesi
Katılım
10 Şubat 2007
Mesajlar
42
Reaction score
0
- Bir onceki mesajimda bahsettigim
set-variable=local-infile=0
satirini my.cnf den kaldir.

- Bunlari eski degerine getir:
key_buffer=64M #eskideğer-32M
query_cache_size=64M #eskideğer-32M

- Innodb icin asagidaki ayarlari ekle
innodb_buffer_pool_size=32M
innodb_additional_mem_pool_size=16M
innodb_thread_concurrency=8
innodb_flush_method=O_DIRECT

PHP ye kurulu degilse Xcache yada eAccelerator kur.


iyinet: tavsiyelerinden 2 gün sonra aldığım rapora göre sonuçlar aşağıda.
Anladığım kadarıyla, key_buffer değerini azaltıp, zend'i kaldırıp xcache veya eaccelerator kurmak harici yapılacak birşey kalmıyor değil mi ?

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

old_passwords=1
max_allowed_packet=64M
max_connections=200
query_cache_type=1
query_cache_size=32M
query_cache_limit=4M
skip-locking
skip-name-resolve
low_priority_updates=1
table_cache=512
thread_cache_size=256
key_buffer=32M
long_query_time=4

innodb_buffer_pool_size=32M
innodb_additional_mem_pool_size=16M
innodb_thread_concurrency=8
innodb_flush_method=O_DIRECT

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

[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

Amd 2.8 CPU / 2GBRAM


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

MySQL Version 5.0.54 i686

Uptime = 2 days 1 hrs 5 min 19 sec
Avg. qps = 67
Total Questions = 11966357
Threads Connected = 1

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 = 4 sec.
You have 12 out of 11966487 that take longer than 4 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 = 256
Current threads_cached = 91
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine

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

MEMORY USAGE
Max Memory Ever Allocated : 360 M
Configured Max Per-thread Buffers : 537 M
Configured Max Global Buffers : 113 M
Configured Max Memory Limit : 650 M
Physical Memory : 1.97 G
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 9 M
Current key_buffer_size = 32 M
Key cache miss rate is 1 : 12575
Key buffer fill ratio = 25.00 %
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 = 20 M
Current query_cache_limit = 4 M
Current Query cache Memory fill ratio = 63.22 %
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 = 132.00 K
You have had 1 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 = 1234 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 162 tables
You have 307 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 47725 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 = 128 K
Current table scan ratio = 3459 : 1
read_buffer_size seems to be fine

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

iyinet

Root
Admin
Hosting Firması
Katılım
2 Eylül 2002
Mesajlar
5,028
Reaction score
62
Konum
Sakarya
iyinet: tavsiyelerinden 2 gün sonra aldığım rapora göre sonuçlar aşağıda.
Anladığım kadarıyla, key_buffer değerini azaltıp, zend'i kaldırıp xcache veya eaccelerator kurmak harici yapılacak birşey kalmıyor değil mi ?



Amd 2.8 CPU / 2GBRAM


Xcache i php 5.1 in ustunu kullaniyorsan kur, aksi taktirde eaccelerator kur.
Zend i kaldirip kaldirmamak sana kalmis, kullanmiyorsan kaldir.
Xcache yada eaccelerator u kurunca php.ini icinde onlarin satirlarini Zend den once koymayi unutma!
Innodb parametrelerini de eklmeyi unutma onlarda onemli.
key_buffer ve query_cache degerlerini performans raporu ile arada bir kontrol ederek ayarla.

MySQL optimizasyonu 1 seferlik bir degil, 3-5 ayda bir elden gecirmekte fayda var.
 

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.

Backlink ve Tanıtım Yazısı için iletişime geçmek için Skype Adresimiz: .cid.1580508955483fe5

Üst