[squid-users] SQUID memory error after vm.swappines changed from 60 to 10

Alex Rousskov rousskov at measurement-factory.com
Mon Nov 13 15:36:02 UTC 2017


On 11/13/2017 02:34 AM, Bike dernikov1 wrote:
> On Fri, Nov 10, 2017 at 4:43 PM, Alex Rousskov wrote:
>> Squid swapping in production is an arguably worse disaster, as you have
>> learned. In many cases, it is better to deal with a lack of swap than to
>> rely on swap's magical effects that most humans poorly understand. YMMV.

> In this scenario, swap is backup cache (as I understand)?

In this scenario, swap is not a cache! In fact it is pretty much the
opposite:

* A cache is, by definition, an optional unreliable "fast" storage meant
to reduce the need to go to some "slow" storage.

* When in active use, swap is required reliable slow storage meant to
extend fast storage (RAM) capacity.

Do you see how almost every adjective in the first bullet is replaced
with an antonym in the second one?

Some services, including many databases, overallocate RAM to store
rarely used (computed and/or preloaded) data. When that data is swapped
out, the service often continues to operate normally because the data is
rarely accessed (and/or because swapping it in is still cheaper than
computing it from scratch).

With Squid, it is very difficult for the OS to correctly identify the
rarely used RAM areas to swap out. When the OS swaps out the wrong area,
Squid slows down (to access that area), which only increases the number
of concurrent transactions and, hence, the amount of RAM Squid needs to
operate, which triggers more wrong swap outs, creating a vicious cycle.


> Swap could be used  to translate back data to mem if used, but it
> stays on disk and purge after some time if not used ?

The purging bit is wrong. Think of swap as very very very slow RAM.

Alex.


More information about the squid-users mailing list