大网数据广告活动
服务器运维问答

Why do most ulimit recommendations call for setting file descriptor limits to 65535?

· 52CE 我爱测

In searching for max file descriptor ulimit tuning recommendations, many sites recommend setting a file descriptor size of 65535. In some cases, its 100000, 120000, and even higher. Some of these posts date back 20 years ago. For…

问题原文

原帖链接 · alkalinecoffee · CC BY-SA 4.0

In searching for max file descriptor ulimit tuning recommendations, many sites recommend setting a file descriptor size of 65535. In some cases, its 100000, 120000, and even higher. Some of these posts date back 20 years ago.

For some posts, I'm sure it's an arbitrary value. But it seems that there are so many recommendations for these values, and 65535 in particular. Why do so many blog posts and server tuning docs suggest setting max file descriptors to something like 65535? On the surface it seems like an arbitrary value. Is it for historical reasons?

已采纳解答

原帖链接 · John Mahowald · CC BY-SA 4.0

Nearly arbitrary. Someone picked a value for a recommendation, and many others copied it.

Defaults in the single-digit thousand range might be too small for a few hundred database files, or a few thousand mail spools. So 5 or 6 decimal digits may be an appropriate order of magnitude.

65535 happens to be 64k, also known as the largest 16 bit number. And then there is the stranger number you might see of 64000, perhaps someone mixed binary and decimal thinking. That's quite a lot of open files, but does not reflect the maximum possible value on a modern system.

"Modern" systems qualifier, because if you go far back enough 64k was a limit on some platforms. Obsolete HP-UX function call pstat_getfile() broke above 64k. Obviously not relevant to Linux, but if there is no need to go higher, why not keep it below a familiar 64k number?

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-10-06)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。