The UNIX and Linux Forums  


Go Back   UNIX och Linux Forum > Särskilda Forum > Webb Programmering, Web 2.0 och mashups
.
google unix.com



Webb Programmering, Web 2.0 och mashups Diskutera Web Programming och Web Server administration, inklusive LAMP, Apache, MySQL, Flash, HTML, SEO, mashups och andra Web API och ämnen.

Mer UNIX och Linux Forum Ämnen Du kan hitta Helpful
Tråd Thread Starter Forum Svar Senaste Inlägg
tuning naresh.sun Sun Solaris 4 05-21-2008 02:25
Tuning AIX IO theerthan UNIX för avancerade & Expertanvändare 1 04-06-2008 10:12
SAS Tuning alex blanco UNIX för avancerade & Expertanvändare 1 07-10-2007 01:08
Tuning Apache edkung UNIX för avancerade & Expertanvändare 2 08-13-2003 02:30

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Sök i denna tråd Omdöme: Thread Rating: 2 votes, 5.00 average. Visningslägen
  #1 (permalänk)  
Old 08-01-2008
Neo's Avatar
Neo Neo is online now Forum Staff  
Administratör
  
 

Join Date: Sep 2000
Ort: Asia Pacific
Inlägg: 6.803
MySQL Tuning Tools med mysqltuner.pl och tuning-primer.sh

Vi har varit tuning MySQL sistone och jag sprang accoss två användbara verktyg som du kan vara intresserade av:
  1. mysqltuner.pl
  2. tuning-primer.sh

Båda dessa skript är ganska nyttigt för MySQL tuning. Här är några exempel produktion av mysqltuner.pl


Kod:
 >>  MySQLTuner 0.9.8 - Major Hayden <major@mhtx.net>
 >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/
 >>  Run with '--help' for additional options and output filtering

-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.0.51a-3ubuntu5.1-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: 525M (Tables: 385)
[--] Data in MEMORY tables: 1M (Tables: 4)
[!!] Total fragmented tables: 19

-------- Performance Metrics -------------------------------------------------
[--] Up for: 2h 48m 41s (562K q [55.592 qps], 48K conn, TX: 177M, RX: 164M)
[--] Reads / Writes: 77% / 23%
[--] Total buffers: 3.0M per thread and 354.0M global
[OK] Maximum possible memory usage: 1.5G (76% of installed RAM)
[OK] Slow queries: 3% (21K/562K)
[OK] Highest usage of available connections: 7% (29/400)
[OK] Key buffer size / total MyISAM indexes: 128.0M/309.2M
[OK] Key buffer hit rate: 100.0%
[OK] Query cache efficiency: 60.6%
[OK] Query cache prunes per day: 0
[!!] Sorts requiring temporary tables: 13%
[OK] Temporary tables created on disk: 12%
[OK] Thread cache hit rate: 99%
[OK] Table cache hit rate: 94%
[OK] Open file limit used: 44%
[OK] Table locks acquired immediately: 99%

-------- 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:
    sort_buffer_size (> 1M)
    read_rnd_buffer_size (> 524K)

och här är några exempel på utdata från tuning-primer.sh


Kod:
mysqld is alive

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

MySQL Version 5.0.51a-3ubuntu5.1-log i486

Uptime = 0 days 2 hrs 55 min 42 sec
Avg. qps = 55
Total Questions = 584995
Threads Connected = 4

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 = 5 sec.
You have 21921 out of 585073 that take longer than 5 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 = 8
Current threads_cached = 6
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine

MAX CONNECTIONS
Current max_connections = 400
Current threads_connected = 2
Historic max_used_connections = 29
The number of used connections is 7% 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 : 425 M
Configured Max Per-thread Buffers : 1 G
Configured Max Global Buffers : 338 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 = 309 M
Current key_buffer_size = 128 M
Key cache miss rate is 1 : 2158
Key buffer fill ratio = 17.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 = 200 M
Current query_cache_used = 25 M
Current query_cache_limit = 1 M
Current Query cache Memory fill ratio = 12.95 %
Current query_cache_min_res_unit = 4 K
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 = 524 K
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 256.00 K
You have had 18 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 = 2000 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 = 550 tables
You have a total of 406 tables
You have 498 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 5632 temp tables, 13% 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 = 204 : 1
read_buffer_size seems to be fine

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

Mycket användbar, tycker jag.
  #2 (permalänk)  
Old 08-06-2008
vinna gain is offline
Registered User
  
 

Join Date: Aug 2008
Inlägg: 1
Question Minnesanvändning matchar inte

Hej!

Jag har använt båda dessa verktyg för någon nu. Men om man tittar på båda utgångarna ni se att minnesanvändningen returneras av tuning_primer.sh är mindre än för mysqltuner.pl.

Nu, vilken av dessa två säger det rätta?

Några idéer?
  #3 (permalänk)  
Old 10-14-2008
Neo's Avatar
Neo Neo is online now Forum Staff  
Administratör
  
 

Join Date: Sep 2000
Ort: Asia Pacific
Inlägg: 6.803
Minnet siffror är både korrekt. Du jämför äpplen och apelsiner.
  #4 (permalänk)  
Old 12-06-2008
shantanuo shantanuo is offline
Registered User
  
 

Join Date: Aug 2008
Plats: Mumbai
Inlägg: 79
>> Mycket värdefullt, tycker jag.

Ja, verkligen.
Reply

Komihåglista

Taggar
mysql, mysqltuner.pl, Performance Tuning, tuning-primer.sh

Thread Tools Sök i denna tråd
Sök i denna tråd:

Avancerad sökning
Visningslägen Betygsätt denna tråd
Betygsätt denna tråd:

Utstationering Regler
Du får inte efter nya trådar
Du får inte efter svar
Du får inte skicka bilagor
Du får inte redigera dina inlägg

BB-kod är
Smilies är
[IMG] kod
HTML-koden är Av
Trackback är
Pingbacks är
Refbacks är




Alla tider är GMT -4. Klockan är nu 07:39.


Powered by: vBulletin, Copyright © 2000 - 2006, Jelsoft Enterprises Limited. Översättningar Powered by .
vBCredits v1.4 Copyright © 2007 - 2008, PixelFX Studios
UNIX och Linux Forum Innehållet upphovsrättsskyddat © 1993-2009. All Rights Reserved.Ad förvaltning RedTyger

Content Relevant webbadresser från vBSEO 3.2.0