Thursday, January 25, 2024

Updated Insert benchmark: InnoDB/MySQL 5.6, 5.7 and 8.0, small server, cached database

I now have 4 server types at home (8 cores + 16G RAM, 8 cores + 32G RAM,  24 cores, 32 cores) and am trying to finish a round of the Insert Benchmark for each. This has results for the smallest (8 cores + 16G RAM) using a cached workload and MySQL 5.6, 5.7, 8.0.


  • For this setup MySQL has large regressions over time while Postgres does not
  • The regressions in MySQL are large here, but smaller on workloads with more concurrency
  • There are few regressions with the 5.6 and 5.7 release cycles
  • There are large regressions within the 8.0 release cycle
  • There are large regressions at the start of the 5.7 and 8.0 release cycles
  • Enabling the perf schema reduces throughput by ~4% for most write heavy benchmark steps, by ~10% for read heavy benchmark steps and a lot more for index create

Build + Configuration

I tested many versions of MySQL 5.6, 5.7 and 8.0 These were compiled from source. I used the CMake files from here with the patches here to fix problems that otherwise prevent compiling older MySQL releases on modern Ubuntu. In all cases I use the rel build that uses CMAKE_BUILD_TYPE =Release.

I used the cz10a_bee my.cnf files that are here for 5.6for 5.7 and for 8.0. For 5.7 and 8.0 there are many variants of that file to make them work on a range of the point releases.

The versions I tested are:
  • 5.6
    • 5.6.21, 5.6.31, 5.6.41, 5.6.51
  • 5.7
    • 5.7.10, 5.7.20, 5.7.30, 5.7.44
  • 8.0
    • 8.0.13, 8.0.14, 8.0.20, 8.0.28, 8.0.35, 8.0.36
For 8.0.35 I tested a few variations from what is described above to understand the cost of the performance schema:
  • my8035_rel.cz10aps0_bee
    • this uses my.cnf.cz10aps0_bee which is the same as my.cnf.cz10a_bee except it adds performance_schema =0
  • my8035_rel_lessps.cz10a_bee
    • the build disables as much as possible of the performance schema. The CMake file is here.

The test server is a Beelink SER4 with 8 cores, 16G RAM, Ubuntu 22.04 and XFS using 1 m.2 device. The benchmark is run with one client.

I used the updated Insert Benchmark so there are more benchmark steps described below. In order, the benchmark steps are:

  • l.i0
    • insert 30 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 50M 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.
  • l.i2
    • like l.i1 but each transaction modifies 5 rows (small transactions).
  • qr100
    • use 3 connections/client. One does range queries for 1800 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.
  • qp100
    • lik 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

The performance reports are here for MySQL 5.6MySQL 5.7MySQL 8.0 and MySQL 5.6 to 8.0.

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 5.6
  • The base case is 5.6.21
  • Throughput in 5.6.51 is ~2% less than 5.6.21
From the summary for 5.7
  • The base case is 5.7.10
  • Throughput in 5.7.44 is ~3% less than 5.7.10
From the summary for 8.0
  • The base case is 8.0.13
  • I ignore the 8.0.35 variations (cz10aps0_bee config, rel_lessps build) for now
  • Unlike MySQL 5.6 and 5.7 above, there are larger regressions during the 8.0 cycle. Comparing 8.0.36 with 8.0.13
    • l.i0 - relative QPS is 0.81 in 8.0.36
    • l.x (create index) - I ignore this for now but but read this
    • l.i1, l.i2 - relative QPS is 0.91 and 0.80 in 8.0.36
    • qr100, qr500, qr1000 - relative QPS is 0.97, 0.96 and 0.94 in 8.0.36
    • qp100, qp500, qp1000 - relative QPS is 0.86, 0.88 and 0.84 in 8.0.36
From the summary for 8.0 focusing on the 8.0.35 variations that disable the perf schema
  • Throughput for write-heavy steps (l.i0, l.i1, l.i2) is up to 4% better
  • Throughput for read-heavy steps (qr*, qp*) is ~11% better
  • Throughput for parallel index create is ~1.5X better (read this)
From the summary for 5.6, 5.7, 8.0
  • The base case is 5.6.21
  • Comparing 5.7.44 and 8.0.36 with 5.6.21 shows the large regressions
    • l.i0
      • relative QPS is 0.81 in 5.7.44
      • relative QPS is 0.55 in 8.0.36
    • l.x - I ignore this for now
    • l.i1, l.i2
      • relative QPS is 1.100.86 in 5.7.44
      • relative QPS is 0.91, 0.71 in 8.0.36
    • qr100, qr500, qr1000
      • relative QPS is 0.73, 0.72, 0.72 in 5.7.44
      • relative QPS is 0.62, 0.63, 0.62 in 8.0.36
    • qp100, qp500, qp1000
      • relative QPS is 0.81, 0.80, 0.80 in 5.7.44
      • relative QPS is 0.60, 0.61, 0.61 in 8.0.36

No comments:

Post a Comment