Very high load site, queries taking 70 seconds
Hi
I am maintaining a site which has been built very badly. the core of this is a large mysql database (around 7 million rows, 650Mb)
When the site is running, mysql is often at 90% + (copy of top command below)
I dont have time to recode the sytem or the database, so have been looking at optimising (there were no indexes), which is working well, but I could do with a hand checking the main mysql server setup to ensure it is tuned ok. If anyone could have alook at let me know if i have missed anything? So far I've massively reduced the number of opened tables and utilised the query cache quite a bit. There is about 300Mb of index files at the moment.
Spec: dedicated PIII (1 CPU) machine, with 1Gb memory (just purchased) - also runs as webserver
MY.CNF
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-locking
key_buffer = 384M
max_allowed_packet = 2M
table_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
myisam_sort_buffer_size = 64M
thread_cache = 8
query_cache_size= 32M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 2
STATUS
+--------------------------+------------+
| Variable_name | Value |
+--------------------------+------------+
| Aborted_clients | 1295 |
| Aborted_connects | 4 |
| Bytes_received | 1349906823 |
| Bytes_sent | 3409479971 |
| Com_admin_commands | 10018439 |
| Com_alter_table | 7 |
| Com_analyze | 1 |
| Com_backup_table | 0 |
| Com_begin | 0 |
| Com_change_db | 10019759 |
| Com_change_master | 0 |
| Com_check | 10 |
| Com_commit | 0 |
| Com_create_db | 0 |
| Com_create_function | 0 |
| Com_create_index | 0 |
| Com_create_table | 0 |
| Com_delete | 748 |
| Com_delete_multi | 0 |
| Com_drop_db | 0 |
| Com_drop_function | 0 |
| Com_drop_index | 0 |
| Com_drop_table | 0 |
| Com_flush | 0 |
| Com_grant | 0 |
| Com_ha_close | 0 |
| Com_ha_open | 0 |
| Com_ha_read | 0 |
| Com_insert | 15341 |
| Com_insert_select | 0 |
| Com_kill | 1 |
| Com_load | 0 |
| Com_load_master_data | 0 |
| Com_load_master_table | 0 |
| Com_lock_tables | 0 |
| Com_optimize | 7 |
| Com_purge | 0 |
| Com_rename_table | 0 |
| Com_repair | 9 |
| Com_replace | 21253 |
| Com_replace_select | 0 |
| Com_reset | 0 |
| Com_restore_table | 0 |
| Com_revoke | 0 |
| Com_rollback | 0 |
| Com_savepoint | 0 |
| Com_select | 3397310 |
| Com_set_option | 0 |
| Com_show_binlog_events | 0 |
| Com_show_binlogs | 0 |
| Com_show_create | 64 |
| Com_show_databases | 0 |
| Com_show_fields | 369 |
| Com_show_grants | 0 |
| Com_show_keys | 169 |
| Com_show_logs | 0 |
| Com_show_master_status | 0 |
| Com_show_new_master | 0 |
| Com_show_open_tables | 0 |
| Com_show_processlist | 19 |
| Com_show_slave_hosts | 0 |
| Com_show_slave_status | 0 |
| Com_show_status | 2 |
| Com_show_innodb_status | 0 |
| Com_show_tables | 951 |
| Com_show_variables | 21 |
| Com_slave_start | 0 |
| Com_slave_stop | 0 |
| Com_truncate | 0 |
| Com_unlock_tables | 0 |
| Com_update | 57672 |
| Com_update_multi | 0 |
| Connections | 1202 |
| Created_tmp_disk_tables | 3303 |
| Created_tmp_tables | 183713 |
| Created_tmp_files | 484 |
| Delayed_insert_threads | 0 |
| Delayed_writes | 0 |
| Delayed_errors | 0 |
| Flush_commands | 1 |
| Handler_commit | 0 |
| Handler_delete | 392 |
| Handler_read_first | 316 |
| Handler_read_key | 37095210 |
| Handler_read_next | 233314552 |
| Handler_read_prev | 205998 |
| Handler_read_rnd | 17343360 |
| Handler_read_rnd_next | 1229106868 |
| Handler_rollback | 0 |
| Handler_update | 19193 |
| Handler_write | 39870910 |
| Key_blocks_used | 375052 |
| Key_read_requests | 222448212 |
| Key_reads | 759737 |
| Key_write_requests | 18087540 |
| Key_writes | 314543 |
| Max_used_connections | 50 |
| Not_flushed_key_blocks | 0 |
| Not_flushed_delayed_rows | 0 |
| Open_tables | 137 |
| Open_files | 239 |
| Open_streams | 0 |
| Opened_tables | 542 |
| Questions | 20042080 |
| Qcache_queries_in_cache | 29797 |
| Qcache_inserts | 3375364 |
| Qcache_hits | 6525245 |
| Qcache_lowmem_prunes | 2782132 |
| Qcache_not_cached | 21945 |
| Qcache_free_memory | 430664 |
| Qcache_free_blocks | 2 |
| Qcache_total_blocks | 59646 |
| Rpl_status | NULL |
| Select_full_join | 1 |
| Select_full_range_join | 0 |
| Select_range | 5714 |
| Select_range_check | 0 |
| Select_scan | 409669 |
| Slave_open_temp_tables | 0 |
| Slave_running | OFF |
| Slow_launch_threads | 1 |
| Slow_queries | 69 |
| Sort_merge_passes | 239 |
| Sort_range | 6218 |
| Sort_rows | 27808832 |
| Sort_scan | 53669 |
| Table_locks_immediate | 3802415 |
| Table_locks_waited | 448 |
| Threads_cached | 6 |
| Threads_created | 156 |
| Threads_connected | 19 |
| Threads_running | 1 |
| Uptime | 254760 |
+--------------------------+------------+
133 rows in set (0.00 sec)
THANKS!!!
Ben
Subject
Views
Written By
Posted
Very high load site, queries taking 70 seconds
2660
July 13, 2005 01:49PM
1579
July 13, 2005 01:57PM
1679
July 13, 2005 03:25PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.