Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2003
    Location
    Europe
    Posts
    122

    PHP-MySQL load/stress script

    I'm looking for a PHP script that could do a load/stress testing of MySQL server (Linux Apache)?

    I've had a user with some custom PHP forum with MySQL backend which used to make CPU load more than 50 with just a 20 users on it. Obviously it was a bad script, but whole server would become unstable and services would start crashing. That forum is gone now, but I did some tweaks and would like to try stress test on MySQL to see what will happen.

  2. #2
    Join Date
    May 2004
    Posts
    66
    This is actually a strange requirement , and i am afraid you are a client and want to ruin a hosting server through this script..
    anyway if you are care to optimize your mysql , or if you are really facing congestion in your mysql , paste here your my.cnf , and also paste your
    mysqladmin extended

    and we can help you gain better performance and optimization

    please also specify your Ram size and cpu

    Thanks

  3. #3
    Join Date
    Feb 2003
    Location
    Europe
    Posts
    122
    Strange maybe...but not client If you check my previous posts in last 2 years you'll see my issues were always related to my dedicated servers.
    I belive mysql is optimized and i'm not overally concerned with mysql itself, but impact is has on other services and whole server. Like I said I had client with bad script that was causing other errors with server stability. I wish to do a stress test to see if it will crash my server.

    But in case you still want mysql data here it is: CPU is dual xeon, ram is 2 GB:
    /etc/my.cnf
    Code:
    [mysqld]
    thread_concurrency = 4
    wait_timeout = 300
    set-variable = max_connections=500
    set-variable = table_cache=1024
    set-variable = join_buffer=8M
    set-variable = key_buffer=384M
    set-variable = query_cache_type=1
    set-variable = query_cache_size=128M
    set-variable = query_cache_limit=8M
    set-variable = read_buffer_size=16M
    set-variable = sort_buffer_size=16M
    set-variable = max_allowed_packet=16M
    set-variable = thread_stack=128K
    
    [mysqldump]
    quick
    set-variable = max_allowed_packet=16M
    
    [mysql]
    no-auto-rehash
    
    [isamchk]
    set-variable = key=16M
    set-variable = key_buffer=20M
    set-variable = sort_buffer=20M
    set-variable = read_buffer=2M
    set-variable = write_buffer=2M
    
    [myisamchk]
    set-variable = key_buffer=20M
    set-variable = sort_buffer=20M
    set-variable = read_buffer=2M
    set-variable = write_buffer=2M
    mysqladmin extended
    Code:
     
    +--------------------------+------------+
    | Variable_name            | Value      |
    +--------------------------+------------+
    | Aborted_clients          | 187        |
    | Aborted_connects         | 1290       |
    | Bytes_received           | 1308570574 |
    | Bytes_sent               | 2685794723 |
    | Com_admin_commands       | 203        |
    | Com_alter_table          | 1          |
    | Com_analyze              | 0          |
    | Com_backup_table         | 0          |
    | Com_begin                | 107        |
    | Com_change_db            | 5189971    |
    | Com_change_master        | 0          |
    | Com_check                | 0          |
    | Com_commit               | 107        |
    | Com_create_db            | 2          |
    | Com_create_function      | 0          |
    | Com_create_index         | 0          |
    | Com_create_table         | 562        |
    | Com_delete               | 49053      |
    | Com_delete_multi         | 0          |
    | Com_drop_db              | 0          |
    | Com_drop_function        | 0          |
    | Com_drop_index           | 0          |
    | Com_drop_table           | 2060       |
    | Com_flush                | 536        |
    | Com_grant                | 37         |
    | Com_ha_close             | 0          |
    | Com_ha_open              | 0          |
    | Com_ha_read              | 0          |
    | Com_insert               | 82908      |
    | Com_insert_select        | 100        |
    | Com_kill                 | 0          |
    | Com_load                 | 0          |
    | Com_load_master_data     | 0          |
    | Com_load_master_table    | 0          |
    | Com_lock_tables          | 31383      |
    | Com_optimize             | 20         |
    | Com_purge                | 0          |
    | Com_rename_table         | 0          |
    | Com_repair               | 0          |
    | Com_replace              | 5318       |
    | Com_replace_select       | 0          |
    | Com_reset                | 0          |
    | Com_restore_table        | 0          |
    | Com_revoke               | 0          |
    | Com_rollback             | 0          |
    | Com_savepoint            | 0          |
    | Com_select               | 3104841    |
    | Com_set_option           | 13535      |
    | Com_show_binlog_events   | 0          |
    | Com_show_binlogs         | 1          |
    | Com_show_create          | 4695       |
    | Com_show_databases       | 471        |
    | Com_show_fields          | 5179       |
    | Com_show_grants          | 667        |
    | Com_show_keys            | 92         |
    | Com_show_logs            | 0          |
    | Com_show_master_status   | 0          |
    | Com_show_new_master      | 0          |
    | Com_show_open_tables     | 0          |
    | Com_show_processlist     | 1030       |
    | Com_show_slave_hosts     | 0          |
    | Com_show_slave_status    | 0          |
    | Com_show_status          | 13         |
    | Com_show_innodb_status   | 0          |
    | Com_show_tables          | 14882      |
    | Com_show_variables       | 389        |
    | Com_slave_start          | 0          |
    | Com_slave_stop           | 0          |
    | Com_truncate             | 4          |
    | Com_unlock_tables        | 31383      |
    | Com_update               | 841791     |
    | Com_update_multi         | 3157       |
    | Connections              | 448475     |
    | Created_tmp_disk_tables  | 23897      |
    | Created_tmp_tables       | 105647     |
    | Created_tmp_files        | 3          |
    | Delayed_insert_threads   | 0          |
    | Delayed_writes           | 0          |
    | Delayed_errors           | 0          |
    | Flush_commands           | 1          |
    | Handler_commit           | 0          |
    | Handler_delete           | 80694      |
    | Handler_read_first       | 220818     |
    | Handler_read_key         | 101692870  |
    | Handler_read_next        | 874378084  |
    | Handler_read_prev        | 252353     |
    | Handler_read_rnd         | 33655900   |
    | Handler_read_rnd_next    | 2040226863 |
    | Handler_rollback         | 0          |
    | Handler_update           | 6776490    |
    | Handler_write            | 51701658   |
    | Key_blocks_used          | 54910      |
    | Key_read_requests        | 265255453  |
    | Key_reads                | 46422      |
    | Key_write_requests       | 1345502    |
    | Key_writes               | 572278     |
    | Max_used_connections     | 36         |
    | Not_flushed_key_blocks   | 0          |
    | Not_flushed_delayed_rows | 0          |
    | Open_tables              | 1024       |
    | Open_files               | 1918       |
    | Open_streams             | 0          |
    | Opened_tables            | 12347      |
    | Questions                | 15970302   |
    | Qcache_queries_in_cache  | 21541      |
    | Qcache_inserts           | 2864573    |
    | Qcache_hits              | 5979998    |
    | Qcache_lowmem_prunes     | 37459      |
    | Qcache_not_cached        | 223916     |
    | Qcache_free_memory       | 56950896   |
    | Qcache_free_blocks       | 13453      |
    | Qcache_total_blocks      | 59191      |
    | Rpl_status               | NULL       |
    | Select_full_join         | 14438      |
    | Select_full_range_join   | 601        |
    | Select_range             | 6706       |
    | Select_range_check       | 82         |
    | Select_scan              | 1096751    |
    | Slave_open_temp_tables   | 0          |
    | Slave_running            | OFF        |
    | Slow_launch_threads      | 1          |
    | Slow_queries             | 40         |
    | Sort_merge_passes        | 0          |
    | Sort_range               | 82993      |
    | Sort_rows                | 123561211  |
    | Sort_scan                | 238841     |
    | Table_locks_immediate    | 5264181    |
    | Table_locks_waited       | 2592       |
    | Threads_cached           | 0          |
    | Threads_created          | 448474     |
    | Threads_connected        | 4          |
    | Threads_running          | 1          |
    | Uptime                   | 307121     |
    +--------------------------+------------+

  4. #4
    As I recall, Apache has a stress testing program that comes with it. It's called ab. You may want to check that out. Just setup a php page that does some Mysql work and pound ab at it.
    Game control panels - control your game world your way. Server-Genie.com
    http://www.server-genie.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •