Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uoOOu-003EIt-43 for pgsql-performance@arkaria.postgresql.org; Tue, 19 Aug 2025 15:37:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uoOOt-00DYpL-HJ for pgsql-performance@arkaria.postgresql.org; Tue, 19 Aug 2025 15:37:28 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uoOOt-00DYpD-7g for pgsql-performance@lists.postgresql.org; Tue, 19 Aug 2025 15:37:27 +0000 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uoOOr-000gJQ-0y for pgsql-performance@lists.postgresql.org; Tue, 19 Aug 2025 15:37:26 +0000 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-afcb7acfde3so771562966b.3 for ; Tue, 19 Aug 2025 08:37:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755617844; x=1756222644; darn=lists.postgresql.org; h=to:references:message-id:date:cc:in-reply-to:from:mime-version :subject:content-transfer-encoding:from:to:cc:subject:date :message-id:reply-to; bh=+l0DctQbxkAt1z2g52fGzCeLikUxVAXOoOKoqcZtrZo=; b=lttFzQuUXmwm07XNb8yZLE7PNJ86d4Irc3iKqTXCi5lQQQanJsovaM3Fs+lxRYyw8j YsxP08STen8ntmZSZroUmESesbKpPRrpNEMTdrMz7gdLAKNqvGdF5oPfz2REaMo0a9XU 8t9QcKb19deQJTAqK/faN/DewMAfYZ3T6SjICuu9LaICRROo2bjeKDR+PuBqyFMyFbhM Oh0eoV2hy45eb6umRbX/dSuqkr3tlR3E3U2OBcNVpq2uB2gYAZv8JUE0or4ZHTfTNS1u qQxgZBTUAnpFiVjMm3Wk9iLNxtFUS1BUqR+UkOt6d21aVrHdbKLGv1mvM2hGxY2YhZIy wo7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755617844; x=1756222644; h=to:references:message-id:date:cc:in-reply-to:from:mime-version :subject:content-transfer-encoding:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+l0DctQbxkAt1z2g52fGzCeLikUxVAXOoOKoqcZtrZo=; b=unJvdKUKLcyp5f/AfLP5vgdLiyNNEJSx4PKNiS5hgc4DWfHBkAuyuyk+fJJEx7rz/Q Jx8p1b1ZHvANUgqh59de4QnbvdOYfUXWuDLEGRh/+Tmka/oPAz6YZM6ziQdDBqgM0RZ/ EPyLVA2/lEqSB0L2kurk48vbDOt7vFq9bQeeOQx9cTj0Whz6ACoerCeOLEj+a7cXovyv paTthAvLAIMQwfOUZSn//vyS4OLSvHihoYKhDAj0QStBtuxzSZ6h2wPCyrwzOVIe8MkL U6v9Ez5FJ86cMRhFWbNwTT0MIZbmb8AuNk8SJ494SzpBIzvfFQx8T1H6CkM7Hw5zrsRf kXxA== X-Forwarded-Encrypted: i=1; AJvYcCWo/DGZ0NwcqGuANitJ07zDUKXY0SkwzhA1QcflOcj4BstM73g9WXLmB21RONo1KHKzpYQRBttC233h2OgRLa3RIA==@lists.postgresql.org X-Gm-Message-State: AOJu0YwfW8Q6lSxRh5R0hsgdruMwspbEAy9q5j2NNRSVBaVvsJnA/3j2 zpFdLqakeo2TzU07TNJ1BPx9yPudG3X6tD8p87cE7FErIq8k/wBwphDQf7SdGRA2 X-Gm-Gg: ASbGncugNfBD83tuBnIkqnN6mB1kwRinl73FCREdJYW05YdoqkpuMsCmk0MSVLOQyXK zAx/MQM27nHayfkmiMkhmi9pmargytIafCWtBA6Urhwci09euS1L24b8sl6EVg/KZJ3AmJ4z2m9 Q+w6+mhwnuvJOgQQwhC7vUKEfafEqETCGmAbMuSoYhOA8FEIkFEQWj5oCWNdmb4UOteVrBFizws qqMhYbCNrWqswuu06Rjf7l+0hmKqprhhXP1wjdVih0Qwj/8c9r4YU3/UKOkA4nXOrDAHbEaKEsD 8OPrGglXuq3TSe1pJZJXPHDthhP4uQSIYvphBSZrl7dhpu9yuj/rj8deMS4TNrNByvt1fDzA0bs 11x8FZKNgYAFMHY6voZ2zNMcwwnKyZa6rqwhJKd5C0Y4vuWxlWMbk4yugfQG1ISTsBCCLgesFIA Njx9Uv3g6ff8gOUTjhqk7+Drir4jIN4gRnda/ndPDxhbOsXFrk1c6tmuYPLA== X-Google-Smtp-Source: AGHT+IHQ5GrMuliZM/WiXNNq0rn0yD7nA9TiUFhaodGFMzcviJ/9Bx0IFYhSHcYMMZhxB9d6w0P3/g== X-Received: by 2002:a17:907:9486:b0:af9:8c20:145b with SMTP id a640c23a62f3a-afddc96119cmr308499466b.10.1755617844159; Tue, 19 Aug 2025 08:37:24 -0700 (PDT) Received: from smtpclient.apple (2001-1c04-0681-7700-996f-b5f8-91e3-59fb.cable.dynamic.v6.ziggo.nl. [2001:1c04:681:7700:996f:b5f8:91e3:59fb]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-afded478d5esm3393266b.72.2025.08.19.08.37.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Aug 2025 08:37:23 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: Safe vm.overcommit_ratio for Large Multi-Instance PostgreSQL Fleet Mime-Version: 1.0 (1.0) X-Apple-Notify-Thread: NO X-Universally-Unique-Identifier: 1FB3B554-D307-4818-8260-87E4E5B214A8 From: Frits Hoogland In-Reply-To: <6e36e010-c93c-4d9b-a7ed-db6da1416716@dalibo.com> Cc: Joe Conway , Priya V , pgsql-performance@lists.postgresql.org Date: Tue, 19 Aug 2025 17:37:10 +0200 X-Apple-Message-Smime-Encrypt: NO Message-Id: <08FF1C8D-DDA7-400C-9AC7-71A92AC925E7@gmail.com> References: <6e36e010-c93c-4d9b-a7ed-db6da1416716@dalibo.com> To: =?utf-8?Q?Fr=C3=A9d=C3=A9ric_Yhuel?= X-Mailer: iPad Mail (22G86) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Thank you for your message Frederic, I am very much aware of that issue. It=E2=80=99s actually incorrect to say t= hat is a bug: that is how cgroupsv1, which is bundled with rhel8, works. How= ever, it is very counter intuitive. For that reason redhat created the force= _cgroup_v2_swappiness parameter uniquely theirselves, it=E2=80=99s not a com= mon 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 so= metimes leads to a thrashing situation. It is funny to see how emotional people react to removing swap, and how peop= le go through great efforts to carefully trying wrap that in a technical rea= son or point to people having said something that agrees with their emotion.= I should say that I understand the reluctance, it=E2=80=99s not weird to fe= el 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, us= age and intention. And there ARE cases where swap makes sense (if you have m= emory usage that exceeds physical memory, and you add enough swap to sustain= that). But a database in general typically responds bad to swapping (or any= thing that fluctuates latency), and when swap removal is sensibly done, it p= revents anonymous (including lesser frequently used ;-)) memory from getting= swapped.=20 I will not convince everybody, but I hope I can make some people that unders= tand the technology thinking about it and consider the arguments. Friendly regards, Frits >=20 > Op 18 aug 2025 om 18:17 heeft Fr=C3=A9d=C3=A9ric Yhuel het volgende geschreven: >=20 > =EF=BB=BF >=20 >> On 8/8/25 10:21, Frits Hoogland wrote: >> If swappiness is set to 0, but swap is available, some documentation sugg= ests it will never use anonymous memory, however I found this not to be true= , linux might still choose anonymous memory to reclaim. >=20 >=20 > A bug in RHEL8 meant that swappiness was not taken into account unless cgr= oupv2 was configured or vm.force_cgroup_v2_swappiness was set to 1. See refe= rences [1] and [2]. Could this be the cause of your observation? >=20 > [1] https://access.redhat.com/solutions/6785021 > [2] https://github.com/systemd/systemd/issues/9276