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 1tuSxK-008qIV-2h for pgsql-admin@arkaria.postgresql.org; Tue, 18 Mar 2025 09:09:50 +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 1tuSxI-00AsJe-E9 for pgsql-admin@arkaria.postgresql.org; Tue, 18 Mar 2025 09:09:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tuSxI-00AsJW-0i for pgsql-admin@lists.postgresql.org; Tue, 18 Mar 2025 09:09:48 +0000 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tuSxE-003Wtx-1k for pgsql-admin@lists.postgresql.org; Tue, 18 Mar 2025 09:09:47 +0000 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-ac29af3382dso880991666b.2 for ; Tue, 18 Mar 2025 02:09:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1742288984; x=1742893784; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=q6sgIHQ+c/h8GpqCu2bBP0EvS7w27sYVhJ73o5exV5E=; b=oV29qcY9y/mvW0Ek9wlMn/TVHZe4Hhf3dN4DvdFIZGsFZgV8cDfGPQ+n6fM7YVrPBM 1nFevlTT1ZRqo1ocOJjNcZKPj+iw7ai13uUXytg7Ev8MkRIpbOmH0VVQ6OQNkAwEgTxH yacN5oGpwW3oGaWncDYMhMY68UD1kjnC1a56wGLWiWnaNKYYwZl7amO1D5qpHQkA85DC ORIpeS9P9dSb/qqbUhHdUYgcQ58DL6hCYGCsipBIvDUzjrHP6AmdCPIFDTgpDyp1VJ5V 1UdOpDae6lRryCg11Z3t3pJ7dwViaEndKk7f/8KbTTo1bMAX+LQlzToTQqtbjNrm97JZ 5fdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742288984; x=1742893784; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=q6sgIHQ+c/h8GpqCu2bBP0EvS7w27sYVhJ73o5exV5E=; b=fVyTN0GlV5cXEAQQKBl3yFmvYqphbT4+YvmnjjE8W5eoc+QkybSYl9tiBevQmLsh6i 2RJDx37MlDD7TMnqoBrTyt1zrBa57vJ73v9EOSz+hUPivIEKeCxu4/WmdnfRc8zRhzJz hOdSEYff1S4pTzNCm1UntlSIIvbED7blgvIqE8sBB28Eqbfp0Mwv2kIkR2nkgUj00ugv pJd33izXzcMjNGqquU/6dISWQlgf/k1SZ5LeEZNrZ0pg9I5jgwcKzZMoZxyINp8pW8Aa GkVJ0pJvjAq/hVVV85r8b6kMtJhlUQWgW8OKjWINCvmYYCgXgtvb19JJ7UZNZSw+KLDR SDbA== X-Forwarded-Encrypted: i=1; AJvYcCUkFx07XoIX2/hY5lXses5Xn4eG2COFBH9yG1iRY1QiNMt7bUrbcwGadF6I2w+LW3lsfU8a2DpuzyHDhg==@lists.postgresql.org X-Gm-Message-State: AOJu0YzGc5umKZuiSu2JN4SDa7sUs1SDDiZ8KVAD3kcHxRbE3yg9qDFD kMinBRcJ35xdjkxjQA1L39wte5ExofttwNRYZN5qbMtcDDl7Y6guxrTNSrTPPic= X-Gm-Gg: ASbGncvWk8iuq6bPGROElrHeSrapRSVnurgrG/O+33f/ocRVyJ54PDGht5b/QxfMtFo Z9BZkdKVQvYYm4d/rZ4UTOWszeCFjKzgDHLpnfwvCDxsyEkec1g8hjQGAEtBDWiFj2zBKqql+6y vKzePdmkwKvaOpSqc9/9RXsxxZQf0bKdLVAIuh9uPLb3aNnXMiYLKcz6PXafXDtcsIF5IWJ7lYU CVjQqjIyWLMN2yZKW8wnIsszeEIbW4eY+K9qEjFzU2d7fQ2rdu9Hef4z7WeqAa5qi2fvON2BjFp jai6GP9+YXzbFBCdPKE6cRAGPY8c/L/nW3me2QDUizOBv+BFCAD1k35HkmElE711 X-Google-Smtp-Source: AGHT+IFEPia54RXbw/E7dzCDpE7JM/iQZW50yXPm+osvcErjMDyYUtpa23etV05+TVi8OwI9vzOB1w== X-Received: by 2002:a17:907:d70c:b0:ac3:8d36:ead3 with SMTP id a640c23a62f3a-ac38d36eb57mr295357566b.12.1742288984469; Tue, 18 Mar 2025 02:09:44 -0700 (PDT) Received: from localhost.localdomain ([2001:871:5e:533e:793b:786a:f423:7b68]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac386314658sm172255066b.135.2025.03.18.02.09.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 02:09:44 -0700 (PDT) Message-ID: <3d5ed781370b8eba8c7b261052cd3904db135d40.camel@cybertec.at> Subject: Re: Background writer not much active From: Laurenz Albe To: Motog Plus , Pgsql-admin Date: Tue, 18 Mar 2025 10:09:43 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.54.3 (3.54.3-1.fc41) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 2025-03-18 at 13:32 +0530, Motog Plus wrote: > We are doing performance testing of our applications. During testing our = postgres db > got crashed with the error checkpointer was killed by signal 9. When chec= ked system > logs we found it was OOM issue.=C2=A0=C2=A0 > We have postgreSQL on independent node with 32GB RAM, multiple DBs are th= ere witl > multiple schemas. > > Our current configuration is as follows: > Shared buffers 12 GB(increased from 10) > Work_mem 6 MB > Maintenance work mem 1 gb > Active connections around 1500-2000. > > While analysing issue we made below changes: > Increased shared buffers from. 10 to 12 gb as buffers_alloc was getting i= ncreased=C2=A0 > Bgwriter_delay was 200 ms, reduced to 100ms > Bgwriter multiplier increased from 2 to 4 and then reduced to 3 > Bgwriter max pages increased from 100 to 1000 > =C2=A0We changed above bgwriter parameters to make bgwriter more aggressi= ve but still we see > most of the writes are being done by checkpointer as indicated by buffer= s_checkpoint > and then by backends indicated by buffers_backend and then by bgwriter i= ndicated by > buffers_clean. That's exactly the way it should be. > Can you please advise on how to make bgwriter more active or am I missing= to validate anything. I don't think that is indicated. > Also please advise can we tune any parameters to fix the OOM error that I= mentioned in > the starting, apart from looking at the queries. Reduce the memory parameters: shared_buffers, work_mem, maintenance_work_me= m But most of all, get a working connection pool and reduce the number of connections to something like 50. That way, you can be more generous with the memory parameters and still not run OOM. > Also if I want to check what queries might have caused the memory issue, = that would > be queries just above the checkpointer killed error message in the postgr= es logs? Yes. Yours, Laurenz Albe