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:

  1. Log in to your FreeBSD system as the root user.
  2. Open the /etc/sysctl.conf file with a text editor:
    vi /etc/sysctl.conf
  3. Add the following lines to the file to increase the file descriptor limits:
    kern.maxfiles=65536
    kern.maxfilesperproc=32768

    This will set the maximum number of open files to 65536 system-wide and 32768 per process.

  4. Save and close the file.
  5. Edit the /etc/login.conf file:
    vi /etc/login.conf
  6. Find the following line:
    :openfiles-cur=128:\
  7. Change it to:
    :openfiles-cur=32768:\

    This will set the maximum number of open files to 32768 for each user.

  8. Save and close the file.
  9. Rebuild the login class database:
    cap_mkdb /etc/login.conf
  10. 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.

Leave a Comment