Re: Configurable FP_LOCK_SLOTS_PER_BACKEND

From: Matt Smiley <msmiley(at)gitlab(dot)com>
To: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Nikolay Samokhvalov <nik(at)postgres(dot)ai>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Configurable FP_LOCK_SLOTS_PER_BACKEND
Date: 2023-08-07 21:19:10
Message-ID: CA+eRB3oQeQAa3mO5kAQ59+jza7_XMOC28dbsy-aauO0Y7YuiWg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> Why would the access frequency be uniform? In particular, there's a huge
> variability in how long the locks need to exist
>

As a supporting data point, our example production workload shows a 3x
difference between the most versus least frequently contended lock_manager
lock:
https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/2301#note_1365630726

Since we deterministically distribute relations among those 16 lock_manager
lwlocks by hashing their lock tag, we can probably assume a roughly uniform
number of relations are being managed by each lock_manager lock, but the
demand (and contention) for them is non-uniform. This 3x spread
corroborates the intuition that some relations are locked more frequently
than others (that being both a schema- and workload-specific property).

Since we're contemplating a new hashing scheme, I wonder how we could
accommodate that kind of asymmetry, where some relations are locked more
frequently than others.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2023-08-07 21:36:48 Re: Configurable FP_LOCK_SLOTS_PER_BACKEND
Previous Message Andres Freund 2023-08-07 21:16:25 Re: Configurable FP_LOCK_SLOTS_PER_BACKEND