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 1lr3Y0-00069p-Rj for pgsql-admin@arkaria.postgresql.org; Wed, 09 Jun 2021 19:07:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lr3Xx-0001M9-OK for pgsql-admin@arkaria.postgresql.org; Wed, 09 Jun 2021 19:07:25 +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 1lr3Xx-0001M1-BF for pgsql-admin@lists.postgresql.org; Wed, 09 Jun 2021 19:07:25 +0000 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lr3Xu-0002Id-J3 for pgsql-admin@postgresql.org; Wed, 09 Jun 2021 19:07:24 +0000 Received: by mail-lj1-x22d.google.com with SMTP id u18so1197157lju.12 for ; Wed, 09 Jun 2021 12:07:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hagander-net.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=ck2NjgVxEOo4sRyRovX+BfXM53l2Fc9ur0tn+AFR4JA=; b=PtRLeCfDQK0jUoMRLOFpjLtBqHmJeZfpvBZ9FA9TdoDilxC5Ge0Oo1ws4m8QU3IPGl GcMEYCq9Rghuj62OThb48CKbqG2i2GaGe+o2nb93nAcfYZukj0cHEt8Ikh7cnIq5Fd23 D6rSuTrlCdLqr4ePLfHJzCNPy0DXe6mBVozOJ0Xo1GzcGquKZCgZ/TegeAWpPWTxWhCM yJBsb5WrYcv8CV05mKdnpjr9CUAIITc08oiR2eaYQK6/Bfds/ZlNL0LkgkQEu/j8nVjP L142kCKAPJsigiq7tXp9DIL98wGCkbHUd4NDCxXpqhRnje11xnhc8iR1o9EQ+n4+g4Gp 2sUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ck2NjgVxEOo4sRyRovX+BfXM53l2Fc9ur0tn+AFR4JA=; b=lalKX1ICIhasGxeBVU2CcabEsdZ4h/7zX4Pp1uo8Zc22EVfcBHV8xNVB7EIdFlEVBt ODrwYoCKXaO12WmTozE2nBmgN2IkY4qxQ7zBzTBinklMRsrW/Kv4EvRiG6oFeKZGsRZg HRoNxB19INWcShFtwxXNdtbg115mpN1/enHFmjiyL8AzslzK/cxv6FJHar81Py9tE7nf rCPhOUk5Wp+yYAg2acTsu7CgIQcjswpwA+SfRimYZLELT2PtN1fL5VResfMzEV8pca1z LSU9NPWwYZ8CFVuVtXGjCFFrNzDdk0vM8YFteYDFayCuY41jA/GU2Gw+xZps+NxcAhpn o5pQ== X-Gm-Message-State: AOAM5306F6HAmkwT5mYp+29PQUVfsaPLYmL1ajNGM2dhc1TTgxijZ29w HUy1BJxjLuI8iriQ6BEemIHJJ/8CIb5fG7eHpaNlbQ== X-Google-Smtp-Source: ABdhPJzV1sbgmKFA1DOd6rEbHs63YTfEQbyuFhxTXt1ZWapvreoqyGmkS+pAHr3ZotrhfNTTQOopPIRH1U/A8ZvcsGQ= X-Received: by 2002:a2e:a7d3:: with SMTP id x19mr999016ljp.120.1623265640677; Wed, 09 Jun 2021 12:07:20 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Magnus Hagander Date: Wed, 9 Jun 2021 21:07:09 +0200 Message-ID: Subject: Re: Estimating HugePages Requirements? To: Julien Rouhaud Cc: Don Seiler , pgsql-admin Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Jun 9, 2021 at 7:23 PM Julien Rouhaud wrote: > > On Thu, Jun 10, 2021 at 12:42 AM Don Seiler wrote: > > > > I'm told other factors contribute to this additional memory requirement= , such as max_connections, wal_buffers, etc. I'm wondering if anyone has be= en able to come up with a reliable method for determining the HugePages req= uirements for a PG cluster based on the GUC values (that would be known at = deployment time). > > It also depends on modules like pg_stat_statements and their own > configuration. I think that you can find the required size that your > current configuration will allocate with: > > SELECT sum(allocated_size) FROM pg_shmem_allocations ; I wonder how hard it would be to for example expose that through a commandline switch or tool. The point being that in order to run the query you suggest, the server must already be running. There is no way to use this to estimate the size that you're going to need after changing the value of shared_buffers, which is a very common scenario. (You can change it, restart without using huge pages because it fails, run that query, change huge pages, and restart again -- but that's not exactly... convenient) --=20 Magnus Hagander Me: https://www.hagander.net/ Work: https://www.redpill-linpro.com/