Skip to content

Understanding the Parallel Import Mechanism in MySqlBackup.NET v2.6.2

adriancs edited this page Jul 12, 2025 · 6 revisions

Understanding the Parallel Import Mechanism in MySqlBackup.NET v2.6.2

Date: July 12th, 2025

Tip: From a human perspective, there's virtually no noticeable performance difference between the different import methods.

Note: Start from v2.6,2, MySqlBackup.NET is running import in parallel mode by default.

using (var conn = new MySqlConnection(constr))
using (var cmd = conn.CreateCommand())
using (var mb = new MySqlBackup(cmd))
{
    conn.Open();

    // enabled by default in 2.6, turn off this to run in legacy single thread
    mb.ImportInfo.EnableParallelProcessing = true;
    mb.ImportFromFile(@"C:\backup.sql");
}

Here's the illustration diagram:

MySqlBackup.NET v2.6.2 Import Single Thread


MySqlBackup.NET v2.6.2 Import Parallel Processing

Benchmark

Method Batch Test 1 Batch Test 2 Average
MySqlBackup.NET
Import Single Thread
66s 162ms
69s 610ms
70s 153ms
66s 387ms
70s 188ms
70s 137ms
68s 773ms
MySqlBackup.NET
Import Parallel
64s 063ms
64s 094ms
64s 469ms
65s 469ms
66s 141ms
65s 844ms
65s 013ms
mysql.exe 64s 625ms
62s 619ms
63s 016ms
66s 922ms
64s 516ms
64s 655ms
64s 392ms
Date Report              : July 12th, 2025
MySQL Community Server   : 8.4.5
InnoDB Tables            : 5
Total Rows               : 685,000 rows
Database Size            : 680 MB
SQL Dump Size            : 978 MB (1.02 GB)
Server Throughput        : 15.19 MB/sec, 10,637 rows/sec

Performance Results

mysql.exe                : 64.4s
MySqlBackup.NET Parallel : 65.0s (+0.9%)
MySqlBackup.NET Standard : 68.8s (+6.8%)

While the benchmarking results show measurable differences between the three import methods, these variations are not significant enough to constitute meaningful performance improvements in real-world application contexts. The entire import process has already reached the bottleneck at the MySQL server level, which consumes approximately 95% of the total execution time processing large batches of rows. The marginal performance differences demonstrate that MySqlBackup.NET has already achieved optimal performance characteristics, making further optimization of the import process essentially meaningless since the constraint lies in the database server's inherent processing capabilities rather than the client-side import library implementation.

Clone this wiki locally