-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kvcoord: always start TxnCoordSender heartbeat loop
Previously, potential 1PC transactions (containing an `EndTxn` in the same batch as writes) did not start the `TxnCoordSender` heartbeat loop, and thus never wrote a transaction record. This was a performance optimization to avoid checking for an existing record during write evaluation. However, it could cause problems under heavy contention where such transactions would abort each other as they did not heartbeat their transaction record and thus would become invalid once the txn timeout expired. This would apply even to transactions that turned out to not use 1PC due to spanning multiple ranges, and thus are more vulnerable to contention. Running some benchmarks showed that this optimization in fact did not have a detectable effect on performance (new always heartbeats): ``` name old ops/sec new ops/sec delta kv0/enc=false/nodes=1/cpu=32 24.5k ± 8% 24.7k ± 3% ~ (p=0.796 n=9+9) kv0/enc=false/nodes=3/cpu=32 36.7k ± 4% 36.5k ± 4% ~ (p=0.529 n=10+10) kv95/enc=false/nodes=3/cpu=32 124k ± 7% 131k ± 2% +5.56% (p=0.002 n=10+8) ycsb/A/nodes=3/cpu=32 27.7k ± 4% 28.1k ± 4% ~ (p=0.315 n=9+10) name old p50 new p50 delta kv0/enc=false/nodes=1/cpu=32 2.50 ± 0% 2.50 ± 0% ~ (all equal) kv0/enc=false/nodes=3/cpu=32 4.70 ± 0% 4.70 ± 0% ~ (all equal) kv95/enc=false/nodes=3/cpu=32 1.00 ± 0% 1.00 ± 0% ~ (all equal) ycsb/A/nodes=3/cpu=32 2.44 ± 2% 2.45 ± 2% ~ (p=1.000 n=10+10) name old p95 new p95 delta kv0/enc=false/nodes=1/cpu=32 4.79 ± 9% 4.70 ± 0% ~ (p=0.350 n=9+7) kv0/enc=false/nodes=3/cpu=32 10.7 ± 3% 10.8 ± 7% ~ (p=1.000 n=10+10) kv95/enc=false/nodes=3/cpu=32 5.02 ±10% 4.70 ± 0% -6.37% (p=0.003 n=10+8) ycsb/A/nodes=3/cpu=32 9.10 ± 8% 9.20 ± 3% ~ (p=0.720 n=10+10) name old p99 new p99 delta kv0/enc=false/nodes=1/cpu=32 6.90 ±10% 6.87 ± 6% ~ (p=1.000 n=9+9) kv0/enc=false/nodes=3/cpu=32 14.4 ± 9% 14.4 ± 6% ~ (p=0.707 n=10+9) kv95/enc=false/nodes=3/cpu=32 9.79 ± 7% 9.21 ± 3% -5.90% (p=0.015 n=10+8) ycsb/A/nodes=3/cpu=32 78.0 ± 9% 75.5 ± 6% ~ (p=0.305 n=10+10) ``` This patch therefore always starts the heartbeat loop for all transactions. The txn record will only be written after about 1 second, and only if the txn is still alive at that time, so in the typical 1PC case it will never be written anyway. The `EndTxn.TxnHeartbeating` field is retained for compatibility with v21.1 nodes, otherwise these nodes would never check for txn records when evaluating possible 1PC writes. Release note: None
- Loading branch information
1 parent
960d7d3
commit f7ded0b
Showing
6 changed files
with
24 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters