hope can help me for server load problem.

Discussion in 'Site & Server Administration' started by usbiz, Oct 24, 2007.

  1. #1
    when i use a software update my site.maybe the sofe use mysql and httpd much.

    the load of the server ofen goes high.i can only restart httped or mysql .

    some info about the server when load is high.

    hoep can gave me some advice.thank you.


    [root@server ~]# free
    total used free shared buffers cached
    Mem: 1033676 1018980 14696 0 4352 428756
    -/+ buffers/cache: 585872 447804
    Swap: 2040244 132660 1907584

    [root@server ~]# ps aux | grep mysql | wc -l
    3
    [root@server ~]# ps aux | grep httpd | wc -l
    66



    [root@server ~]# mysqladmin -u root -p extended-status
    Enter password:
    +----------------------------+-----------+
    | Variable_name | Value |
    +----------------------------+-----------+
    | Aborted_clients | 2 |
    | Aborted_connects | 89 |
    | Binlog_cache_disk_use | 0 |
    | Binlog_cache_use | 0 |
    | Bytes_received | 61741575 |
    | Bytes_sent | 11783074 |
    | Com_admin_commands | 150 |
    | Com_alter_db | 0 |
    | Com_alter_table | 0 |
    | Com_analyze | 0 |
    | Com_backup_table | 0 |
    | Com_begin | 0 |
    | Com_change_db | 33678 |
    | Com_change_master | 0 |
    | Com_check | 0 |
    | Com_checksum | 0 |
    | Com_commit | 0 |
    | Com_create_db | 0 |
    | Com_create_function | 0 |
    | Com_create_index | 0 |
    | Com_create_table | 0 |
    | Com_dealloc_sql | 0 |
    | Com_delete | 3327 |
    | Com_delete_multi | 0 |
    | Com_do | 0 |
    | Com_drop_db | 0 |
    | Com_drop_function | 0 |
    | Com_drop_index | 0 |
    | Com_drop_table | 0 |
    | Com_drop_user | 0 |
    | Com_execute_sql | 0 |
    | Com_flush | 0 |
    | Com_grant | 0 |
    | Com_ha_close | 0 |
    | Com_ha_open | 0 |
    | Com_ha_read | 0 |
    | Com_help | 0 |
    | Com_insert | 6939 |
    | Com_insert_select | 0 |
    | Com_kill | 0 |
    | Com_load | 0 |
    | Com_load_master_data | 0 |
    | Com_load_master_table | 0 |
    | Com_lock_tables | 96 |
    | Com_optimize | 1 |
    | Com_preload_keys | 0 |
    | Com_prepare_sql | 0 |
    | Com_purge | 0 |
    | Com_purge_before_date | 0 |
    | Com_rename_table | 0 |
    | Com_repair | 0 |
    | Com_replace | 110 |
    | Com_replace_select | 0 |
    | Com_reset | 0 |
    | Com_restore_table | 0 |
    | Com_revoke | 0 |
    | Com_revoke_all | 0 |
    | Com_rollback | 0 |
    | Com_savepoint | 0 |
    | Com_select | 122075 |
    | Com_set_option | 32609 |
    | Com_show_binlog_events | 0 |
    | Com_show_binlogs | 0 |
    | Com_show_charsets | 0 |
    | Com_show_collations | 0 |
    | Com_show_column_types | 0 |
    | Com_show_create_db | 0 |
    | Com_show_create_table | 0 |
    | Com_show_databases | 0 |
    | Com_show_errors | 0 |
    | Com_show_fields | 474 |
    | Com_show_grants | 0 |
    | Com_show_innodb_status | 0 |
    | Com_show_keys | 0 |
    | Com_show_logs | 0 |
    | Com_show_master_status | 0 |
    | Com_show_ndb_status | 0 |
    | Com_show_new_master | 0 |
    | Com_show_open_tables | 0 |
    | Com_show_privileges | 0 |
    | Com_show_processlist | 77 |
    | Com_show_slave_hosts | 0 |
    | Com_show_slave_status | 0 |
    | Com_show_status | 1 |
    | Com_show_storage_engines | 0 |
    | Com_show_tables | 416 |
    | Com_show_variables | 92 |
    | Com_show_warnings | 0 |
    | Com_slave_start | 0 |
    | Com_slave_stop | 0 |
    | Com_stmt_close | 0 |
    | Com_stmt_execute | 0 |
    | Com_stmt_prepare | 0 |
    | Com_stmt_reset | 0 |
    | Com_stmt_send_long_data | 0 |
    | Com_truncate | 39 |
    | Com_unlock_tables | 96 |
    | Com_update | 12382 |
    | Com_update_multi | 73 |
    | Connections | 24161 |
    | Created_tmp_disk_tables | 917 |
    | Created_tmp_files | 2566 |
    | Created_tmp_tables | 5705 |
    | Delayed_errors | 0 |
    | Delayed_insert_threads | 0 |
    | Delayed_writes | 0 |
    | Flush_commands | 1 |
    | Handler_commit | 0 |
    | Handler_delete | 3217 |
    | Handler_discover | 0 |
    | Handler_read_first | 11240 |
    | Handler_read_key | 39590339 |
    | Handler_read_next | 465323528 |
    | Handler_read_prev | 28513357 |
    | Handler_read_rnd | 577162 |
    | Handler_read_rnd_next | 164597582 |
    | Handler_rollback | 0 |
    | Handler_update | 34586516 |
    | Handler_write | 74520507 |
    | Key_blocks_not_flushed | 0 |
    | Key_blocks_unused | 209100 |
    | Key_blocks_used | 23701 |
    | Key_read_requests | 66091160 |
    | Key_reads | 36935 |
    | Key_write_requests | 347877 |
    | Key_writes | 47462 |
    | Max_used_connections | 41 |
    | Not_flushed_delayed_rows | 0 |
    | Open_files | 467 |
    | Open_streams | 0 |
    | Open_tables | 256 |
    | Opened_tables | 2042 |
    | Qcache_free_blocks | 385 |
    | Qcache_free_memory | 2460424 |
    | Qcache_hits | 157144 |
    | Qcache_inserts | 110819 |
    | Qcache_lowmem_prunes | 28979 |
    | Qcache_not_cached | 11170 |
    | Qcache_queries_in_cache | 1048 |
    | Qcache_total_blocks | 4025 |
    | Questions | 393663 |
    | Rpl_status | NULL |
    | Select_full_join | 70 |
    | Select_full_range_join | 0 |
    | Select_range | 12268 |
    | Select_range_check | 0 |
    | Select_scan | 13338 |
    | Slave_open_temp_tables | 0 |
    | Slave_retried_transactions | 0 |
    | Slave_running | OFF |
    | Slow_launch_threads | 0 |
    | Slow_queries | 170 |
    | Sort_merge_passes | 1281 |
    | Sort_range | 45597 |
    | Sort_rows | 607666 |
    | Sort_scan | 4678 |
    | Table_locks_immediate | 168118 |
    | Table_locks_waited | 207 |
    | Threads_cached | 0 |
    | Threads_connected | 41 |
    | Threads_created | 284 |
    | Threads_running | 39 |
    | Uptime | 23198 |
    +----------------------------+-----------+




    top - 00:43:51 up 3 days, 7 min, 1 user, load average: 19.94, 7.30, 3.64
    Tasks: 185 total, 2 running, 183 sleeping, 0 stopped, 0 zombie
    Cpu(s): 0.9% us, 0.5% sy, 0.0% ni, 37.3% id, 61.2% wa, 0.0% hi, 0.0% si
    Mem: 1033676k total, 1017988k used, 15688k free, 3172k buffers
    Swap: 2040244k total, 132660k used, 1907584k free, 431096k cached
    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    16927 mysql 16 0 386m 89m 3180 S 5 8.9 83:28.00 mysqld
    25486 root 16 0 3636 1016 764 R 2 0.1 0:00.04 top
    99 root 15 0 0 0 0 S 1 0.0 6:00.84 kswapd0
    25429 nobody 15 0 23924 13m 2548 S 1 1.3 0:00.62 httpd
    25466 nobody 17 0 21256 10m 2508 S 1 1.0 0:00.16 httpd
    25481 root 18 0 24644 22m 10m D 1 2.2 0:00.09 whostmgr
    25483 root 18 0 29676 20m 9720 R 1 2.0 0:00.08 whostmgr2
    1 root 16 0 2020 384 356 S 0 0.0 0:01.26 init
    2 root RT 0 0 0 0 S 0 0.0 0:00.50 migration/0
    3 root 34 19 0 0 0 S 0 0.0 0:00.01 ksoftirqd/0
    4 root RT 0 0 0 0 S 0 0.0 0:03.59 migration/1



    my.cnf


    [mysqld]
    port = 3306
    socket = /var/lib/mysql/mysql.sock
    skip-locking
    key_buffer = 256M
    max_allowed_packet = 1M
    table_cache = 256
    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

    thread_concurrency = 8
    server-id = 1
    [mysqldump]
    quick
    max_allowed_packet = 16M
    [mysql]
    no-auto-rehash
    # Remove the next comment character if you are not familiar with SQL
    #safe-updates
    [isamchk]
    key_buffer = 128M
    sort_buffer_size = 128M
    read_buffer = 2M
    write_buffer = 2M
    [myisamchk]
    key_buffer = 128M
    sort_buffer_size = 128M
    read_buffer = 2M
    write_buffer = 2M
    [mysqlhotcopy]
    interactive-timeout



    httpd.conf


    Timeout 300

    KeepAlive On

    MaxKeepAliveRequests 100

    KeepAliveTimeout 15

    MinSpareServers 5
    MaxSpareServers 10

    StartServers 5

    MaxClients 150
    MaxRequestsPerChild 1000
     
    usbiz, Oct 24, 2007 IP
  2. Jon Murray

    Jon Murray Peon

    Messages:
    41
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Is there any PHP in use on your site? If so, are you using a PHP cache like APC? You might also want to consider increasing your query_cache size to 64M or 128M if your server has the headroom (give the cache size in top it looks like you are working with about 400M cache area).
     
    Jon Murray, Oct 25, 2007 IP
  3. Jon Murray

    Jon Murray Peon

    Messages:
    41
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Sorry, I just re-read. Do the problems only happen when you update?
     
    Jon Murray, Oct 25, 2007 IP
  4. hycari

    hycari Peon

    Messages:
    228
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    It also looks like you've got some of your swap being used. That part's not good. It means all of your memory is getting used up.
     
    hycari, Oct 25, 2007 IP
  5. inworx

    inworx Peon

    Messages:
    4,860
    Likes Received:
    201
    Best Answers:
    0
    Trophy Points:
    0
    #5
    All the above processes are getting memory limits. Add more RAM and that'll solve your problem. You have just 15-30 MB of free RAM of `1 GB, which isn't good, or say is really bad. You need 2+ GB RAM for better performance and stability.

    SWAP cannot be used for memory for that long since its space from HDD which is EXTREMELY slow compared to RAMs.
     
    inworx, Oct 26, 2007 IP