常用的文件系统内核参数主要有如下三个:nr_open, aio-max-nr, file-max。以下介绍均来自内核官方文档。
fs.nr_open
This denotes the maximum number of file-handles a process can allocate. Default value is 1024*1024 (1048576) which should be enough for most machines. Actual limit depends on RLIMIT_NOFILE resource limit.
单个程序所能打开的最大文件句柄数,通知受制于 /etc/security/limits.conf
。
fs.aio-max-nr & aio-nr
aio-nr shows the current system-wide number of asynchronous io requests. aio-max-nr allows you to change the maximum value aio-nr can grow to. If aio-nr reaches aio-nr-max then io_setup will fail with EAGAIN. Note that raising aio-max-nr does not result in the pre-allocation or re-sizing of any kernel data structures.
aio-nr
当前异步IO请求数。aio-max-nr
系统允许的最大异步IO请求数。
fs.file-max & file-nr
The value in file-max denotes the maximum number of file- handles that the Linux kernel will allocate. When you get lots of error messages about running out of file handles, you might want to increase this limit.
Historically,the kernel was able to allocate file handles dynamically, but not to free them again. The three values in file-nr denote the number of allocated file handles, the number of allocated but unused file handles, and the maximum number of file handles. Linux 2.6 and later always reports 0 as the number of free file handles – this is not an error, it just means that the number of allocated file handles exactly matches the number of used file handles.
file-nr
当前打开的文件句柄数。
file-max
系统允许打开的最大文件句柄数。