Monday, January 1, 2024

Updated Insert benchmark: InnoDB, MySQL 5.6 to 8.0, medium server, cached database

This has results for the Insert Benchmark using InnoDB from MySQL 5.6 to 8.0, a medium server and a cached workload. 

tl;dr

  • There are more performance regressions in 8.0 than in 5.7
  • The largest regression from 5.7 to 8.0 occurs for point queries (qp100, qp500, qp1000)
  • Context matters. Over time MySQL has added code that often make high concurrency workloads faster (because less mutex contention) but the new code makes low concurrency workloads slower (because new CPU overheads). The result here is from a medium server with medium concurrency. In some cases the changes help (write heavy), in others they hurt (read heavy).
Relative to MySQL 5.6.21
  • For the initial load (l.i0) 
    • throughput drops by ~5% in 5.7.44
    • throughput drops by ~15% in 8.0.35
  • For random writes (l.i1, l.i2) 
    • throughput grows by (1.4X, 2.0X) in 5.7.44
    • throughput grows by (1.1X, 1.9X) in 8.0.35
  • For range queries (qr100, qr500, qr1000)
    • throughput drops by 10% to 14% in 5.7.44
    • throughput drops by 14% to 19% in 8.0.35
  • For point queries (qp100, qp500, qp1000)
    • throughput drops by ~10% in 5.7.44
    • throughput drops by ~30% in 8.0.35

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 and used 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_gcp_c2s30 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.6, 5.7.7, 5.7.8, 5.7.9, 5.7.10, 5.7.11, 5.7.20, 5.7.30, 5.7.43. Note that 5.7.6 through 5.7.9 are pre-GA.
  • 8.0
    • 8.0.13, 8.0.14, 8.0.20, 8.0.28, 8.0.30 to 8.0.35
For 8.0.35 I tested a few variations from what is described above
  • my8035_rel.cz10aps0_gcp_c2s30
    • this uses my.cnf.cz10aps0_gcp_c2s30 which is the same as my.cnf.cz10a_gcp_c2s30 except it adds performance_schema =0.
  • my8035_rel_lessps.cz10a_gcp_c2s30
    • the build disables as much as possible of the performance schema. The CMake file is here.
Benchmark

The test server is a c2-standard-30 from GCP with 15 cores, hyperthreads disabled, 128G of RAM, Ubuntu 22.04 and XFS on SW RAID 0 over 4 local SSD. The benchmark is run with 8 clients to avoid over-subscribing the CPU.

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

  • l.i0
    • insert 20 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 1200 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
Results

The performance reports are here for MySQL 5.6, MySQL 5.7, MySQL 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
From the summary for 5.6
  • The base case is 5.6.21
  • Write throughput increases by ~1.5X after 5.6.21. Otherwise performance is similar across versions.
From the summary for 5.7
  • The base case is 5.7.6 but that is pre-GA so I focus on changes from 5.7.10 to 5.7.43
  • From the GA versions (5.7.10 to 5.7.43) performance is similar across versions.
From the summary for 8.0
  • The base case is 8.0.13
  • I ignore the 8.0.35 variations (cz10aps0_gcp_c2s30 config, rel_lessps build) for now
  • l.i0 - relative QPS is 0.94 in 8.0.35
  • l.x (create index) - I ignore this for now but but read this to learn how to make it faster
  • l.i1, l.i2 - relative QPS is 1.06 and 1.00 in 8.0.35
  • qr100, qr500, qr1000 - relative QPS is 1.01, 1.02 and 1.02 in 8.0.35
  • qp100, qp500, qp1000 - relative QPS is 0.91, 0.91 and 0.92 in 8.0.35
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 ~5% better
  • Throughput for read-heavy steps (qr*, qp*) is ~8% better 
From the summary for 5.6, 5.7, 8.0
  • The base case is 5.6.21
  • l.i0
    • relative QPS is 0.95 in 5.7.43
    • relative QPS is 0.84 in 8.0.35
  • l.x - I ignore this for now
  • l.i1, l.i2
    • relative QPS is 1.35, 2.04 in 5.7.43
    • relative QPS is 1.12, 1.94 in 8.0.35
  • qr100, qr500, qr1000
    • relative QPS is 0.90, 0.87, 0.86 in 5.7.43
    • relative QPS is 0.86, 0.83, 0.81 in 8.0.35
  • qp100, qp500, qp1000
    • relative QPS is 0.91, 0.90, 0.89 in 5.7.43
    • relative QPS is 0.71, 0.71, 0.70 in 8.0.35

No comments:

Post a Comment

RocksDB on a big server: LRU vs hyperclock, v2

This post show that RocksDB has gotten much faster over time for the read-heavy benchmarks that I use. I recently shared results from a lar...