Your SlideShare is downloading. ×
Mysql gdb-101022041146-phpapp01
Mysql gdb-101022041146-phpapp01
Mysql gdb-101022041146-phpapp01
Mysql gdb-101022041146-phpapp01
Mysql gdb-101022041146-phpapp01
Mysql gdb-101022041146-phpapp01
Mysql gdb-101022041146-phpapp01
Mysql gdb-101022041146-phpapp01
Mysql gdb-101022041146-phpapp01
Mysql gdb-101022041146-phpapp01
Mysql gdb-101022041146-phpapp01
Mysql gdb-101022041146-phpapp01
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Mysql gdb-101022041146-phpapp01

362

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
362
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. GDB MySQL参数
    Open-files-limit
    苏普
    2010-10
    1
  • 2. 起源
    > Can't open file: '.testmytable.frm' (errno: 24)
    shell> perror 24
    OS error code 24: Too many open files
    尝试修改open_files_limit
    Changes the number of file descriptors available to mysqld. You should try increasing the value of this option if mysqld gives you the error Too many open files. mysqld uses the option value to reserve descriptors with setrlimit(). If the requested number of file descriptors cannot be allocated, mysqld writes a warning to the error log.
  • 3. open_files_limitin my.cnf
    配置open_files_limit=10000
    global variables like "%open_files_limit%";
    +------------------+-------+
    | open_files_limit | 1024|
    +------------------+-------+
    • 配置open_files_limit=30000
    global variables like "%open_files_limit%";
    +------------------+-------+
    | open_files_limit | 1024|
    +------------------+-------+
    参数设置始终无效
  • 4. Why?
    开启了一个痛苦代码追踪过程
  • 5. gdb:watch
    • gdb mysqld
    • 6. (gdb) watch open_files_limit
    • 7. (gdb) r
    Old value = 0
    New value = 20000
    Old value = 20000
    New value = 1024
    init_common_variables (...) at mysqld.cc:3355
  • 8. Sql/mysqld.cc:3355
    max_open_files= max(max(wanted_files, max_connections*5),
    open_files_limit);
    3322 files= my_set_max_open_files(max_open_files);
  • mysys/my_file.c
    uint my_set_max_open_files(uint files){
    ...
    files= set_max_open_files(min(files, OS_FILE_LIMIT));
  • 12. mysys/my_file.c
    static uintset_max_open_files(uintmax_file_limit){
    ...
    if (rlimit.rlim_cur >= max_file_limit) DBUG_RETURN(rlimit.rlim_cur);
    rlimit.rlim_cur= rlimit.rlim_max= max_file_limit;
    if (setrlimit(RLIMIT_NOFILE, &rlimit))
    }
  • 13. Linux && setrlimit
    man setrlimit
    set resource limits
  • 14. Almost Done
    mysqld_safe
    if test -w / -o "$USER" = "root"
    then
    ......
    if test -n "$open_files"
    then
    ulimit -n $open_files
    append_arg_to_args "--open-files-limit=$open_files"
    fi
    fi
  • 15. Simple? or not?
    That’s all
    Who’s next
  • 16. Good Luck
    Q & A

×