Sunday, March 17, 2024

Yet another Insert Benchmark result: MySQL, InnoDB and a small server

While trying to explain a Postgres performance problem I repeated the Insert Benchmark on a small server for InnoDB from MySQL 5.6, 5.7 and 8.0. This post explains those results. Previous reports are here for cached and IO-bound workloads and the results here are similar.

tl;dr

  • Disclaimer - the low-concurrency results here are worse than the results from a bigger server with more concurrency because the result here depends more on CPU overheads and MySQL keeps on growing code paths, while on the bigger server the cost from new CPU overheads is offset by other improvements.
  • There are significant regressions from 5.6 to 5.7 and again from 5.7 to 8.0
Build + Configuration

This report has results for InnoDB with MySQL 5.6.51, 5.7.44 and 8.0.36. The cz10a_bee config was used and they are here.

The Benchmark

The benchmark is run with 1 client. It is explained here and was run in two setups
  • cached - database has 30M rows and fits in memory
  • IO-bound - database has 800M rows and is larger than memory, 
The test server was named SER4 in the previous report. It has 8 cores, 16G RAM, Ubuntu 22.04 and XFS using 1 m.2 device.

The benchmark steps are:

  • l.i0
    • insert X million rows per table in PK order. The table has a PK index but no secondary indexes. There is one connection per client. X is 30M for cached and 800M for IO-bound.
  • l.x
    • create 3 secondary indexes per table. There is one connection per client.
  • l.i1
    • use 2 connections/client. One inserts Y rows 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. Y is 80M for cached and 4M for IO-bound.
  • l.i2
    • like l.i1 but each transaction modifies 5 rows (small transactions) and Y is 20M for cached and 1M for IO-bound.
    • Wait for X seconds after the step finishes to reduce variance during the read-write benchmark steps that follow.
  • qr100
    • use 3 connections/client. One does range queries for Z seconds 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 a fixed amount of time. 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. Z is 3600 for cached and 1800 for IO-bound.
  • 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 reports are here for cached and for IO-bound.

The summary has 3 tables. The first shows absolute throughput by DBMS tested X benchmark step. The second has throughput relative to the version on 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.

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. 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.

From the summary for cached:
  • the base case is MySQL 5.6.51
  • comparing 5.7.4 and 8.0.36 with 5.6.21 shows large regressions
    • l.i0
      • relative QPS is 0.84 in 5.7.44
      • relative QPS is 0.57 in 8.0.36
    • l.x - I ignore this for now
    • l.i1, l.i2
      • relative QPS is 1.11, 0.88 in 5.7.44
      • relative QPS is 0.91, 0.73 in 8.0.36
    • qr100, qr500, qr1000
      • relative QPS is 0.73, 0.72, 0.74 in 5.7.44
      • relative QPS is 0.63, 0.63, 0.63 in 8.0.36
    • qp100, qp500, qp1000
      • relative QPS is 0.83, 0.83, 0.82 in 5.7.44
      • relative QPS is 0.63, 0.61, 0.62 in 8.0.36
From the summary for IO-bound:
  • the base case is MySQL 5.6.51
  • comparing 5.7.4 and 8.0.36 with 5.6.21 shows large regressions
    • l.i0
      • relative QPS is 0.86 in 5.7.44
      • relative QPS is 0.59 in 8.0.36
    • l.x - I ignore this for now
    • l.i1, l.i2
      • relative QPS is 1.301.26 in 5.7.44
      • relative QPS is 1.301.16 in 8.0.36
    • qr100, qr500, qr1000
      • relative QPS is 0.760.860.94 in 5.7.44
      • relative QPS is 0.700.810.89 in 8.0.36
    • qp100, qp500, qp1000
      • relative QPS is 0.980.991.02 in 5.7.44
      • relative QPS is 0.940.961.02 in 8.0.36

No comments:

Post a Comment

Fixing some of the InnoDB scan perf regressions in a MySQL fork

I recently learned of Advanced MySQL , a MySQL fork, and ran my sysbench benchmarks for it. It fixed some, but not all, of the regressions f...