You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Appendix.md
+11-8Lines changed: 11 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -203,7 +203,7 @@ Profile-Guided Optimization (PGO) is a compiler technique that uses profiling da
203
203
204
204
**24 Read Committed Isolation Level**
205
205
206
-
Put simply, the Read Committed isolation level ensures that any data read during a transaction is committed at the time of reading. It prevents the reader from seeing uncommitted or 'dirty' data. However, it doesn¡¯t guarantee that if the transaction reads the same data again, it will be the same; the data can change after being read.
206
+
Put simply, the Read Committed isolation level ensures that any data read during a transaction is committed at the time of reading. It prevents the reader from seeing uncommitted or 'dirty' data. However, it doesn't guarantee that if the transaction reads the same data again, it will be the same; the data can change after being read.
207
207
208
208
**25 Replication**
209
209
@@ -285,7 +285,7 @@ MySQL uses the classic request-response model: clients send SQL queries to the M
285
285
286
286

287
287
288
-
Here¡¯s how MySQL Server processes a SQL request with a detailed example. Suppose a user sends the following SQL statement from a MySQL client to MySQL Server:
288
+
Here's how MySQL Server processes a SQL request with a detailed example. Suppose a user sends the following SQL statement from a MySQL client to MySQL Server:
289
289
290
290
```
291
291
select name from student where id=1;
@@ -369,14 +369,17 @@ The execution plan for this SQL query can be viewed using the *'explain'* statem
369
369
370
370
The execution process with an index is as follows:
371
371
372
-
1. The executor requests the storage engine to locate the first index record matching the query condition (e.g., name LIKE 'wang%').
373
-
2. The storage engine retrieves and returns the matching index record to the Server layer.
374
-
3. The executor checks if the record meets the additional query conditions (e.g., id \< 3).
372
+
1. The executor requests the storage engine to locate the first index record matching the query condition (e.g., name LIKE 'wang%').
375
373
376
-
If conditions are met, the corresponding name is added to the network buffer, unless it is full. If conditions are not met, the executor skips the record and requests the next one from the storage engine.
374
+
2. The storage engine retrieves and returns the matching index record to the Server layer.
377
375
378
-
4. This cycle continues as the executor repeatedly requests and evaluates the next index record that matches the query condition until all relevant index records are processed.
379
-
5. Once the storage engine indicates that all relevant index records have been processed, the executor exits the loop and sends the collected results to the client.
376
+
3. The executor checks if the record meets the additional query conditions (e.g., id \< 3).
377
+
378
+
If conditions are met, the corresponding name is added to the network buffer, unless it is full. If conditions are not met, the executor skips the record and requests the next one from the storage engine.
379
+
380
+
4. This cycle continues as the executor repeatedly requests and evaluates the next index record that matches the query condition until all relevant index records are processed.
381
+
382
+
5. Once the storage engine indicates that all relevant index records have been processed, the executor exits the loop and sends the collected results to the client.
380
383
381
384
Using an index allows the storage engine to quickly locate necessary records, bypassing the need to scan the entire table. In general, this significantly improves execution efficiency and speeds up the query.
Copy file name to clipboardExpand all lines: Chapter1.md
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -14,13 +14,13 @@ Here are some classic problems listed, along with typical resolutions in real-wo
14
14
15
15
The following figure illustrates the relationship between TPC-C throughput and concurrency in MySQL 5.7.39 under a specific configuration. This includes setting the transaction isolation level to Read Committed and adjusting the *innodb_spin_wait_delay* parameter to mitigate throughput degradation.
Figure 1-1. Scalability problems in MySQL 5.7.39 during BenchmarkSQL testing.
20
20
21
21
From the figure, it is evident that scalability problems significantly limit the increase in MySQL throughput. For example, after 100 concurrency, the throughput begins to decline. Due to MySQL's historical scalability challenges, Percona even open-sourced a thread pool to address these problems. The following figure illustrates the relationship between TPC-C throughput and concurrency after configuring the Percona thread pool.
Figure 1-2. Percona thread pool mitigates scalability problems in MySQL 5.7.39.
26
26
@@ -62,7 +62,7 @@ Meta's case study demonstrates that the new solution based on the Raft protocol
62
62
63
63
With the transaction isolation level set to Read Committed, simulations based on Group Replication were conducted under various network latency conditions.
64
64
65
-
The deployment setup of Group Replication is illustrated as follows: On machine A, two MySQL instances are deployed¡ªone serving as the primary and the other as the secondary. These two instances form the majority and communicate via localhost. Machine B hosts a third instance deployed as a member of the cluster, with a network latency of X milliseconds.
65
+
The deployment setup of Group Replication is illustrated as follows: On machine A, two MySQL instances are deployed—one serving as the primary and the other as the secondary. These two instances form the majority and communicate via localhost. Machine B hosts a third instance deployed as a member of the cluster, with a network latency of X milliseconds.
66
66
67
67

68
68
@@ -72,15 +72,15 @@ In theory, with a majority-based mechanism, a cluster of 3 nodes only needs resp
72
72
73
73
Throughput comparisons over time have been conducted for machine B in scenarios within the same data center and across data centers with latencies of 10ms, 100ms, and 1000ms. Specific results are illustrated in the following figure.
Figure 1-7. Performance testing results of the default multi-leader Paxos algorithm.
78
78
79
79
From the figure, it is evident that under the default mode of Group Replication, throughput across data centers deviates significantly from theoretical expectations. For example, in scenarios with 10ms network latency, the cluster's throughput decreases to one-fifth of its original level. To address this discrepancy, starting with MySQL 8.0.27, the *group_replication_paxos_single_leader* option was introduced. Enabling this option utilizes the single leader Paxos algorithm instead of the default multi-leader Paxos algorithm.
80
80
81
81
After configuring Group Replication to use the single leader Paxos algorithm, tests were conducted under the same conditions using the SysBench testing tool. The test results are as follows.
0 commit comments