Squid running out of filedescriptors on CentOS 7

Solution 1:

The number of file descriptors is set in the systemd unit file. By default this is 16384, as you can see in /usr/lib/systemd/system/squid.service.

To override this, create a locally overriding /etc/systemd/system/squid.service which changes the amount of file descriptors. It should look something like this:

.include /usr/lib/systemd/system/squid.service

[Service]
LimitNOFILE=65536

Do not edit the default file /usr/lib/systemd/system/squid.service, as it will be restored whenever the package is updated. That is why we put it in a local file to override defaults.

After creating this file, tell systemd about it:

systemctl daemon-reload

and then restart squid.

systemctl restart squid