Heim >Datenbank >MySQL-Tutorial >MySQL的如何计算打开文件数(3)_MySQL

MySQL的如何计算打开文件数(3)_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-01 13:50:111141Durchsuche

bitsCN.com

  而这个时候,按计算公式结果如下:
  | max_connections | 100 |
  | table_open_cache | 1000 |
  来计算一下:
  max_open_files_1 = max_connections + table_cache * 2 = 100 + 1000 * 2 = 2100
  max_open_files_2 = max_connections*5 = 100 * 5 = 500
  6. 修改 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 比内核最大限制数还大,因此以 open_files_limit 为准。
   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 |
  看到了,变成了新的内核最大限制
  看到了吧,结果完全跟文档描述的以及mysql源码中写的不一样,看来预编译版本有些地方不太可靠啊 :(
  以上测试在mysql 5.1.23-rc(预编译), mysql-5.1.24-rc(自编译) 以及 5.0.45(预编译) 均一样。

  uname -a
  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
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn