Skip to content

Concurrency Benchmark Results

Caleb Lloyd edited this page May 7, 2017 · 3 revisions

Test Information

Description Value
Date May 6, 2017
Methodology Run 3 iterations of each test and take the fastest time. Max Pool Size=1000
Hardware Intel i5-6600K (4 cores), 32GB RAM
Framework .NET Core 1.1.1, Ubuntu 17.04 x64
MySQL Version 5.7.18
Test Script Commit e18175f3
Pomelo.EntityFrameworkCore.MySql Version 1.1.2
SapientGuardian.EntityFrameworkCore.MySql Version 7.1.23

Note: Could not get MySql.Data.EntityFrameworkCore 7.0.7-m61 to work with tests. Hit exceptions when trying to run tests. It has been omitted from the results.

Results

All test values are in Seconds.

  10 Concurrent Connections 100 Concurrent Connections 1000 Concurrent Connections
Pomelo Sapient Speedup Pomelo Sapient Speedup Pomelo Sapient Speedup
1x Insert 0.015 0.085 469.25% 0.09 0.82 797.80% 0.46 8.22 1675.95%
10x Insert 0.166 0.759 357.17% 0.50 7.44 1386.84% 2.40 78.04 3149.25%
100x Insert 1.977 7.928 301.09% 3.20 70.62 2105.84% 25.94 770.50 2870.49%
1x Select 0.005 0.005 0.35% 0.05 0.05 -4.80% 0.43 0.49 14.26%
10x Select 0.041 0.046 10.30% 0.19 0.23 22.18% 1.68 2.39 42.57%
100x Select 0.281 0.266 -5.47% 2.40 3.96 64.92% 19.69 27.90 41.68%
1x Sleep 0.006 0.017 201.49% 0.03 0.23 663.83% 0.23 2.49 974.90%
10x Sleep 0.046 0.214 366.85% 0.16 2.37 1414.69% 1.24 18.83 1422.89%
100x Sleep 0.385 2.311 499.64% 1.27 18.31 1344.41% 15.09 234.60 1454.89%

Discussion

Pomelo.EntityFrameworkCore.MySql uses the MySqlConnector driver, which implements real asynchronous I/O.

SapientGuardian.EntityFrameworkCore.MySql uses the SapientGuardian.MySql.Data driver, which is a fork of the official MySql.Data connector and maps asynchronous functions to synchronous I/O.

The benefit of real async I/O can be seen when concurrency is high and when MySql takes time to process results. For example, the Sleep test executes a 1ms SLEEP command on the MySQL server. Pomelo is able to use a low number of threads to issue 1000 concurrent commands. Sapient would need to use 1000 threads to issue all 1000 commands at once, or use a fixed size thread pool.

For the Select test, MySQL is very quick to respond since it is just selecting the first record and has likely cached the result. This results in a less noticeable difference between the two libraries because Sapient's synchronous threads do not spend much time waiting for a result.

A properly programmed Asynchronous application using Pomelo.EntityFrameworkCore.MySql will be able to handle much more concurrency, especially when complex queries that can take 1ms or more to execute are used.

Clone this wiki locally