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 1ujL2e-006Hc1-SH for pgsql-performance@arkaria.postgresql.org; Tue, 05 Aug 2025 17:01:37 +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 1ujL2d-00AWFM-Cb for pgsql-performance@arkaria.postgresql.org; Tue, 05 Aug 2025 17:01:35 +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 1ujL2c-00AWF8-Rf for pgsql-performance@lists.postgresql.org; Tue, 05 Aug 2025 17:01:34 +0000 Received: from mail-yb1-xb2a.google.com ([2607:f8b0:4864:20::b2a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ujL2Z-000t8k-2j for pgsql-performance@lists.postgresql.org; Tue, 05 Aug 2025 17:01:33 +0000 Received: by mail-yb1-xb2a.google.com with SMTP id 3f1490d57ef6-e75668006b9so4578532276.3 for ; Tue, 05 Aug 2025 10:01:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754413292; x=1755018092; darn=lists.postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=qEFjGnHic2pOOut7+Oy8LF8LCYXSEQtoR0QN+xtqPbE=; b=IY0xOLCWQzuI/+PoWBeQa+Wr0sH5ZS6hDGF8CadVv+OFrrwB7TtNvbO/PVa5s3KNc+ MxZDS2edtY6Vmz6PBUJUmJaZ5QVafZvUaM9I526s5YRDrkbzM2kpAhuPxdH2xcBRIXCN h8kHQtwxrKkwQgwYc8mzCjseNH0VL+mf4v3Gr+8IoMPakPXfblYU56xOIlS2WtRuebJw sF4fKbP337bChG4Vn/22Gud+GkHxn+TBo9W5DQySyLtlRh7+ANFFYB85lrmZul50/Dhz hCLr4ZAI3H/+zF8aE0AKNAKLnqXoi7GeCULgpyJ+6/MNoPbTfcV6ZuvkXky2mbymTPbP RRxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754413292; x=1755018092; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=qEFjGnHic2pOOut7+Oy8LF8LCYXSEQtoR0QN+xtqPbE=; b=oAHpp0IGL1nkCaARF5xgBDpPN0czcTN3VHGLjW2VDiPN5kZ8GwG+p5hxOXBVGuzrnY mRKihs3akeTO+z0IzHn/SgoQMTDJ1c8Uzhz1VkVeQM1FikFC12UUx5i5LEydwdXRgXvw KCdtfFQmrncItDD0MQtM15I2UnNEyKoxa3Hau5nTVKIkxolZLvYHikY7EKaP4yyJUerX qf0zCcloW9hUPPmTQ69AC63V+w+QR9LjkYz4Eyq0KRmYmHlZRLwFRGx4ubPK73DvildH /FnPGEp5CnXEfDsAEdXtzgaEVeGhTe3aXJC7t4gEtDzW3Voyvwqv41HC/PsX+uSTnaYh OvxA== X-Gm-Message-State: AOJu0YxMOvKVKd/YXrD8ado67/Rg+DlFrTcOaN09IMYUiToEFCifh9Dz v5wVDkvr3XW6ivirWbwFUWQerUcUceNU3pMVMpq3WprHWlLDyLu4Qexu3renY6yIJFoGPkWQbKv bOaiZGR/rbCqvy+dWJPIUOWwriaoB3A/49vrs X-Gm-Gg: ASbGncueeYZe3X9fIMm3KCqSb+vfRZbitd7GuGLVDFGGbjEKwTf0yG3+3Fi7K3H+3/S 0EecFRm+Puk0J+EDnDujexYe/ZeY28FAXCnYTq51h8RdSEPp0OvklqNQ2y3FQbMnRZWHs4oqY76 /p5hO169ejbuin78g6KDT2ZPLNMrak5Fdv1sNSZmrfQ0jmNPQjC6VDD9gjqm3XT3B5sUMhjUXa5 Wwg3njpUFyvJA== X-Google-Smtp-Source: AGHT+IEgEyRWRlnBoUNqj32tgU04ob3LCo8VD34GHMNI63smGXX5hBKtrLjQysTebIzaCUd4olMfbEjHRcUqa/yYKWI= X-Received: by 2002:a05:6902:208a:b0:e8e:2a6b:251f with SMTP id 3f1490d57ef6-e8fee1bbb39mr15453797276.32.1754413291628; Tue, 05 Aug 2025 10:01:31 -0700 (PDT) MIME-Version: 1.0 From: Priya V Date: Tue, 5 Aug 2025 12:01:19 -0500 X-Gm-Features: Ac12FXyOM1NB0bwTT6JASwIRtPZE4vHLIRzGH3aHSUucHUjzqdLNQe7F7vgUKUU Message-ID: Subject: Safe vm.overcommit_ratio for Large Multi-Instance PostgreSQL Fleet To: pgsql-performance@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000096c1b063ba12d15" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000096c1b063ba12d15 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello Postgres community, We operate a large PostgreSQL fleet (~15,000 databases) on dedicated Linux hosts. Each host runs *multiple PostgreSQL instances* (multi-instance setup, not just multiple DBs inside one instance). *Environment:* - *PostgreSQL Versions:* Mix of 13.13 and 15.12 (upgrades in progress to be at 15.12 currently both are actively in use) - *OS / Kernel:* RHEL 7 & RHEL 8 variants, kernels in the 4.14=E2=80=934.1= 8 range - *RAM:* 256 GiB (varies slightly) - *Swap:* Currently none - *Workload:* Highly mixed =E2=80=94 OLTP-style internal apps with unpredi= ctable query patterns and connection counts - *Goal:* Uniform, safe memory settings across the fleet to avoid kernel or database instability We=E2=80=99re reviewing vm.overcommit_* settings because we=E2=80=99ve seen= conflicting guidance: - vm.overcommit_memory =3D 2 gives predictability but can reject allocatio= ns early - vm.overcommit_memory =3D 1 is more flexible but risks OOM kills if many backends hit peak memory usage at once We=E2=80=99re considering: - *vm.overcommit_memory =3D 2* for strict accounting - Increasing vm.overcommit_ratio from 50 =E2=86=92 80 or 90 to better refl= ect actual PostgreSQL usage (e.g., work_mem reservations that aren=E2=80=99t= fully used) *Our questions for those running large PostgreSQL fleets:* 1. What overcommit_ratio do you find safe for PostgreSQL without causing kernel memory crunches? 2. Do you prefer overcommit_memory =3D 1 or =3D 2 for production stability? 3. How much swap (if any) do you keep in large-memory servers where PostgreSQL is the primary workload? Is having swap configured a good ide= a or not ? 4. Any real-world cases where kernel accounting was too strict or too loose for PostgreSQL? 5. What settings to go with if we are not planning on using swap ? We=E2=80=99d like to avoid both extremes: - Too low a ratio =E2=86=92 PostgreSQL backends failing allocations even w= ith free RAM - Too high a ratio =E2=86=92 OOM killer terminating PostgreSQL under load = spikes Any operational experiences, tuning recommendations, or kernel/PG interaction pitfalls would be very helpful. TIA --000000000000096c1b063ba12d15 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello Postgres community,

We operate a l= arge PostgreSQL fleet (~15,000 databases) on dedicated Linux hosts.
Each host runs multiple PostgreSQL instances (multi-instan= ce setup, not just multiple DBs inside one instance).

Environment:

  • PostgreSQL Versions: Mix of 13.13 and 15.12 (upgrades i= n progress to be at 15.12 currently both are actively in use)

  • OS / Kernel: RHEL 7 & RHEL 8 variants, kernels in t= he 4.14=E2=80=934.18 range

  • RAM: 256 GiB (varies slightly)

  • Swap: Currently none

  • Workload: Highly mixed =E2=80=94 OLTP-style internal ap= ps with unpredictable query patterns and connection counts

  • Goal: Uniform, safe memory settings across the fleet to= avoid kernel or database instability

We=E2=80=99re re= viewing vm.overcommit_* settings because we=E2=80=99ve seen co= nflicting guidance:

  • vm.overcommit_memory =3D 2 gives predictability but can rej= ect allocations early

  • vm.overcommit_memory =3D 1 is more flexible but risks OOM k= ills if many backends hit peak memory usage at once

We=E2=80=99re considering:

  • vm.overcommit_memory =3D 2 for strict acco= unting

  • Increasing vm.overcommit_ratio from 50 =E2=86=92 80 or 90 t= o better reflect actual PostgreSQL usage (e.g., work_mem reser= vations that aren=E2=80=99t fully used)

Our questions for those running large PostgreSQL fleets:

  1. What overcommit_ratio do you find safe for PostgreSQL witho= ut causing kernel memory crunches?

  2. Do you prefer overcommit_memory =3D 1 or =3D 2= for production stability?

  3. How much swap (if any) do you keep in large-memory servers where Postgre= SQL is the primary workload? Is having swap configured a good idea or not ?= =C2=A0

  4. Any real-world cases where kernel accounting was too strict or too loose= for PostgreSQL?

  5. What settings to go with if we are not plannin= g on using swap ?

We=E2=80=99d like to avoid both extremes:

  • Too low a ratio =E2=86=92 PostgreSQL backends failing allocations even w= ith free RAM

  • Too high a ratio =E2=86=92 OOM killer terminating PostgreSQL under load = spikes

Any operational experiences, tuning recommendations, or kernel/PG intera= ction pitfalls would be very helpful.

TIA




--000000000000096c1b063ba12d15--