The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Apache mysql Optimized

Discussion in 'EasyApache' started by vishal, Jan 6, 2004.

  1. vishal

    vishal Well-Known Member

    Joined:
    Jan 28, 2003
    Messages:
    340
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    India
    Hello All,

    Redhat 9 (shrike)
    CPanel 8.5.4 S3
    Mysql 4.0.15
    Apache 1.3.29
    PHP 4.3.3

    Server Conf
    ============
    [4 CPUs] Dual Xeon 2.4 1GB RAM 73GB SCSI, 80GB IDE HD

    No of Sites : only 2 (which are very Busy and mysql intensive )

    Http.conf
    =========
    Timeout 300
    KeepAlive On
    MaxKeepAliveRequests 120
    KeepAliveTimeout 10
    MinSpareServers 10
    MaxSpareServers 20
    StartServers 5
    MaxClients 512
    MaxRequestsPerChild 1000

    my.cnf
    ======
    [mysqld]
    set-variable = max_connections=700
    safe-show-database
    key_buffer = 200M
    myisam_sort_buffer_size = 64M
    join_buffer_size = 8M
    read_buffer_size = 8M
    sort_buffer_size = 12M
    table_cache = 1028
    thread_cache_size = 800
    wait_timeout = 10
    interactive_timeout=10
    connect_timeout = 10
    max_allowed_packet = 32M
    max_connect_errors = 10
    thread_concurrency=4
    query_cache_limit = 2M
    query_cache_size = 45M
    query_cache_type = 1
    skip-innodb
    log-slow-queries = /var/log/mysql_slow_query_log
    long_query_time = 5

    [mysqld_safe]
    err-log=/var/log/mysqld.log
    open_files_limit = 8192

    [mysqldump]
    quick
    max_allowed_packet = 16M

    [isamchk]
    key_buffer=64M
    sort_buffer=64M
    read_buffer=16M
    write_buffer=16M

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

    Turck-MMCache Enabled (Zend Extension)

    top
    ====
    05:46:25 up 12 days, 17:35, 3 users, load average: 7.46, 9.02, 10.76
    509 processes: 501 sleeping, 6 running, 1 zombie, 1 stopped
    CPU0 states: 64.2% user 19.1% system 0.1% nice 0.0% iowait 16.0% idle
    CPU1 states: 64.0% user 19.1% system 0.0% nice 0.0% iowait 16.3% idle
    CPU2 states: 60.3% user 23.1% system 0.0% nice 0.0% iowait 16.0% idle
    CPU3 states: 60.2% user 20.5% system 0.0% nice 0.0% iowait 18.3% idle
    Mem: 1030244k av, 912116k used, 118128k free, 0k shrd, 187872k buff
    534216k actv, 49792k in_d, 18180k in_c
    Swap: 2096440k av, 132220k used, 1964220k free 441464k cached

    PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND
    12228 mysql 15 0 23588 20M 1444 S 99.9 2.0 56:42 3 mysqld
    3419 root 15 0 2676 1684 1616 S 7.0 0.1 13:57 1 httpd

    Can Anyone please tell me why I am not able to get the Load Down and the site Load Faster.The server load is always above 5.00

    Thanks in Advance.

    :confused: :( :mad: :eek:
     
  2. vishal

    vishal Well-Known Member

    Joined:
    Jan 28, 2003
    Messages:
    340
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    India
    I Re-Searched a Lot from Google and various Documentaions also from Mailing Lists like Apache,Redhat9,Mysql and finally put Out all togther and here is my latest my.cnf and http.conf

    my.cnf
    ======
    [mysqld]
    set-variable = max_connections=700
    safe-show-database
    key_buffer = 384M
    myisam_sort_buffer_size = 64M
    join_buffer_size = 1M
    read_buffer_size = 1M
    sort_buffer_size = 1M
    table_cache = 512
    thread_cache_size = 1500
    wait_timeout = 10
    interactive_timeout=10
    connect_timeout = 10
    max_allowed_packet = 16M
    max_connect_errors = 10
    thread_concurrency= 8
    query_cache_limit = 2M
    query_cache_size = 32M
    query_cache_type = 1
    skip-innodb
    log-slow-queries = /var/log/mysql_slow_query_log
    long_query_time = 5

    [mysqld_safe]
    err-log=/var/log/mysqld.log
    open_files_limit = 8192

    [mysqldump]
    quick
    max_allowed_packet = 16M

    [isamchk]
    key_buffer = 64M
    sort_buffer_size = 64M
    read_buffer = 16M
    write_buffer = 16M

    [myisamchk]
    key_buffer = 64M
    sort_buffer_size = 64M
    read_buffer = 16M
    write_buffer = 16M

    httpd.conf
    ========
    Http.conf
    =========
    Timeout 300
    KeepAlive Off
    MaxKeepAliveRequests 120
    KeepAliveTimeout 10
    MinSpareServers 10
    MaxSpareServers 20
    StartServers 5
    MaxClients 512
    MaxRequestsPerChild 9000

    But still the Server Load is Between 5.x to 11.x and always stays around these values:

    Wed Jan 7 05:23:02 EST 2004


    05:23:03 up 6:56, 0 users, load average: 9.96, 7.78, 7.47
    299 processes: 296 sleeping, 2 running, 1 zombie, 0 stopped
    CPU0 states: 35.0% user 15.0% system 0.0% nice 0.0% iowait 49.0% idle
    CPU1 states: 39.0% user 23.0% system 0.0% nice 0.0% iowait 36.0% idle
    CPU2 states: 26.0% user 39.0% system 0.0% nice 0.0% iowait 33.1% idle
    CPU3 states: 27.0% user 23.0% system 0.0% nice 0.0% iowait 49.0% idle
    Mem: 1030244k av, 901332k used, 128912k free, 0k shrd, 153184k buff
    413796k actv, 3420k in_d, 3784k in_c
    Swap: 2096440k av, 78080k used, 2018360k free 587292k cached

    PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND
    19111 nobody 20 0 1368 1368 888 R 4.7 0.1 0:00 0 top


    Http processes currently running = 131
    Mysql processes currently running = 105

    Thank you,
     
  3. pguy

    pguy Well-Known Member

    Joined:
    Feb 21, 2003
    Messages:
    73
    Likes Received:
    0
    Trophy Points:
    6
    It must be those forums. The major indication is the number of mysql threads running. I presume you don't run phpsuexec since you have the Turck Cache installed.

    To confirm it, just reboot the machine and let it come back up. After a few minutes check the load. If my hunch about the forums is right, the loads will be low and will gradually build up after a couple of days.

    Regards,
     
  4. mitul

    mitul Well-Known Member

    Joined:
    Feb 8, 2003
    Messages:
    291
    Likes Received:
    0
    Trophy Points:
    16
    This has been Resolved :)
    I asked the Programmer to Optimize the Mysql Queries and the tables, He was using lots of select count queries, reducing those and a little work on optimizing mysql database took the server load to 0.x and now the server is quite stable and the sites are loading Faster.

    Thank you,
     
Loading...

Share This Page