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 1r3tRm-006NCD-LA for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Nov 2023 07:39:26 +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 1r3tRk-00CScT-Ld for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Nov 2023 07:39:24 +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 1r3tRk-00CScK-Bi for pgsql-hackers@lists.postgresql.org; Fri, 17 Nov 2023 07:39:24 +0000 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1r3tRh-005ywo-Ii for pgsql-hackers@lists.postgresql.org; Fri, 17 Nov 2023 07:39:22 +0000 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-50949b7d7ffso2410575e87.0 for ; Thu, 16 Nov 2023 23:39:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700206760; x=1700811560; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=FFNrOM62IZNnhKSTFZdx1KAnFRSGXuAMHO+hAIRrNkM=; b=EI/FJOV7RUp4m26zE/mjrMqXHErDnbeB0iVjAw1MvSHCbYbMt3yfZcsSKXu+BHNDqo 3yqe/z0rMTizaSIQ47rj1ezn32nJlxuEVEGqPvO0xp7JqU8Nj6vpGXHgI9Z6mAlN3nhj S/BIsDt2LryHTY8yB0acHbC5LsO66yWrOzsWuG8dKtVvIU1GdRG7YLIzMaU9h4ikHO8S cu3GS6gb80x0CZunUN7R7s5B8oGSbYW5Qo2F7qLuvAkuafkKcuEIcKxlRsjA16oAv1bu iTzFSDnezuLOfAAkf3Suygt4qYxriKwRtnOy6nIkMN7gQGVExQhipPElgoePyDshKYP0 W7wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700206760; x=1700811560; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FFNrOM62IZNnhKSTFZdx1KAnFRSGXuAMHO+hAIRrNkM=; b=CMRV2KCAT9VQdlzG19OmpQDViRgqHUOA1+oQ/Fol6QzfikKohFBZeZ8/w8IjS9TmCl 5Vv8BoH0ssJnKHJbgFH63DnPC1BaCPUbZX9dXqLf4o2zntH2Xv9onRVkgVoEguj5Va6I YrqAawbw6T9J58U+Bo+Mv5iW/VDNCKoNynnh6j5Y+InMHdaAt3X72npdGo2WfUxHfCBN YiRljYa5eN5Q072EZdBDuXrYSzmwfHJqIxKxLHyg79KLEcwd6SGs0GvJcKCyF7TNtnZz huLLheVHs2z+qUbypRP1PuBjVAzrwkI7NLkrqJbE78XzrONcqpoWeFL8LttefX2YTJfD cPYA== X-Gm-Message-State: AOJu0YzhhGrFs4m+urP6wVHlGzskYClU3ml+3BE/Rh8i/gqHvI3+9Dxd QzRtLoi9fr7DIGFjrrSQvi5PcX32lAEVxXr6/pg= X-Google-Smtp-Source: AGHT+IHWffP/2gKuhDy92FTLB6/yfUL3Dpvn40DO7ZcTAmV2aFj1WhqnVUdf/3YSQt9Hb3xIfT+cVmZHjsTXB0214Wk= X-Received: by 2002:a05:6512:b1f:b0:509:49f1:b7c8 with SMTP id w31-20020a0565120b1f00b0050949f1b7c8mr3650213lfu.21.1700206759478; Thu, 16 Nov 2023 23:39:19 -0800 (PST) MIME-Version: 1.0 References: <202311160941.olx5z3a7pkww@alvherre.pgsql> In-Reply-To: <202311160941.olx5z3a7pkww@alvherre.pgsql> From: Dilip Kumar Date: Fri, 17 Nov 2023 13:09:03 +0530 Message-ID: Subject: Re: SLRU optimization - configurable buffer pool and partitioning the SLRU lock To: Alvaro Herrera Cc: "Andrey M. Borodin" , PostgreSQL Hackers 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 Thu, Nov 16, 2023 at 3:11=E2=80=AFPM Alvaro Herrera wrote: > > I just noticed that 0003 does some changes to > TransactionGroupUpdateXidStatus() that haven't been adequately > explained AFAICS. How do you know that these changes are safe? IMHO this is safe as well as logical to do w.r.t. performance. It's safe because whenever we are updating any page in a group we are acquiring the respective bank lock in exclusive mode and in extreme cases if there are pages from different banks then we do switch the lock as well before updating the pages from different groups. And, we do not wake any process in a group unless we have done the status update for all the processes so there could not be any race condition as well. Also, It should not affect the performance adversely as well and this will not remove the need for group updates. The main use case of group update is that it will optimize a situation when most of the processes are contending for status updates on the same page and processes that are waiting for status updates on different pages will go to different groups w.r.t. that page, so in short in a group on best effort basis we are trying to have the processes which are waiting to update the same clog page that mean logically all the processes in the group will be waiting on the same bank lock. In an extreme situation if there are processes in the group that are trying to update different pages or even pages from different banks then we are handling it well by changing the lock. Although someone may raise a concern that in cases where there are processes that are waiting for different bank locks then after releasing one lock why not wake up those processes, I think that is not required because that is the situation we are trying to avoid where there are processes trying to update different are in the same group so there is no point in adding complexity to optimize that case. > 0001 contains one typo in the docs, "cotents". > > I'm not a fan of the fact that some CLOG sizing macros moved to clog.h, > leaving others in clog.c. Maybe add commentary cross-linking both. > Alternatively, perhaps allowing xact_buffers to grow beyond 65536 up to > the slru.h-defined limit of 131072 is not that bad, even if it's more > than could possibly be needed for xact_buffers; nobody is going to use > 64k buffers, since useful values are below a couple thousand anyhow. I agree, that allowing xact_buffers to grow beyond 65536 up to the slru.h-defined limit of 131072 is not that bad, so I will change that in the next version. --=20 Regards, Dilip Kumar EnterpriseDB: http://www.enterprisedb.com