Re: Add progressive backoff to XactLockTableWait functions - Mailing list pgsql-hackers

From Xuneng Zhou
Subject Re: Add progressive backoff to XactLockTableWait functions
Date
Msg-id CABPTF7Wqv99W5VXCBu5WE_QwRKC5SRcYnLnxTT2DE7E_QkOU1Q@mail.gmail.com
Whole thread Raw
In response to Add progressive backoff to XactLockTableWait functions  (Xuneng Zhou <xunengzhou@gmail.com>)
List pgsql-hackers
Hi,

Although it’s clear that replacing tight 1 ms polling loops will reduce CPU usage, I'm curious about the hard numbers. To that end, I ran a 60 s logical-replication slot–creation workload on a standby using three different XactLockTableWait() variants—on an 8-core, 16 GB AMD system—and collected both profiling traces and hardware-counter metrics. 


1. Hardware‐counter results


image.png

  • CPU cycles drop by 58% moving from 1 ms to exp. backoff, and another 25% to the 1 s threshold variant.
  • Cache‐misses and context‐switches see similarly large reductions.
  • IPC remains around 0.45, dipping slightly under longer sleeps.

2. Flame‐graph 
See attached files

Best regards, 
Xuneng

Attachment

pgsql-hackers by date:

Previous
From: Dimitrios Apostolou
Date:
Subject: Re: --enable-{debug,cassert} should also activate --enable-depend
Next
From: Konstantin Knizhnik
Date:
Subject: Re: Non-reproducible AIO failure