手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

调整Linux内核解决C500k问题

[日期:2012-12-17] 来源:Linux社区   作者:zhaoxiaogang [字体:大 中 小]

原文:

Kernel Options 

Several parameters exist to allow for tuning and tweaking of socket-related parameters. In /etc/sysctl.conf there are a few options we’ve modified.

First is fs.file-max, the maximum file descriptor limit. The default is quite low so this should be adjusted. Be careful if you’re not ready to go super high.

Second, we have the socket buffer parameters net.ipv4.tcp_rmem and net.ipv4.tcp_wmem. These are the buffers for reads and writes respectively. Each requires three integer inputs: min, default, and max. These each correspond to the number of bytes that may be buffered for a socket. Set these low with a tolerant max to reduce the amount of ram used for each socket.

The relevant portions of our config look like this:

fs.file-max = 999999
net.ipv4.tcp_rmem = 4096 4096 16777216
net.ipv4.tcp_wmem = 4096 4096 16777216

Meaning that the kernel allows for 999,999 open file descriptors and each socket buffer has a minimum and default 4096-byte buffer, with a sensible max of 16MB.

We also modified /etc/security/limits.conf to allow for 999,999 open file descriptors for all users.

第一步:

sudo vim /etc/sysctl.conf

增加:

fs.file-max =999999 net.ipv4.tcp_rmem =409640968192 net.ipv4.tcp_wmem =409640968192 net.ipv4.ip_local_port_range =102465535

第二步:

sudo vim /etc/security/limits.conf

增加:

*- nofile 999999

第三步:
sudo reboot

linux
相关资讯       Linux内核编译  C500k 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款