public inbox for [email protected]  
help / color / mirror / Atom feed
From: Frits Hoogland <[email protected]>
To: Frédéric Yhuel <[email protected]>
Cc: Joe Conway <[email protected]>
Cc: Priya V <[email protected]>
Cc: [email protected]
Subject: Re: Safe vm.overcommit_ratio for Large Multi-Instance PostgreSQL Fleet
Date: Tue, 19 Aug 2025 17:37:10 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

Thank you for your message Frederic,

I am very much aware of that issue. It’s actually incorrect to say that is a bug: that is how cgroupsv1, which is bundled with rhel8, works. However, it is very counter intuitive. For that reason redhat created the force_cgroup_v2_swappiness parameter uniquely theirselves, it’s not a common Linux parameter.

The specific issue I see in certain cases leading to unreasonable swap usage is Linux workingset detection kicking in, which can choose anonymous memory despite having lots of file memory available, leading to swapping, which sometimes leads to a thrashing situation.

It is funny to see how emotional people react to removing swap, and how people go through great efforts to carefully trying wrap that in a technical reason or point to people having said something that agrees with their emotion. I should say that I understand the reluctance, it’s not weird to feel anxious.

The kernel has no inherent swap requirement. Of course, removing swap cannot be blindly applied, you have to carefully make it suit your environment, usage and intention. And there ARE cases where swap makes sense (if you have memory usage that exceeds physical memory, and you add enough swap to sustain that). But a database in general typically responds bad to swapping (or anything that fluctuates latency), and when swap removal is sensibly done, it prevents anonymous (including lesser frequently used ;-)) memory from getting swapped. 

I will not convince everybody, but I hope I can make some people that understand the technology thinking about it and consider the arguments.

Friendly regards,

Frits



> 
> Op 18 aug 2025 om 18:17 heeft Frédéric Yhuel <[email protected]> het volgende geschreven:
> 
> 
> 
>> On 8/8/25 10:21, Frits Hoogland wrote:
>> If swappiness is set to 0, but swap is available, some documentation suggests it will never use anonymous memory, however I found this not to be true, linux might still choose anonymous memory to reclaim.
> 
> 
> A bug in RHEL8 meant that swappiness was not taken into account unless cgroupv2 was configured or vm.force_cgroup_v2_swappiness was set to 1. See references [1] and [2]. Could this be the cause of your observation?
> 
> [1] https://access.redhat.com/solutions/6785021
> [2] https://github.com/systemd/systemd/issues/9276





view thread (13+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Safe vm.overcommit_ratio for Large Multi-Instance PostgreSQL Fleet
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox