How to calculate the number of opened files in MySQL (3) _ MySQL

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.