Re: Show WAL write and fsync stats in pg_stat_io

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>, Melanie Plageman <melanieplageman(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, "bharath(dot)rupireddyforpostgres(at)gmail(dot)com" <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: Show WAL write and fsync stats in pg_stat_io
Date: 2025-02-03 10:37:54
Message-ID: Z6CcglxJF8XW+R7W@ip-10-97-1-34.eu-west-3.compute.internal
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Feb 03, 2025 at 08:50:15AM +0000, Bertrand Drouvot wrote:
> === 6
>
> I'll also do some benchmark on my side.

So, I did some tests using:

c=1 && psql -c checkpoint -c 'select pg_switch_wal()' &&
pgbench -n -M prepared -c$c -j$c -f <(echo "SELECT pg_logical_emit_message(true, 'test', repeat('0', 8192));";) -P1 -t 20000

With 2 message size: 8192 and 10.

Here are the results (outliers removed and tsc clock source):

+------------+-------------+-------------+
| Version | Msg Size 10 | Msg Size 8K |
+------------+-------------+-------------+
| With PATCH | 980 TPS | 910 TPS |
| On Master | 980 TPS | 910 TPS |
+------------+-------------+-------------+

So the patch does not produce perf regression according to those tests.

Out of curiosity I also played a bit with the IO tracking (and hpet clock source)
and got:

+---------------------------------+-------------+-------------+-----------+
| Test Configuration | PATCH | MASTER | % Change |
+---------------------------------+-------------+-------------+-----------+
| track_io_timing | |
| Message size 8192 | 805 TPS | 810 TPS | -0.6% |
| Message size 10 | 860 TPS | 860 TPS | 0.0% |
+---------------------------------+-------------+-------------+-----------+
| track_wal_io_timing | |
| Message size 8192 | 810 TPS | 810 TPS | 0.0% |
| Message size 10 | 860 TPS | 860 TPS | 0.0% |
+---------------------------------+-------------+-------------+-----------+
| track_wal_io + track_io | |
| Message size 8192 | 800 TPS | 800 TPS | 0.0% |
| Message size 10 | 855 TPS | 860 TPS | -0.6% |
+---------------------------------+-------------+-------------+-----------+

Based on those results the patch does not show a noticable impact when IO timing
tracking is/are enabled.

FYI, It’s also worth noticing that if hpet is set then it also affect negatively
even if no timing tracking is set. It means that when track IO timing is/are
enabled the perf regression seen above are not fully related to having then
enabled but also (for a large part) to hpet vs tsc.

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dmitry Koterov 2025-02-03 11:04:03 Re: Increased work_mem for "logical replication tablesync worker" only?
Previous Message Jim Jones 2025-02-03 10:31:07 Re: Truncate logs by max_log_size