How does MySQL calculate the number of opened files (3) bitsCN.com
At this time, the calculation results are as follows:
| Max_connections | 100 |
| Table_open_cache | 1000 |
To calculate:
Max_open_files_1 = max_connections + table_cache * 2 = 100 + 1000*2 = 2100
Max_open_files_2 = max_connections * 5 = 100x5 = 500
6. try to modify ulimit:
Unlimit-n 5000
Vi/etc/my. cnf
...
Open_files_limit = 10000
...
/Etc/init. d/mysql restart
Mysql> show global variables like '% open % ';
| Open_files_limit | 10000 |
| Table_open_cache | 1000 |
Open_files_limit is larger than the maximum number of kernels. Therefore, use open_files_limit as the standard.
Vi/etc/my. cnf
...
# Open_files_limit = 10000
...
/Etc/init. d/mysql restart
Mysql> show global variables like '% open % ';
| Open_files_limit | 5000 |
| Table_open_cache | 1000 |
As you can see, it becomes the new kernel's maximum limit.
As you can see, the results are completely different from those described in the document and written in the mysql source code. it seems that the pre-compiled version is not reliable in some places :(
The above tests are the same in mysql 5.1.23-rc (pre-compiled), mysql-5.1.24-rc (self-compiled) and 5.0.45 (pre-compiled.
Uname-
Linux s1.yejr.com 2.6.9-55. ELsmp #1 SMP Fri Apr 20 16:36:54 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux
Mysql> select version ();
+ --------------- +
| Version () |
+ --------------- +
| 5.1.23-rc-log |
+ --------------- +
BitsCN.com