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 1pxz7s-0001ZY-WF for pgsql-admin@arkaria.postgresql.org; Sat, 13 May 2023 23:58:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pxz7r-0004hH-Ml for pgsql-admin@arkaria.postgresql.org; Sat, 13 May 2023 23:58:11 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pxz7r-0004h7-CU for pgsql-admin@lists.postgresql.org; Sat, 13 May 2023 23:58:11 +0000 Received: from mail-yw1-x112e.google.com ([2607:f8b0:4864:20::112e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1pxz7o-002BZE-GF for pgsql-admin@lists.postgresql.org; Sat, 13 May 2023 23:58:10 +0000 Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-55a6efe95c9so164993047b3.1 for ; Sat, 13 May 2023 16:58:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=evaristesys-com.20221208.gappssmtp.com; s=20221208; t=1684022287; x=1686614287; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=QYjbRTPab5KjF7cK8IfVGxqcXes3V64ew9HhmGedTMY=; b=yiuI9psFSf4uJ1SqfIgmQ1TWlVgS9nRaHelxJ0ucN47DXWWHdwJvD6yj+2HywpFwb5 WXC9HdZW7ojsTcEchD0GGllp3Hp99nasUCt6gsoS/HpqWt6Ral75PsbXSSGTdszwE8oq +suwvDTM3iVxCW/8kuR8n1x4tx7uEJxW+6Oy5bRXYhSJklOrJdV4TaZfVZWB/Vkbnmc/ 4HvAf4jzDSRoS9qI0WLo6lLhoqRpF5gi8RP8fB9tNtgGaFa1TT9zFp3LyjZEtIp0KrMp w4d6iAtrrCm//+i8TflM3gIM9ofbjoR1PAJIyOTZHDxuzxNnByiT2orVCjoXTVi2CZxO oY5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684022287; x=1686614287; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QYjbRTPab5KjF7cK8IfVGxqcXes3V64ew9HhmGedTMY=; b=Kee4Hhr0fJt3BqXvpcQobe9NWZhFstR1VpWo4AYncPoktQj9uPwu6QFQksUb9rBMaS WzVZh89NshvJIkUp+Adoi/6PRSNKjVlCM0d5nDVJbF0pz3Lb5ImJJiw3X+LEO4HAT0rD 43Sa/8khPd9xE7h95tcmBNxf9aOdWHej2QNMov00NJLQHh8ZrG8jUp7008s4O1G4awTT fYMLvSnM1Vm6JF8Dm4wQspo/uU23Ea/VXsAEbmdtw5olIYWUuuQ3B75rReE5nbxb3YCt luxsuFHjdDc6OPM9/nkaO5Yg+lOVxyiUPYendFCWW+qmq8L3uYF87Bq4n1Udkv148+68 6Yng== X-Gm-Message-State: AC+VfDwTX6hbwt8kzwoSwbmd1tpeLUvflKr7Odzt1zT+M4Da52kPJADl ak1ex4yrBTS9hkhQPPG7bEYu6Q== X-Google-Smtp-Source: ACHHUZ7LVdsM+0OqPpL1/5uUkDq+WhVQAQ9zH5xrE20EMh9jqMbE7rPjZFFT5jeNcYaIw9OL0RYLLA== X-Received: by 2002:a81:9e01:0:b0:55a:9b89:4eff with SMTP id m1-20020a819e01000000b0055a9b894effmr27048204ywj.13.1684022287662; Sat, 13 May 2023 16:58:07 -0700 (PDT) Received: from smtpclient.apple (99-97-91-220.lightspeed.tukrga.sbcglobal.net. [99.97.91.220]) by smtp.gmail.com with ESMTPSA id s19-20020a257713000000b00ba71e594cafsm1185747ybc.62.2023.05.13.16.58.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 May 2023 16:58:07 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.500.231\)) Subject: Re: Unexplained rapid growth in memory usage of idle backends From: Alex Balashov In-Reply-To: Date: Sat, 13 May 2023 19:57:56 -0400 Cc: pgsql-admin Content-Transfer-Encoding: quoted-printable Message-Id: <215B6284-33E2-421F-B234-D42567DFE2F8@evaristesys.com> References: <2D17E15D-8D5B-4DF7-A238-12455C2731D8@evaristesys.com> To: J T X-Mailer: Apple Mail (2.3731.500.231) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, > On May 13, 2023, at 11:09 AM, J T wrote: >=20 > What is old_snapshot_threshold set to ? It is set to the default -1. > We had runaway and stacked up sessions were occuring which resulted in = the system becoming practically useless. Transactions were dropping and = sessions were climbing. We used the system profiling tool "perf" with = top to trace the bottle neck down to spin locks. The large number of = spin locks were bringing the system to its knees. The perf output also = showed the "TransactionLimitedForOldSnapshot" function as a consumer of = resource. Which brought to mind a known issue with the parameter = old_snapshot_threshold which had a non default value. There have been = reported issues in the Postgres community about old_snapshot_threshold = and bringing a system down completely under load. Have a look at that. The setting is default, as per above. But moreover, the base workload is = pretty low, while the problem appears suddenly, acutely and without = warning despite no change (that we know of) in workload. It makes me = think locking is probably not the problem, simply because that would = manifest more "across the board". > Also, this is really old but worth mentioning anyway, What are = Transparent Huge pages set to at the kernel? I disable that regardless = of it being resolved or not since it was a DB killer at one point. THP is enabled. This system is a relatively stock Debian buster install = and isn't tuned in any special way. The workload simply doesn't require = it; it's not that heavy. That's mostly why this issue is surprising; if = the database were constantly under resource pressure, it would be more = understandable. -- Alex --=20 Alex Balashov Principal Consultant Evariste Systems LLC Web: https://evaristesys.com Tel: +1-706-510-6800