User Tools

Site Tools


squid:optimizing_squid

Squid - Optimizing Squid

For the most part, Squid is quite dynamic in handling varying loads but there are some key things to consider.

The most performance affecting attribute about Squid is the cache itself.

If the cache is located on a slow device then the performance of all content will be dependent on this limitation.

For this reason, it is advised that you run your cache on the fastest Read/Write medium that you can.

If your disk is performing other Read/Write operations it can slow the performance of surfing the net.

Another thing to consider is this; the cache is particularly useful when bandwidth is slow or expensive because it can prevent the repetitive download of data, but if your network speed exceeds the I/O performance of your cache media, it will slow the experience down. In cases where network speed exceeds cache-disk I/O, some people run Squid cacheless.


Cacheless

This is useful if the performance of your cache disk is outstripped by the bandwidth of your ISP.

There may be slowness in your proxy server as a result of the cache not being able to write fast enough to disk.

Test your disk speed

Ensure that you have sufficient space in the directory of your cache (/var/spool/squid).

You will need just over 10GB of space to do this test (or you can change the test to do a smaller amount).

df -h

It is best to perform this test when the usage is low. Perform the following write test:

dd if=/dev/zero of=/var/spool/squid/10GB bs=1024 count=10240000 && rm -rf /var/spool/squid/10GB

You should get results similar to this:

10240000+0 records in
10240000+0 records out
10485760000 bytes (10 GB) copied, 84.292 s, 124 MB/s

The results will show the write speed of data to your directory.

If the speed of the internet at your location outstrips the ability to write data in the cache, you may need to set up a no-cache option.

As a typical rule of thumb, your cache to bandwidth ratio needs to perform at a factor of 16:1.

For example, if your disk speed is 100MB/s (800Mb/s) you can perform well with a 50Mb/s pipe.

If you have a 100Mb/s pipe, your disk performance must exceed 200MB/s.

In this example, the drive performs at 124 MB/s which means that it should be sufficient for a 62 Mb/s ISP download pipe.

NOTE: Please note that these are approximations designed for simple planning.


Speed things up

There are multiple ways on speeding up your cache.

You could use a faster drive like an SSD.

You could use multiple drives (like RAID 0 or RAID 10).

Caching is really designed to conserve bandwidth but in situations where the bandwidth exceeds your disk performance, you can just turn off the cache.

This does NOT affect reports so it can be a real win in high bandwidth situations.

To remove the cache you need to change a setting:

Maximum Object Size0
Maximum Object Size in RAM0

Remember to restart Squid for this to take effect.


squid/optimizing_squid.txt · Last modified: 2020/07/15 09:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki