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 1qvKpw-004aZL-KO for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Oct 2023 17:05:00 +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 1qvKpu-00AEBf-Da for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Oct 2023 17:04:59 +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 1qvKpu-00AE9L-1p for pgsql-hackers@lists.postgresql.org; Tue, 24 Oct 2023 17:04:58 +0000 Received: from mail-il1-x133.google.com ([2607:f8b0:4864:20::133]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qvKpr-002Unk-BH for pgsql-hackers@lists.postgresql.org; Tue, 24 Oct 2023 17:04:58 +0000 Received: by mail-il1-x133.google.com with SMTP id e9e14a558f8ab-3573fa82923so19069875ab.1 for ; Tue, 24 Oct 2023 10:04:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698167093; x=1698771893; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=cjRwrNxL6CmlTL2CjlEkNA9GyMGv1M5Jm62B0sRtUzA=; b=RGq+EfJ19CUvx9OejdUXqI26o2RHYwkEE9c44TmfH2002saJInqenTPlCzQFSeO1tN /zeG21xGsEUuTROYB6mw5WlmIFpJArrN9ABTRpEGKG+B+stIOWblF7FRGzNswWbZjAAW QR7f3u39x54vecN0DNhvZ6DHxjq+JkZyTKv83Rf54cOduMzZFMZ+xVMiI1FB+348yPAa H/XzzIyDSxNOelm0VbwgoyUfyqxyV+GHrNDYl/cG5rXoisaV32beCzArBCNZibTWcnZN Ma8+egYceebOpLavVdv0wD3BsY3moknWnZKB2bhPt+pPYvG3zzRRinTU/iY+zDRvcF4e BOyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698167093; x=1698771893; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=cjRwrNxL6CmlTL2CjlEkNA9GyMGv1M5Jm62B0sRtUzA=; b=YiFGMFa492GsQqgtfNpPhNBZRH0Ig/DiRbO9r7X9PTA/JmWMQGAQEOfwxhMSeuYdSr d9kgSjSmXuGuemQEXJO5j5F6VgvLDMK+D2yYAnjYgvZmeV06wvQ+dsck+dcPuMXvXuA/ 4c1GczpxbimB9GkjisQBbIek9STFhjiWDH0n+L/AfhLFbF7x4COrdHiUqs4zVGlYRNA5 2Mz1roIVH75nL9kg3EU4RhPu0f+GcwotMWBEEql5vrpyBEwACvy+EPd8+rtxaSeSXC/m Hy+LHZqc3EbROi7KpItfDTaRNfGbZWFoHT9GKBQptppGkHOd6kk4n3Zco/VwIL2aeF36 aO4A== X-Gm-Message-State: AOJu0YzbUA+cf4VupjeXKBVZl9mXEqSAv0cwiBIn1LFuhFLiBk2vLKiC IzNrjvWj28rEmYW8ijv/AKE= X-Google-Smtp-Source: AGHT+IHBOU0W0ayhf0BsJ9gpv6qWRDk6MRWqKnZmt17gdc5ds3kk3f19d4SYdaNV2aa5/ZZn41R5aA== X-Received: by 2002:a92:d44c:0:b0:34f:d665:4c2e with SMTP id r12-20020a92d44c000000b0034fd6654c2emr12512126ilm.30.1698167093260; Tue, 24 Oct 2023 10:04:53 -0700 (PDT) Received: from nathanxps13 (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id w7-20020a056e021c8700b003574cad1598sm3280224ill.33.2023.10.24.10.04.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 10:04:52 -0700 (PDT) Date: Tue, 24 Oct 2023 12:04:51 -0500 From: Nathan Bossart To: Alvaro Herrera Cc: Dilip Kumar , PostgreSQL Hackers Subject: Re: SLRU optimization - configurable buffer pool and partitioning the SLRU lock Message-ID: <20231024170451.GC871220@nathanxps13> References: <202310241604.bvjwhasbhjg7@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202310241604.bvjwhasbhjg7@alvherre.pgsql> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Oct 24, 2023 at 06:04:13PM +0200, Alvaro Herrera wrote: > Like everybody else, I like having less GUCs to configure, but going > this far to avoid them looks rather disastrous to me. IMO we should > just use Munro's older patches that gave one GUC per SLRU, and users > only need to increase the one that shows up in pg_wait_event sampling. > Someday we will get the (much more complicated) patches to move these > buffers to steal memory from shared buffers, and that'll hopefully let > use get rid of all this complexity. +1 > On the other hand, here's a somewhat crazy idea. What if, instead of > stealing buffers from shared_buffers (which causes a lot of complexity), > we allocate a common pool for all SLRUs to use? We provide a single > knob -- say, non_relational_buffers=32MB as default -- and we use a LRU > algorithm (or something) to distribute that memory across all the SLRUs. > So the ratio to use for this SLRU or that one would depend on the nature > of the workload: maybe more for multixact in this server here, but more > for subtrans in that server there; it's just the total amount that the > user would have to configure, side by side with shared_buffers (and > perhaps scale with it like wal_buffers), and the LRU would handle the > rest. The "only" problem here is finding a distribution algorithm that > doesn't further degrade performance, of course ... I think it's worth a try. It does seem simpler, and it might allow us to sidestep some concerns about scaling when the SLRU pages are in shared_buffers [0]. [0] https://postgr.es/m/ZPsaEGRvllitxB3v%40tamriel.snowman.net -- Nathan Bossart Amazon Web Services: https://aws.amazon.com