Linux – Clearing out deleted memory mapped files quicker

fileslinuxlsof

We use Tika for PDF text content extraction for searching. I'm seeing heavy use of temporary files that seem to now run us out of file handles.

We're on CentOS 5.5. For our search system, we had previously bumped up open file handles (/etc/sysctl.conf) fs.file-max = 65535

When looking at lsof for my process, I see lots of files marked as DEL (deleted memory mapped files). If I stop submitting new documents to be indexed, these will get cleared out after several minutes.

java 11105 root DEL REG 104,2 1278402 /tmp/+~JF4155000471009101661.tmp

Can I tune the kernel to clear out these DEL files sooner, or should I increase the number of file handles? If so, how high can we safely go? I have sufficient memory to be able to give more to the kernel.

Thanks

David

Best Answer

I couldn't find a good reference for how increasing fs.file-max impacts the system. Presumably that makes your kernel consume more memory as the structure to track open files gets larger and larger. I suggest increasing to a larger number like 128K and keeping an eye on /proc/sys/fs/file-nr to see how many files are actually used.