High table_cache being ignored?
Posted by: Ben Sebborn
Date: October 12, 2005 02:58AM
Date: October 12, 2005 02:58AM
Hi
I have recently increased our table_cache from 512 to 1024 as the number of opened_tables was growing quickly. I have checked and the table_cache variable is showing as 1024 on the running server.
However, since the change a strange result is occuring:
open_tables is at 53
opened_tables is at 28,000+
It seems as though it will not leave the tables in cache - any reason why this might be happening?
mysql> SHOW STATUS;
+--------------------------+------------+
| Variable_name | Value |
+--------------------------+------------+
| Aborted_clients | 136 |
| Aborted_connects | 2236 |
| Bytes_received | 212156771 |
| Bytes_sent | 4092141932 |
| Com_admin_commands | 52 |
| Com_alter_table | 8 |
| Com_analyze | 1 |
| Com_backup_table | 0 |
| Com_begin | 157 |
| Com_change_db | 49417 |
| Com_change_master | 0 |
| Com_check | 2 |
| Com_commit | 157 |
| Com_create_db | 0 |
| Com_create_function | 0 |
| Com_create_index | 0 |
| Com_create_table | 14 |
| Com_delete | 1105 |
| Com_delete_multi | 0 |
| Com_drop_db | 0 |
| Com_drop_function | 0 |
| Com_drop_index | 0 |
| Com_drop_table | 13 |
| Com_flush | 3 |
| Com_grant | 0 |
| Com_ha_close | 0 |
| Com_ha_open | 0 |
| Com_ha_read | 0 |
| Com_insert | 1384 |
| Com_insert_select | 11 |
| Com_kill | 0 |
| Com_load | 0 |
| Com_load_master_data | 0 |
| Com_load_master_table | 0 |
| Com_lock_tables | 0 |
| Com_optimize | 1 |
| Com_purge | 0 |
| Com_rename_table | 0 |
| Com_repair | 0 |
| Com_replace | 2976 |
| Com_replace_select | 0 |
| Com_reset | 0 |
| Com_restore_table | 0 |
| Com_revoke | 0 |
| Com_rollback | 0 |
| Com_savepoint | 0 |
| Com_select | 200405 |
| Com_set_option | 23343 |
| Com_show_binlog_events | 0 |
| Com_show_binlogs | 0 |
| Com_show_create | 23359 |
| Com_show_databases | 47 |
| Com_show_fields | 23900 |
| Com_show_grants | 0 |
| Com_show_keys | 28 |
| Com_show_logs | 0 |
| Com_show_master_status | 0 |
| Com_show_new_master | 0 |
| Com_show_open_tables | 0 |
| Com_show_processlist | 0 |
| Com_show_slave_hosts | 0 |
| Com_show_slave_status | 0 |
| Com_show_status | 90430 |
| Com_show_innodb_status | 90375 |
| Com_show_tables | 24888 |
| Com_show_variables | 23 |
| Com_slave_start | 0 |
| Com_slave_stop | 0 |
| Com_truncate | 0 |
| Com_unlock_tables | 0 |
| Com_update | 20409 |
| Com_update_multi | 0 |
| Connections | 48575 |
| Created_tmp_disk_tables | 8553 |
| Created_tmp_tables | 29965 |
| Created_tmp_files | 4 |
| Delayed_insert_threads | 0 |
| Delayed_writes | 0 |
| Delayed_errors | 0 |
| Flush_commands | 1 |
| Handler_commit | 0 |
| Handler_delete | 787 |
| Handler_read_first | 32987 |
| Handler_read_key | 192153862 |
| Handler_read_next | 598436805 |
| Handler_read_prev | 25 |
| Handler_read_rnd | 2533968 |
| Handler_read_rnd_next | 242537511 |
| Handler_rollback | 12 |
| Handler_update | 2431484 |
| Handler_write | 86859323 |
| Key_blocks_used | 124224 |
| Key_read_requests | 793838246 |
| Key_reads | 498713 |
| Key_write_requests | 19076102 |
| Key_writes | 7586 |
| Max_used_connections | 26 |
| Not_flushed_key_blocks | 0 |
| Not_flushed_delayed_rows | 0 |
| Open_tables | 103 |
| Open_files | 207 |
| Open_streams | 0 |
| Opened_tables | 28470 |
| Questions | 1499642 |
| Qcache_queries_in_cache | 29361 |
| Qcache_inserts | 87867 |
| Qcache_hits | 861188 |
| Qcache_lowmem_prunes | 0 |
| Qcache_not_cached | 112377 |
| Qcache_free_memory | 58494792 |
| Qcache_free_blocks | 1366 |
| Qcache_total_blocks | 60627 |
| Rpl_status | NULL |
| Select_full_join | 499 |
| Select_full_range_join | 0 |
| Select_range | 3390 |
| Select_range_check | 0 |
| Select_scan | 106457 |
| Slave_open_temp_tables | 0 |
| Slave_running | OFF |
| Slow_launch_threads | 0 |
| Slow_queries | 5 |
| Sort_merge_passes | 0 |
| Sort_range | 7226 |
| Sort_rows | 2882214 |
| Sort_scan | 32586 |
| Table_locks_immediate | 334615 |
| Table_locks_waited | 1 |
| Threads_cached | 20 |
| Threads_created | 27 |
| Threads_connected | 7 |
| Threads_running | 1 |
| Uptime | 168319 |
+--------------------------+------------+
133 rows in set (0.00 sec)
[mysqld]
skip-locking
skip-bdb
log_slow_queries
key_buffer=128M
join_buffer=2M
record_buffer=8M
read_buffer_size=2M
max_allowed_packet=1M
table_cache=1024
thread_stack=128K
sort_buffer=2M
net_buffer_length=8K
myisam_sort_buffer_size=4M
server-id= 1
thread_cache=50
thread_concurrency=2
max_connections=150
tmp_table_size=64M
query-cache-type = 1
query-cache-size = 98M
query_cache_limit = 1M
log-warnings
I have recently increased our table_cache from 512 to 1024 as the number of opened_tables was growing quickly. I have checked and the table_cache variable is showing as 1024 on the running server.
However, since the change a strange result is occuring:
open_tables is at 53
opened_tables is at 28,000+
It seems as though it will not leave the tables in cache - any reason why this might be happening?
mysql> SHOW STATUS;
+--------------------------+------------+
| Variable_name | Value |
+--------------------------+------------+
| Aborted_clients | 136 |
| Aborted_connects | 2236 |
| Bytes_received | 212156771 |
| Bytes_sent | 4092141932 |
| Com_admin_commands | 52 |
| Com_alter_table | 8 |
| Com_analyze | 1 |
| Com_backup_table | 0 |
| Com_begin | 157 |
| Com_change_db | 49417 |
| Com_change_master | 0 |
| Com_check | 2 |
| Com_commit | 157 |
| Com_create_db | 0 |
| Com_create_function | 0 |
| Com_create_index | 0 |
| Com_create_table | 14 |
| Com_delete | 1105 |
| Com_delete_multi | 0 |
| Com_drop_db | 0 |
| Com_drop_function | 0 |
| Com_drop_index | 0 |
| Com_drop_table | 13 |
| Com_flush | 3 |
| Com_grant | 0 |
| Com_ha_close | 0 |
| Com_ha_open | 0 |
| Com_ha_read | 0 |
| Com_insert | 1384 |
| Com_insert_select | 11 |
| Com_kill | 0 |
| Com_load | 0 |
| Com_load_master_data | 0 |
| Com_load_master_table | 0 |
| Com_lock_tables | 0 |
| Com_optimize | 1 |
| Com_purge | 0 |
| Com_rename_table | 0 |
| Com_repair | 0 |
| Com_replace | 2976 |
| Com_replace_select | 0 |
| Com_reset | 0 |
| Com_restore_table | 0 |
| Com_revoke | 0 |
| Com_rollback | 0 |
| Com_savepoint | 0 |
| Com_select | 200405 |
| Com_set_option | 23343 |
| Com_show_binlog_events | 0 |
| Com_show_binlogs | 0 |
| Com_show_create | 23359 |
| Com_show_databases | 47 |
| Com_show_fields | 23900 |
| Com_show_grants | 0 |
| Com_show_keys | 28 |
| Com_show_logs | 0 |
| Com_show_master_status | 0 |
| Com_show_new_master | 0 |
| Com_show_open_tables | 0 |
| Com_show_processlist | 0 |
| Com_show_slave_hosts | 0 |
| Com_show_slave_status | 0 |
| Com_show_status | 90430 |
| Com_show_innodb_status | 90375 |
| Com_show_tables | 24888 |
| Com_show_variables | 23 |
| Com_slave_start | 0 |
| Com_slave_stop | 0 |
| Com_truncate | 0 |
| Com_unlock_tables | 0 |
| Com_update | 20409 |
| Com_update_multi | 0 |
| Connections | 48575 |
| Created_tmp_disk_tables | 8553 |
| Created_tmp_tables | 29965 |
| Created_tmp_files | 4 |
| Delayed_insert_threads | 0 |
| Delayed_writes | 0 |
| Delayed_errors | 0 |
| Flush_commands | 1 |
| Handler_commit | 0 |
| Handler_delete | 787 |
| Handler_read_first | 32987 |
| Handler_read_key | 192153862 |
| Handler_read_next | 598436805 |
| Handler_read_prev | 25 |
| Handler_read_rnd | 2533968 |
| Handler_read_rnd_next | 242537511 |
| Handler_rollback | 12 |
| Handler_update | 2431484 |
| Handler_write | 86859323 |
| Key_blocks_used | 124224 |
| Key_read_requests | 793838246 |
| Key_reads | 498713 |
| Key_write_requests | 19076102 |
| Key_writes | 7586 |
| Max_used_connections | 26 |
| Not_flushed_key_blocks | 0 |
| Not_flushed_delayed_rows | 0 |
| Open_tables | 103 |
| Open_files | 207 |
| Open_streams | 0 |
| Opened_tables | 28470 |
| Questions | 1499642 |
| Qcache_queries_in_cache | 29361 |
| Qcache_inserts | 87867 |
| Qcache_hits | 861188 |
| Qcache_lowmem_prunes | 0 |
| Qcache_not_cached | 112377 |
| Qcache_free_memory | 58494792 |
| Qcache_free_blocks | 1366 |
| Qcache_total_blocks | 60627 |
| Rpl_status | NULL |
| Select_full_join | 499 |
| Select_full_range_join | 0 |
| Select_range | 3390 |
| Select_range_check | 0 |
| Select_scan | 106457 |
| Slave_open_temp_tables | 0 |
| Slave_running | OFF |
| Slow_launch_threads | 0 |
| Slow_queries | 5 |
| Sort_merge_passes | 0 |
| Sort_range | 7226 |
| Sort_rows | 2882214 |
| Sort_scan | 32586 |
| Table_locks_immediate | 334615 |
| Table_locks_waited | 1 |
| Threads_cached | 20 |
| Threads_created | 27 |
| Threads_connected | 7 |
| Threads_running | 1 |
| Uptime | 168319 |
+--------------------------+------------+
133 rows in set (0.00 sec)
[mysqld]
skip-locking
skip-bdb
log_slow_queries
key_buffer=128M
join_buffer=2M
record_buffer=8M
read_buffer_size=2M
max_allowed_packet=1M
table_cache=1024
thread_stack=128K
sort_buffer=2M
net_buffer_length=8K
myisam_sort_buffer_size=4M
server-id= 1
thread_cache=50
thread_concurrency=2
max_connections=150
tmp_table_size=64M
query-cache-type = 1
query-cache-size = 98M
query_cache_limit = 1M
log-warnings
Subject
Views
Written By
Posted
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.