ulimits 中的 nproc 和 nofile 是什么?

what is nproc and nofile in ulimits?

我想知道 ulimits 中的 nofile 和 nproc 是做什么用的,最好有例子。具体来说,它们在数据库中的作用是什么?

相对于mongodb两个参数如下:

nofile: -n: file descriptors

  • 这个 ulimit 设置参数告诉 mongodb 进程可以使用多少个文​​件描述符。 MongoDB 在内部使用文件来存储连接、日志文件、索引和数据文件。
  • MongoDB 建议将 nofile 设置为 64000。但是,您可能需要根据需要将其更改为更高的值(尤其是 WiredTiger 存储引擎)。如果您使用这些值对您的环境进行测试。

nproc: -u: processes/threads

  • MongoDB 使用进程来跟踪每个内部线程或 pthread 作为系统进程。例如复制线程

  • 如果
  • MongoDB 未按预期设置,则显示启动警告。对于 mongodb 部署

  • ,这通常设置为 nofile 的 1/2