Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

MySQL optimization - Hey Tristan....

Discussion in 'Workarounds and Optimization' started by pcshost, Apr 20, 2011.

  1. pcshost

    pcshost Member

    Jun 17, 2008
    Likes Received:
    Trophy Points:
    I have a hosted customer using an XCart store that complains about pages taking over 20 seconds to load. I've never seen this but I thought I'd try and check a few things out. Fireplace Painting - Fireplace Paint. My questions are:

    1) if I delete tmp files not accessed in 24 hours in eAccelertor every night at midnight would this cause the cache to slow down the server because of rebuilding.

    2) If I move the eAccelertor to a seperate backup drive and not delete at night will that help speed up data processing.

    3) Will recompling to PHP 5.3 cause issues? (see stat's below)

    4) I don't compress all content, just data. That should be adequate but the customer says I don't have ZLIB compression on. I did test compression at and that seemed to validate my box.

    My server is coming up on 3 years old. Duo-Core 4GB RAM w/ a bastardized OLM.NET Kernel to run the 4GB. (32bit) My resources are low at best. Only 100 domains and only a few stores. MYSQLTUNER report below as well.

    -- John --
    PHP 5.2.16 (cli) (built: Jan 25 2011 18:48:11)
    Copyright (c) 1997-2010 The PHP Group
    Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
    with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator
    with the ionCube PHP Loader v3.3.20, Copyright (c) 2002-2010, by ionCube Ltd., and
    with Zend Optimizer v3.3.9, Copyright (c) 1998-2009, by Zend Technologies
    with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH

    MY SQL Tuner report:

    MySQLTuner 1.0.1 - Major Hayden <>
    >> Bug reports, feature requests, and downloads at
    >> 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.92-community
    [!!] Switch to 64-bit OS - MySQL cannot currently use all of your RAM

    -------- Storage Engine Statistics -------------------------------------------
    [--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
    [--] Data in MyISAM tables: 1002M (Tables: 2943)
    [--] Data in InnoDB tables: 553M (Tables: 405)
    [!!] Total fragmented tables: 50

    -------- Performance Metrics -------------------------------------------------
    [--] Up for: 40d 5h 54m 38s (40M q [11.683 qps], 1M conn, TX: 3B, RX: 1B)
    [--] Reads / Writes: 60% / 40%
    [--] Total buffers: 298.0M global + 6.3M per thread (250 max threads)
    [OK] Maximum possible memory usage: 1.8G (46% of installed RAM)
    [OK] Slow queries: 0% (271/40M)
    [OK] Highest usage of available connections: 84% (210/250)
    [OK] Key buffer size / total MyISAM indexes: 256.0M/363.5M
    [OK] Key buffer hit rate: 100.0% (3B cached / 1M reads)
    [OK] Query cache efficiency: 74.5% (20M cached / 28M selects)
    [!!] Query cache prunes per day: 86704
    [OK] Sorts requiring temporary tables: 0% (2K temp sorts / 3M sorts)
    [!!] Joins performed without indexes: 205594
    [!!] Temporary tables created on disk: 32% (2M on disk / 6M total)
    [OK] Thread cache hit rate: 99% (1K created / 1M connections)
    [!!] Table cache hit rate: 11% (3K open / 34K opened)
    [OK] Open file limit used: 9% (6K/65K)
    [OK] Table locks acquired immediately: 99% (22M immediate / 22M locks)
    [!!] InnoDB data size / buffer pool: 553.2M/8.0M

    -------- Recommendations -----------------------------------------------------
    General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    Enable the slow query log to troubleshoot bad queries
    Adjust your join queries to always utilize indexes
    When making adjustments, make tmp_table_size/max_heap_table_size equal
    Reduce your SELECT DISTINCT queries without LIMIT clauses
    Increase table_cache gradually to avoid file descriptor limits
    Variables to adjust:
    query_cache_size (> 16M)
    join_buffer_size (> 128.0K, or always use indexes with joins)
    tmp_table_size (> 32M)
    max_heap_table_size (> 16M)
    table_cache (> 32637)
    innodb_buffer_pool_size (>= 553M)
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst Staff Member

    Oct 2, 2010
    Likes Received:
    Trophy Points:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Please paste the contents of your /etc/my.cnf file to see your current MySQL configuration so that we can have a baseline for any recommendations. In all instances and every time mysqltuner results are provided, we need the current /etc/my.cnf file contents.
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. pcshost

    pcshost Member

    Jun 17, 2008
    Likes Received:
    Trophy Points:
    Sorry Tristan, thought I'd get an email response saying a reply was posted:

    Here's the info:

    # Example MySQL config file for large systems.
    # This is for a large system with memory = 512M where the system runs mainly
    # MySQL.
    # You can copy this file to
    # /etc/my.cnf to set global options,
    # mysql-data-dir/my.cnf to set server-specific options (in this
    # installation this directory is /var/lib/mysql) or
    # ~/.my.cnf to set user-specific options.
    # In this file, you can use all long options that a program supports.
    # If you want to know which options a program supports, run the program
    # with the "--help" option.

    # The following options will be passed to all MySQL clients
    #password = your_password
    port = 3306
    socket = /var/lib/mysql/mysql.sock

    # Here follows entries for some specific programs

    # The MySQL server
    port = 3306
    socket = /var/lib/mysql/mysql.sock
    key_buffer = 256M
    max_allowed_packet = 1M
    table_cache = 2M
    sort_buffer_size = 1M
    read_buffer_size = 1M
    read_rnd_buffer_size = 4M
    myisam_sort_buffer_size = 64M
    thread_cache_size = 8
    query_cache_size= 16M
    # Try number of CPU's*2 for thread_concurrency
    thread_concurrency = 4
    max_connections = 250

    # Don't listen on a TCP/IP port at all. This can be a security enhancement,
    # if all processes that need to connect to mysqld run on the same host.
    # All interaction with mysqld must be made via Unix sockets or named pipes.
    # Note that using this option without enabling named pipes on Windows
    # (via the "enable-named-pipe" option) will render mysqld useless!

    # Disable Federated by default

    # Replication Master Server (default)
    # binary logging is required for replication

    # required unique id between 1 and 2^32 - 1
    # defaults to 1 if master-host is not set
    # but will not function as a master if omitted
    server-id = 1

    # Replication Slave (comment out master section to use this)
    # To configure this host as a replication slave, you can choose between
    # two methods :
    # 1) Use the CHANGE MASTER TO command (fully described in our manual) -
    # the syntax is:
    # MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
    # where you replace <host>, <user>, <password> by quoted strings and
    # <port> by the master's port number (3306 by default).
    # Example:
    # CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
    # MASTER_USER='joe', MASTER_PASSWORD='secret';
    # OR
    # 2) Set the variables below. However, in case you choose this method, then
    # start replication for the first time (even unsuccessfully, for example
    # if you mistyped the password in master-password and the slave fails to
    # connect), the slave will create a file, and any later
    # change in this file to the variables' values below will be ignored and
    # overridden by the content of the file, unless you shutdown
    # the slave server, delete and restart the slaver server.
    # For that reason, you may want to leave the lines below untouched
    # (commented) and instead use CHANGE MASTER TO (see above)
    # required unique id between 2 and 2^32 - 1
    # (and different from the master)
    # defaults to 2 if master-host is set
    # but will not function as a slave if omitted
    #server-id = 2
    # The replication master for this slave - required
    #master-host = <hostname>
    # The username the slave will use for authentication when connecting
    # to the master - required
    #master-user = <username>
    # The password the slave will authenticate with when connecting to
    # the master - required
    #master-password = <password>
    # The port the master is listening on.
    # optional - defaults to 3306
    #master-port = <port>
    # binary logging - not required for slaves, but recommended

    # Point the following paths to different dedicated disks
    #tmpdir = /tmp/
    #log-update = /path-to-dedicated-directory/hostname

    # Uncomment the following if you are using BDB tables
    #bdb_cache_size = 64M
    #bdb_max_lock = 100000

    # Uncomment the following if you are using InnoDB tables
    #innodb_data_home_dir = /var/lib/mysql/
    #innodb_data_file_path = ibdata1:10M:autoextend
    #innodb_log_group_home_dir = /var/lib/mysql/
    #innodb_log_arch_dir = /var/lib/mysql/
    # You can set .._buffer_pool_size up to 50 - 80 %
    # of RAM but beware of setting memory usage too high
    #innodb_buffer_pool_size = 256M
    #innodb_additional_mem_pool_size = 20M
    # Set .._log_file_size to 25 % of buffer pool size
    #innodb_log_file_size = 64M
    #innodb_log_buffer_size = 8M
    #innodb_flush_log_at_trx_commit = 1
    #innodb_lock_wait_timeout = 50

    max_allowed_packet = 16M

    # Remove the next comment character if you are not familiar with SQL

    key_buffer = 128M
    sort_buffer_size = 128M
    read_buffer = 2M
    write_buffer = 2M

    key_buffer = 128M
    sort_buffer_size = 128M
    read_buffer = 2M
    write_buffer = 2M


Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice