免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
1234下一页
最近访问板块 发新帖
查看: 10575 | 回复: 30
打印 上一主题 下一主题

如何修改linux内核默认文件描述符最大同时打开数量? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-10-20 15:13 |只看该作者 |倒序浏览
本人近来研究如何更改linux系统默认的同时打开的最大文件描述符数量。请各位能给小弟指导指导。或一起研究。谢谢!

论坛徽章:
0
2 [报告]
发表于 2005-10-20 15:15 |只看该作者

如何修改linux内核默认文件描述符最大同时打开数量?

希望大家多多照顾!谢谢!

论坛徽章:
0
3 [报告]
发表于 2005-10-20 15:21 |只看该作者

如何修改linux内核默认文件描述符最大同时打开数量?

edit
/proc/sys/fs/file-max

论坛徽章:
0
4 [报告]
发表于 2005-10-20 15:26 |只看该作者

如何修改linux内核默认文件描述符最大同时打开数量?

to 楼上: 光明使者 :
非常感谢您的指教!谢谢1

论坛徽章:
0
5 [报告]
发表于 2005-10-20 15:32 |只看该作者

如何修改linux内核默认文件描述符最大同时打开数量?

编译/proc/sys/fs/file-max 都需要那些条件?
1:是在内核编译前做/还是编译后做?
2:需要修改的文件模块和别的模块有多少耦合关系?
3:修改前需要做什么准备工作?
------------------------------------------------------------------------------
就想到3条,本人是C新手upd大文件跨平台传输写了半个月,被...
请各位多多关照!谢谢!

论坛徽章:
0
6 [报告]
发表于 2005-10-20 15:46 |只看该作者

如何修改linux内核默认文件描述符最大同时打开数量?

修改内核参数:
fs.file-max

论坛徽章:
0
7 [报告]
发表于 2005-10-20 15:47 |只看该作者

如何修改linux内核默认文件描述符最大同时打开数量?

偶的系统缺省为:
fs.file-max = 209698

论坛徽章:
0
8 [报告]
发表于 2005-10-20 16:03 |只看该作者

如何修改linux内核默认文件描述符最大同时打开数量?

to 精灵王
谢谢!
请问这样没个进程可以同时打开的文件描述符数量是不是也随之增加了
怎么计算?

论坛徽章:
0
9 [报告]
发表于 2005-10-20 16:52 |只看该作者

如何修改linux内核默认文件描述符最大同时打开数量?

Securing and Optimizing Linux: RedHat Edition -A Hands on Guide
Prev Chapter 6. Linux General Optimization Next

--------------------------------------------------------------------------------

6.9. The file-max parameter
The file-max file /proc/sys/fs/file-max sets the maximum number of file-handles that the Linux kernel will allocate. We generally tune this file to improve the number of open files by increasing the value of /proc/sys/fs/file-max to something reasonable like 256 for every 4M of RAM we have: i.e. for a machine with 128 MB of RAM, set it to 8192 - 128/4=32 32*256=8192.

The default setup for the file-max parameter under Red Hat Linux is: "4096" To adjust the value of file-max to 128 MB of RAM, type the following on your terminal:



          [root@deep] /# echo "8192" >;/proc/sys/fs/file-max
         

Add the above commands to the /etc/rc.d/rc.local script file and you'll not have to type it again the next time your server reboots.




Edit the /etc/sysctl.conf file and add the following line:           # Improve the number of open files
          fs.file-max = 8192
         

You must restart your network for the change to take effect. The command to manually restart the network is the following:           [root@deep] /# /etc/rc.d/init.d/network restart
         


Setting network parameters [ OK ] Bringing up interface lo [ OK ] Bringing up interface eth0 [ OK ] Bringing up interface eth1 [ OK ]


: When you regularly receive from your server a lot of messages with errors about running out of open files, you might want to raise this limit. The default value is 4096. A file server or web server needs a lot of open files.


--------------------------------------------------------------------------------
Prev Home Next
The /etc/nsswitch.conf file Up The ulimit parameter


看这里:

http://www.faqs.org/docs/securing/chap6sec72.html

论坛徽章:
0
10 [报告]
发表于 2005-10-20 17:36 |只看该作者

如何修改linux内核默认文件描述符最大同时打开数量?

to 精灵王:
非常感谢您的帮助!


——————————————————————————————————————————————————————————————————
希望大家多多指教谢谢!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP