- 论坛徽章:
- 0
|
show global status like 'open%tables%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Open_tables | 3072 |
| Opened_tables | 13759 |
+---------------+-------+
2 rows in set (0.00 sec)
table_cache = 3072 最初设置512,然后逐渐加大到3072了, 还要加大吗? 再大的话有没有副作用?
1。首先需要加大table_cache,因为open_tables都已经等于table_cache,说明当前的并发查询需要的表多余table_cache了;
2。加大是有副作用的,因为更多的open_tables消耗更多的file-descriptors,而OS中允许打开的的file-descriptiots是一定的,所有可能会出现“too many open files“导致mysql不公作了
3。可以设置"open_files_limit"来避免上述的问题,公式:
table_open_cache = max_connection * N + temp, 其中,N是每个查询需要打开的表的数目,if是myisam的表,需要再多加一个,temp是一些而外的开销。
把open_files_limit 设置成比这个还要大的数 |
|