Squid Proxy is Slow

Sometimes browsing through Squid proxy integrated with Web Safety may seem to be slow. This article will try to show some possible steps to remedy this situation.

Check Basic Network Connectivity

To ensure the problem of slowliness of proxy is not in your network being slow by itself, check the basic downloading speed using wget or curl programs running on the proxy box. The following article may also be helpful https://serverfault.com/questions/318909/how-passively-monitor-for-tcp-packet-loss-linux/969781.

DNS Lookup Speed

Check the speed of DNS server that Squid uses. There are two places in Web Safety UI that can help with this. First the DNS lookup speed can be seen in the UI / Dashboard / Squid tab as indicated on the following screenshot. The values shall be close to zero.

../../../_images/squid_dns_speed_dashboard.png

Then check the internal DNS statistics of Squid, using UI / Squid / General / Runtime Info / DNS (or manually using squidclient mgr:idns command). The DNS queue shall be empty proving DNS responses are quick. Also check the number of DNS errors are minimal as indicated on the following screenshot.

../../../_images/squid_dns_speed_table.png

If DNS servers indeed are slow, try to deploy DNS caching server, as described in the article Browsing slow? Deploy DNS caching server.

Check CPU and RAM Usage

Web filtering is quite CPU intensive process so it requires powerful CPUs. It might be you are hitting the limits of the available hardware. This can be checked by running htop command on the proxy box and analysing the CPU usage of squid and wsicapd processes. The more users are using the proxy, the more CPU resources will be consumed. If CPU is close to 100% you might need to consider upgrading the hardware or adding more virtual CPUs to the virtual appliance. Typical output is shown at the following screenshot.

../../../_images/cpu_usage_htop.png

Check Swap

If you have enabled Squid’s cache, check that proxy box has enough free RAM available. If system goes into swap generally it means serious freezing of all activities, including web filtering.

Deploy Cluster of Web Safety

Another possible way to distribute the load is to deploy a cluster of Web Safety appliances as explained in the article Adding redundancy to Active Directory integrated Squid.

Check Active Directory Integration

If proxy is integrated with Microsoft Active Directory it means Web Safety needs to perform user/group matching for every request that comes from the browser. The domain controllers configured on UI / Squid / Auth / Active Directory Integration need to be correct, click the Test Connection button to see that everything runs quickly. Generally the response for the connection test shall be instant.

../../../_images/test_ad_connection.png

Check Squid Logs

Be sure to also check the contents of the Squid’s cache log in UI / Squid / Logs / Cache Log, it might show some problems with configuration (routing, traffic redirection, incorrect Safe Browsing API keys, eCAP ClamAV antivirus, etc).

Check Safe Browsing and Antivirus Logs

If you have enabled Anti-Virus or Safe Browsing scanning on the proxy box, please see is there anything in the UI / Antivirus / Safe Browser / Logs.