FreeBSD Squid Proxy Caching Server Increase File Descriptors Limits
By default, FreeBSD limits the number of file descriptors that a process can open. Squid proxy caching server needs to open many files simultaneously, so you may need to increase the file descriptor limit for Squid. (https://lakeforestgc.com/) Here’s how to do it:
- Log in to your FreeBSD system as the root user.
- Open the
/etc/sysctl.conffile with a text editor:vi /etc/sysctl.conf - Add the following lines to the file to increase the file descriptor limits:
kern.maxfiles=65536 nkern.maxfilesperproc=32768This will set the maximum number of open files to 65536 system-wide and 32768 per process.
- Save and close the file.
- Edit the
/etc/login.conffile:vi /etc/login.conf - Find the following line:
:openfiles-cur=128:\ - Change it to:
:openfiles-cur=32768:\This will set the maximum number of open files to 32768 for each user.
- Save and close the file.
- Rebuild the login class database:
cap_mkdb /etc/login.conf - Restart the Squid service to apply the changes:
service squid restart
That’s it. The file descriptor limits for Squid proxy caching server should now be increased on your FreeBSD system.
n