美文网首页
CentOS安装后可以做的一些优化

CentOS安装后可以做的一些优化

作者: Leebor | 来源:发表于2017-10-24 13:55 被阅读0次
1.关闭不用的启动项
# chkconfig --list | grep 3:on
# chkconfig *** off
2.调整系统最大文件打开数
  • 计算系统最大文件打开数
# grep MemTotal | awk '{print $2/10}'

The value in file-max denotes the maximum number of file handles that the Linux kernel will allocate. When you get a lot of error messages about running out of file handles, you might want to raise this limit. The default value is 10% of RAM in kilobytes. To change it, just write the new number into the file

系统最大文件打开数,一般为内存大小的10%。

  • 系统级别的设置
/etc/sysctl.conf:
fs.file-max = 12345678
  • 用户级别的设置
/etc/security/limits.conf
- * soft nofile 1024
- * hard nofile 1024

调整规则: soft-nofile< hard-nofile < file-max

3. 调整系统最大进程数
  • 系统级别设置
--> 系统最大pid设置
/proc/sys/kernel/pid_max

--> 系统最大线程数设置
/proc/sys/kernel/thread-max

--> 单个进程mmap限制
/proc/sys/vm/max_map_count
  • 用户级别设置
/etc/security/limit.conf
username/group soft nproc max-limit-number
username/group hard nproc max-limit-number

相关文章

网友评论

      本文标题:CentOS安装后可以做的一些优化

      本文链接:https://www.haomeiwen.com/subject/yriauxtx.html