Monday, June 10, 2024

The Insert Benchmark, Postgres 17beta1, a large server and cached database

This post has results for the Insert Benchmark on a large server with a cached workload. The goal is to compare new Postgres releases with older ones to determine whether get better or worse over time. The results here are from a large server (32 cores, 128G RAM). 

This work was done by Small Datum LLC.

The workload here uses a cached database. The results might be different when the workload is IO-bound (tests in progress). Results were recently shared from tests run on a small server.

tl;dr

  • There are no regressions from Postgres 16.3 to 17beta1 for this benchmark
  • The patch to enforce VISITED_PAGES_LIMIT during get_actual_variable_range fixes the problem with variance from optimizer CPU overhead during DELETE statements, just as it did on a small server
Build + Configuration

This post has results from Postgres versions 10.23, 11.22, 12.19, 13.15, 14.12, 15.7, 16.3 and 17beta1. All were compiled from source. I used configurations that are as similar as possible but I won't have access to the test machines for a few days. The config files are here and I used the file named conf.diff.cx9a2a_c32r128.

For 17beta1 I also tried a build with a patch to enforce VISITED_PAGES_LIMIT during get_actual_variable_range and the results are great (as they were previously great in the results explained here).

The Benchmark

The benchmark is run with 12 client, a cached workload and 12 tables with a table per client. It is explained here.

The test server was named v7 here and is an a Dell Precision 7865 with 32 AMD cores (SMT disabled), 128G RAM, XFS (2 m.2 devices, SW RAID 0) and Ubuntu 22.04.

The benchmark steps are:

  • l.i0
    • insert 15 million rows per table in PK order. The table has a PK index but no secondary indexes. There is one connection per client.
  • l.x
    • create 3 secondary indexes per table. There is one connection per client.
  • l.i1
    • use 2 connections/client. One inserts 40M rows per table and the other does deletes at the same rate as the inserts. Each transaction modifies 50 rows (big transactions). This step is run for a fixed number of inserts, so the run time varies depending on the insert rate.
  • l.i2
    • like l.i1 but each transaction modifies 5 rows (small transactions) and 10M rows are inserted and deleted per table.
    • Wait for X seconds after the step finishes to reduce variance during the read-write benchmark steps that follow. The value of X is a function of the table size.
  • qr100
    • use 3 connections/client. One does range queries and performance is reported for this. The second does does 100 inserts/s and the third does 100 deletes/s. The second and third are less busy than the first. The range queries use covering secondary indexes. This step is run for 1800 seconds. If the target insert rate is not sustained then that is considered to be an SLA failure. If the target insert rate is sustained then the step does the same number of inserts for all systems tested.
  • qp100
    • like qr100 except uses point queries on the PK index
  • qr500
    • like qr100 but the insert and delete rates are increased from 100/s to 500/s
  • qp500
    • like qp100 but the insert and delete rates are increased from 100/s to 500/s
  • qr1000
    • like qr100 but the insert and delete rates are increased from 100/s to 1000/s
  • qp1000
    • like qp100 but the insert and delete rates are increased from 100/s to 1000/s
Results

The performance report is here.
    The summary in each performance report has 3 tables. The first shows absolute throughput by DBMS tested X benchmark step. The second has throughput relative to the version from the first row of the table. The third shows the background insert rate for benchmark steps with background inserts and all systems sustained the target rates. The second table makes it easy to see how performance changes over time. The third table makes it easy to see which DBMS+configs failed to meet the SLA.

    Below I use relative QPS to explain how performance changes. It is: (QPS for $me / QPS for $base) where $me is my version and $base is the version of the base case. The base case here is Postgres 10.23. When relative QPS is > 1.0 then performance improved over time. When it is < 1.0 then there are regressions. The Q in relative QPS measures: 
    • insert/s for l.i0, l.i1, l.i2
    • indexed rows/s for l.x
    • range queries/s for qr100, qr500, qr1000
    • point queries/s for qp100, qp500, qp1000
    Below I use colors to highlight the relative QPS values with red for <= 0.95, green for >= 1.05 and grey for values between 0.95 and 1.05.

    Results

    The base case is Postgres 10.23 with the cx9a2a_c32r3128 config (pg1023_def.cx9a2a_c32r128). It is compared with:
    • Postgres 16.3 (pg163_def.cx9a2a_c32r128)
    • Postgres 17beta1 unchanged (pg17beta1_def.cx9a2a_c32r128)
    • Postgres 17beta1 with the patch to enforce VISITED_PAGES_LIMIT (pg17beta1_def_hack100.cx9a2a_c32r128) that uses the builtin locale provider
    tl;dr
    • Postgres 16.3 and 17beta1 have similar performance
    • The patch to enforce VISITED_PAGES_LIMIT is great (see impact for l.i1, l.i2)
    The metrics from iostat and vmstat are here. Sometimes they are good at suggesting why performance is different between different DBMS. The per-second charts are here and the impact of the VISITED_PAGES_LIMIT patch is apparent when looking at the inserts/s charts for 17beta1 with and without the patch.

    From the summary the relative throughput per benchmark step is:
    • l.i0
      • relative QPS is 1.12 in PG 16.3
      • relative QPS is 1.14 in PG 17beta1 unchanged
      • relative QPS is 1.15 in PG 17beta1 with VISITED_PAGES_LIMIT patch
    • l.x - I ignore this for now
    • l.i1, l.i2
      • relative QPS is 1.652.16 in PG 16.3
      • relative QPS is 1.762.34 in PG 17beta1 unchanged
      • relative QPS is 2.426.44 in PG 17beta1 with VISITED_PAGES_LIMIT patch
    • qr100, qr500, qr1000
      • relative QPS is 1.061.071.07 in PG 16.3
      • relative QPS is 1.051.061.07 in PG 17beta1 unchanged
      • relative QPS is 1.051.071.07 in PG 17beta1 with VISITED_PAGES_LIMIT patch
    • qp100, qp500, qp1000
      • relative QPS is 0.980.990.99 in PG 16.3
      • relative QPS is 0.980.990.99 in PG 17beta1 unchanged
      • relative QPS is 0.980.990.99 in PG 17beta1 with VISITED_PAGES_LIMIT patch

    No comments:

    Post a Comment