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

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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,323评论 19 139
  • Redis 配置文件示例 注意:想要读取配置文件,Redis的第一个参数必须是文件的路径 ./redis-serv...
    起个名忒难阅读 4,982评论 0 1
  • 一.亚健康是啥? 题目:放松与能量清理 亚健康主要出现在情绪上。它主要是体现在情绪上,思想上心理上和感觉上。你的...
    48ee6c49c9bf阅读 1,599评论 0 0
  • 一点 入眠 呼吸越来越急促 无法呼吸 似乎要窒息 感觉有无形的物体 压着我的身体 无法呼吸 拼命喊叫 意识里叫喊自...
    啭鸣之贝阅读 1,885评论 0 0
  • 小区门口横穿一条马路,这条马路是通往市里的主干道,每天公交车、私家车、自行车、工程车等等都从这通过。...
    方海敏阅读 4,556评论 2 36