FreeBSD Squid Proxy Caching Server Increase File Descriptors Limits

I‘m getting an error which read as follows under FreeBSD 7.2 server and Squid stable caching server:

ADVERTISEMENTS

WARNING! Your cache is running out of filedescriptors

How do I fix this problem and increase the number of system-wide available filedescriptors for FreeBSD server?

For busy proxy caching server, you need to to increase the number of system-wide available filedescriptors, by editing /etc/sysctl.conf file. There is no need to make changes to squid.conf.

Find Current Squid File Descriptors Limits Under FreeBSD

Type the following command:
# squidclient mgr:info | grep 'file descri'
OR
# squidclient -p 8080 -u USERNAME -w 'secretePassword' mgr:info | grep 'file descri'

Increase Squid File Descriptors Limits

Type the following command at a shell prompt:
# sysctl kern.maxfilesperproc=8192
# sysctl kern.maxfiles=65535

To keep settings after reboot add them to /etc/sysctl.conf
echo 'kern.maxfilesperproc=8192' >> /etc/sysctl.conf
echo 'kern.maxfiles=65535' /etc/sysctl.conf

Where,

  1. kern.maxfilesperproc – Set maximum number of open files to 65535
  2. kern.maxfiles – Set maximum files allowed open per process to 8192

Optionally you may also want to increase port ranges:
# sysctl net.inet.ip.portrange.last=65535
# sysctl net.inet.ip.portrange.first=1024

Finally restart the squid and verify you got new FD settings for squid proxy server:
# squidclient mgr:info | grep 'file descri'

See also:

  1. Squid Proxy WARNING! Your cache is running out of filedescriptors error and solution under Linux operating system
🐧 If you liked this page, please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
1 comment… add one
  • lexx Mar 11, 2010 @ 0:20

    sysctl -a|grep kern.maxfiles
    pstat -T
    sysctl kern.maxfiles=65535

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.