MySQL-Server optimieren

Dieses Thema im Forum "Hosting & Server" wurde erstellt von Creused, 9. Mai 2013 .

  1. 9. Mai 2013
    Hallo,
    ich würde gerne mein MySQL Server checken, und ggf. optimieren.
    Derzeit besteht kein Performanceproblem.

    Inhalte:
    -2x Blogs
    -1x Forum
    -1x Homepage

    Serverinfo:
    Intel Xeon W3530
    8192MB RAM
    500GB SATA (RAID1)

    Jetzige MySQL-Config:
    Spoiler
    Code:
    [mysqld]
    local-infile=0
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    user=mysql
    # Disabling symbolic-links is recommended to prevent assorted security risks
    symbolic-links=0
    
    innodb_buffer_pool_size=2M
    innodb_additional_mem_pool_size=500K
    innodb_log_buffer_size=500K
    innodb_thread_concurrency=2
    [mysqld_safe]
    log-error=/var/log/mysqld.log
    pid-file=/var/run/mysqld/mysqld.pid
    innodb_buffer_pool_size=2M
    innodb_additional_mem_pool_size=500K
    innodb_log_buffer_size=500K
    innodb_thread_concurrency=2

    Tuning Primer Script:
    Spoiler
    Code:
    MySQL Version 5.1.69 x86_64
    
    Avg. qps = 8
    Threads Connected = 2
    
    SLOW QUERIES
    The slow query log is NOT enabled.
    Current long_query_time = 10.000000 sec.
    You have 19 out of 9721049 that take longer than 10.000000 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.1/en/point-in-time-recovery.html
    
    WORKER THREADS
    Current thread_cache_size = 0
    Current threads_cached = 0
    Current threads_per_sec = 3
    Historic threads_per_sec = 0
    Threads created per/sec are overrunning threads cached
    You should raise thread_cache_size
    
    MAX CONNECTIONS
    Current max_connections = 151
    Current threads_connected = 2
    Historic max_used_connections = 12
    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
    
    INNODB STATUS
    Current InnoDB index space = 6 M
    Current InnoDB data space = 5 M
    Current InnoDB buffer pool free = 0 %
    Current innodb_buffer_pool_size = 2 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 : 43 M
    Configured Max Per-thread Buffers : 415 M
    Configured Max Global Buffers : 10 M
    Configured Max Memory Limit : 426 M
    Physical Memory : 8.00 G
    Max memory limit seem to be within acceptable norms
    
    KEY BUFFER
    Current MyISAM index space = 40 M
    Current key_buffer_size = 7 M
    Key cache miss rate is 1 : 1234
    Key buffer free ratio = 81 %
    Your key_buffer_size seems to be fine
    
    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 2089 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 = 1024 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_open_cache = 64 tables
    Current table_definition_cache = 256 tables
    You have a total of 644 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
    You should probably increase your table_definition_cache value.
    
    TEMP TABLES
    Current max_heap_table_size = 16 M
    Current tmp_table_size = 16 M
    Of 729563 temp tables, 22% were created on disk
    Created disk tmp tables ratio seems fine
    
    TABLE SCANS
    Current read_buffer_size = 128 K
    Current table scan ratio = 52 : 1
    read_buffer_size seems to be fine
    
    TABLE LOCKING
    Current Lock Wait ratio = 1 : 8151
    Your table locking seems to be fine
    
    

    Sind die vorgeschlagenen Änderungen sinnvoll?
     
  2. 9. Mai 2013
    AW: MySQL-Server optimieren

    Never touch a running System.
     
  3. 9. Mai 2013
    AW: MySQL-Server optimieren

    innodb_buffer_pool_size = 2M ? das ist viel zu wenig.

    innodb_buffer_pool_size = 512M wohl eher...

    sort_buffer_size = 64M ist empfehlenswert anstelle von 2M

    join_buffer_size = 1M

    query_cache_size = 16M


    table_cache = 1024
    tmp_table_size = 256M
    max_heap_table_size = 512M
     
  4. 9. Mai 2013
    AW: MySQL-Server optimieren

    Kommt immer drauf an für was die DB verwendet wird und welche Hostresourcen man dafür aufbringen will. Ist ja wohl kein dezierter MySQL server.

    So kann z.B. der QueryCache (besonders bei verwendung von HDDs) im Gigabyte Bereich die Performance extrem erhöhen, auf der anderen Seite können aber auch schon Werte im >100 MB bereich extrem bremsen..

    -> MySQL Man Pages + Testen + Messen
     
  5. Video Script

    Videos zum Themenbereich

    * gefundene Videos auf YouTube, anhand der Überschrift.