Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oVixQ-0008Vr-3m for pgsql-hackers@arkaria.postgresql.org; Wed, 07 Sep 2022 00:30:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oVixO-00082k-0z for pgsql-hackers@arkaria.postgresql.org; Wed, 07 Sep 2022 00:30:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oVixN-00082b-NG for pgsql-hackers@lists.postgresql.org; Wed, 07 Sep 2022 00:30:17 +0000 Received: from mail-qk1-x72d.google.com ([2607:f8b0:4864:20::72d]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oVixH-0002Yw-7c for pgsql-hackers@lists.postgresql.org; Wed, 07 Sep 2022 00:30:17 +0000 Received: by mail-qk1-x72d.google.com with SMTP id s22so9465758qkj.3 for ; Tue, 06 Sep 2022 17:30:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crunchydata.com; s=google; h=user-agent:mime-version:date:content-transfer-encoding:organization :references:in-reply-to:cc:to:reply-to:from:subject:message-id:from :to:cc:subject:date; bh=EdgiFsQQTEELnA3hyKWmPC3McRPiAd3KfsTk2SjqEuA=; b=AbZDO1WAJeLjkkm8StC73F60asgQXeTJ+c5n2Yw6dsKWVakpq+xGnpLzHzC6xSxaw0 zR2Sb1wCRl8uaQE0PoSKWml2fvKJqHau5zsI8eix+EuLY+JdH4uUlG92eVVLZy5o40ec RJaSbeHW0sDb8m4sNiCKUraoTNeK9+vbMQAT5BHJB4FjflLhjbk973ea/kT7ZA2jULs5 8DIAH8jXH9tHNWzP8ijXZe7MBbQJBgwdrGhCRRVDwNr6tBcssW0GpTB6n5bsqyeiaIXf G8SlnYL3TD28cv1o44E+RD0GZtTUJV6gpd6DtjOzzbTKVRb2BFrYUTtOnL8/GhHB+FS5 aV9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:mime-version:date:content-transfer-encoding:organization :references:in-reply-to:cc:to:reply-to:from:subject:message-id :x-gm-message-state:from:to:cc:subject:date; bh=EdgiFsQQTEELnA3hyKWmPC3McRPiAd3KfsTk2SjqEuA=; b=Zx2yf3AFG07yFnbKeUUEqcipRzY2EQe7GFCR65gqq9aLuMTjd5EubY3WvtQJxKOJzG EBtzmWTfPxfLtpXIqmRFWMHuaOCO6p48MFin+BY3P7pIcB3o+9U83M7zbMlVzumLvvC7 uSrGkiP6SyAFDZCG3UObCPtKSTtdl99rPvPT6sxVYx7mV10S0G5dHTBx4Yg+Tgy5P0ua UfwCpB6wJIFTYi5WcCBITcn9B8oRRRA3WRVbEGP1/T3TmDkq18n557NlULoPfkb570x0 19hkXGMKBazoZRtBclU/f1B3LlzE27B5kC8GopfAfLnn3qfvdXkVMw0WmrMLNuKMnQ3G 3yxg== X-Gm-Message-State: ACgBeo1cEupMIzpaiEYoGRkrfx6Upw9NrVg3YlVrM/XIVP4IqN5zDeYq RicCZW0Gp0kO1Em0pnApzzMvP19PPi8eUw== X-Google-Smtp-Source: AA6agR6tMaPpHSJffJuJHVdgYmLRk6bLUOI1FY4N2UTp/H4D1sSd5lOz6rXmzk4YkHJfrex3+qd4hQ== X-Received: by 2002:a05:620a:424c:b0:6be:78d5:ec73 with SMTP id w12-20020a05620a424c00b006be78d5ec73mr967647qko.579.1662510608703; Tue, 06 Sep 2022 17:30:08 -0700 (PDT) Received: from raker.lan ([98.97.181.172]) by smtp.gmail.com with ESMTPSA id bs12-20020ac86f0c000000b00344b807bb95sm11450193qtb.74.2022.09.06.17.30.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 17:30:08 -0700 (PDT) Message-ID: <36f05c1e1c8b26ce92855f7fbea3e56d5ae15899.camel@crunchydata.com> Subject: Re: Add the ability to limit the amount of memory that can be allocated to backends. From: Reid Thompson Reply-To: reid.thompson@crunchydata.com To: pgsql-hackers Cc: reid.thompson@crunchydata.com In-Reply-To: <3b9b90c6-f4ae-a7df-6519-847ea9d5fe1e@amazon.com> References: <3b9b90c6-f4ae-a7df-6519-847ea9d5fe1e@amazon.com> Organization: Crunchy Data Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Date: Tue, 06 Sep 2022 20:25:06 -0400 MIME-Version: 1.0 User-Agent: Evolution 3.45.1 Compiled: 2022-06-07 10:22:05 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2022-09-02 at 09:30 +0200, Drouvot, Bertrand wrote: > Hi, >=20 > I'm not sure we are choosing the right victims here (aka the ones > that are doing the request that will push the total over the limit). > > Imagine an extreme case where a single backend consumes say 99% of > the limit, shouldn't it be the one to be "punished"? (and somehow forced > to give the memory back). >=20 > The problem that i see with the current approach is that a "bad" > backend could impact all the others and continue to do so. >=20 > what about punishing say the highest consumer , what do you think? > (just speaking about the general idea here, not about the implementation) Initially, we believe that punishing the detector is reasonable if we can help administrators avoid the OOM killer/resource starvation. But we can and should expand on this idea. Another thought is, rather than just failing the query/transaction we have the affected backend do a clean exit, freeing all it's resources. --=20 Reid Thompson Senior Software Engineer Crunchy Data, Inc. reid.thompson@crunchydata.com www.crunchydata.com