zoukankan      html  css  js  c++  java
  • Linux 系统级开启文件句柄 调优

    系统级开启文件句柄 

    max-file系统级别的能够打开的文件句柄的数量,Centos7默认是794168。


    Max-file 与 ulimit -n 的区别

    • max-file 表示系统级别的能够打开的文件句柄的数量。是对整个系统的限制,并不是针对用户或进程的。
    • ulimit -n 控制进程级别能够打开的文件句柄的数量。提供对shell及其启动的进程的可用文件句柄的控制。这是进程级别的。

    注:对于服务器来说,file-max和ulimit都需要设置,否则会出现文件描述符耗尽的问题。


    查看系统级别最大文件句柄数

    [root@node01 ~]# cat /proc/sys/fs/file-max
    95874

    修改最大文件句柄数:永久生效

    1、修改配置文件加入内核参数/etc/sysctl.conf

    [root@node01 ~]# vi /etc/sysctl.conf
    # sysctl settings are defined through files in
    # /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
    #
    # Vendors settings live in /usr/lib/sysctl.d/.
    # To override a whole file, create a new file with the same in
    # /etc/sysctl.d/ and put new settings there. To override
    # only specific settings, add a file with a lexically later
    # name in /etc/sysctl.d/ and put new settings there.
    #
    # For more information, see sysctl.conf(5) and sysctl.d(5).
    fs.file-max = 2000000
    [root@node01 ~]# sysctl -p /etc/sysctl.conf 
    fs.file-max = 2000000
    [root@node01 ~]# cat /proc/sys/fs/file-max
    2000000

    50W并发可设置 = 999999

    注:修改范围为系统所有进程可打开的最大文件句柄

  • 相关阅读:
    zabbix agent安装(三)
    获取hudson持续构建编译结果的一种方法
    一些C/C++中的函数
    设置页眉的章节及标题方法
    编译64位geos库的经验总结
    无法定位程序输入点到_ftol2于动态链接库msvcrt.dll的错误的解决
    Java学习笔记(二)
    初学网络协议
    HTTPS与SSL(二)
    HTTPS与SSL(一)
  • 原文地址:https://www.cnblogs.com/liujunjun/p/12496449.html
Copyright © 2011-2022 走看看