avatar
d*o
1
How can I determine what the limit for file descriptor for a workstation?
(I can use 'limit' to find for individual users but I want to know the limit
for the whole machine). And is there a way to increase the limit for the
system (assuming 'root' privilege)?
thanks.
avatar
w*d
2
为什么要取得fd对整个机器的限制呢? 我不明白. 在我看来, 这个限制肯定受系统资源所
限, 但我也没有找到有关这方面的资料.
一些系统标准, 如posix定义的都是每个进程可以打开的fd数. 如 posix 定义
系统每个进程打开的文件数的最大值至少应当是16, 很多系统都定义为64. 如果你是 root
这个值应该是可以扩充的, 但不会太大(大约200?). 所以, 如果你要用到这个值, 如果
没有定义的话. 你自己可以定义一个 256 就足够了.
如果你非要一个准确的值, 可以用
long sysconf( int name); /* name 为OPEN_MAX */
在程序中取得. 不能保证一定能得到. 而且这个只是一个进程, 而不是整个系统中的限制.
也许有的系统会自己定义整个系统同时被打开的文件数, 比如说 500, 可这个肯定跟具体的
系统有关啦, 怎么改变要看它自己提供的机制了.

【在 d*o 的大作中提到】
: How can I determine what the limit for file descriptor for a workstation?
: (I can use 'limit' to find for individual users but I want to know the limit
: for the whole machine). And is there a way to increase the limit for the
: system (assuming 'root' privilege)?
: thanks.

avatar
d*o
3
This is the reason why I want to know:
I have an application which runs on solaris. Sometimes it got errors. It was
determined that the error is due to the limit of file descriptors. So I
increases the limit for it. Then it runs fine. Now if I let 10 people to run
it simultaneously, sometimes the error comes back. I still suspect it is
due to the total limit of the system. So I'd like to know how to find
the limit, whether I can increase the limit. If I can determine this is the
reason, then I'l

【在 w****d 的大作中提到】
: 为什么要取得fd对整个机器的限制呢? 我不明白. 在我看来, 这个限制肯定受系统资源所
: 限, 但我也没有找到有关这方面的资料.
: 一些系统标准, 如posix定义的都是每个进程可以打开的fd数. 如 posix 定义
: 系统每个进程打开的文件数的最大值至少应当是16, 很多系统都定义为64. 如果你是 root
: 这个值应该是可以扩充的, 但不会太大(大约200?). 所以, 如果你要用到这个值, 如果
: 没有定义的话. 你自己可以定义一个 256 就足够了.
: 如果你非要一个准确的值, 可以用
: long sysconf( int name); /* name 为OPEN_MAX */
: 在程序中取得. 不能保证一定能得到. 而且这个只是一个进程, 而不是整个系统中的限制.
: 也许有的系统会自己定义整个系统同时被打开的文件数, 比如说 500, 可这个肯定跟具体的

avatar
w*d
4
solaris下改系统参数好像要在一个文件里(/etc/下吧?)写一些然后重新启动吧?
你查一下系统管理手册或是faqs吧, 应该有. 不过注意别改太大, 否则不起作用.
如果你的应用需要越大越好, 我想你需要改程序来自己限制资源的使用, 对出错
进行处理或是阻塞进一步的请求等. 你总不能希望你的应用占用几乎所有的系统
资源吧? 这样你自己的程序也要受很大影响的.
fd这个东西说起来花费也不大, 但系统肯定要对它作限制的.

【在 d*o 的大作中提到】
: This is the reason why I want to know:
: I have an application which runs on solaris. Sometimes it got errors. It was
: determined that the error is due to the limit of file descriptors. So I
: increases the limit for it. Then it runs fine. Now if I let 10 people to run
: it simultaneously, sometimes the error comes back. I still suspect it is
: due to the total limit of the system. So I'd like to know how to find
: the limit, whether I can increase the limit. If I can determine this is the
: reason, then I'l

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。