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

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

  • 相关阅读:
    httprunner-2-linux下搭建hrun(下)
    Docker学习3-简单shell脚本安装mysql5.7与docker小技巧
    功能测试--聊天功能测试&微信聊天
    Fiddler抓包3-查看get与post请求
    面向对象--继承
    Mybatis入门
    Maven基础
    Cookie&Session
    Redis应用
    Redis概念和安装
  • 原文地址:https://www.cnblogs.com/liujunjun/p/12496449.html
Copyright © 2011-2022 走看看