Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

benchmark: TwoPC commit mode #17397

Merged
merged 2 commits into from
Dec 19, 2024
Merged

Conversation

harshit-gangal
Copy link
Member

@harshit-gangal harshit-gangal commented Dec 17, 2024

Description

This PR benchmarks two Commit Modes:

  1. Best Effort Commit (multi) – commits sequentially across shards.
  2. Atomic Commit (TwoPC) – ensures atomicity through a multi-step process with parallel phases.

The benchmarks measure performance across transactions involving varying numbers of shards.
Results are provided for 4, 8, and 16 shard configurations.

4 shards

                          │ multi_v4.txt │             twopc_v4.txt             │
                          │    sec/op    │    sec/op     vs base                │
TwoPCCommit/SingleShard-8    756.5µ ± 1%   764.6µ ±  2%         ~ (p=0.180 n=6)
TwoPCCommit/TwoShards-8      1.545m ± 4%   3.386m ±  4%  +119.08% (p=0.002 n=6)
TwoPCCommit/ThreeShards-8    2.393m ± 2%   4.877m ± 14%  +103.82% (p=0.002 n=6)
TwoPCCommit/FourShards-8     3.309m ± 4%   6.098m ±  6%   +84.29% (p=0.002 n=6)
geomean                      1.744m        2.962m         +69.82%

8 shards

                          │ multi_8shards.txt │          twopc_8shards.txt           │
                          │      sec/op       │    sec/op     vs base                │
TwoPCCommit/SingleShard-8        750.3µ ±  1%    754.0µ ± 1%         ~ (p=0.818 n=6)
TwoPCCommit/TwoShards-8          1.528m ±  8%    3.448m ± 4%  +125.63% (p=0.002 n=6)
TwoPCCommit/FourShards-8         3.269m ±  3%    6.149m ± 5%   +88.10% (p=0.002 n=6)
TwoPCCommit/SixShards-8          5.176m ±  6%    8.577m ± 7%   +65.71% (p=0.002 n=6)
TwoPCCommit/EightShards-8        7.140m ± 11%   10.968m ± 5%   +53.62% (p=0.002 n=6)
geomean                          2.681m          4.320m        +61.12%

16 shards

                            │ multi_16shards.txt │          twopc_16shards.txt          │
                            │       sec/op       │    sec/op      vs base               │
TwoPCCommit/EightShards-8           7.611m ±  6%   11.261m ± 11%  +47.97% (p=0.002 n=6)
TwoPCCommit/TwelveShard-8           12.19m ± 10%    17.21m ± 11%  +41.18% (p=0.002 n=6)
TwoPCCommit/SixteenShards-8         17.35m ± 15%    24.06m ± 10%  +38.69% (p=0.002 n=6)
geomean                             11.72m          16.71m        +42.56%

Summary

  • Best Effort Commit scales poorly as the number of shards increases due to its sequential execution of commits.
  • Atomic Commit (TwoPC) incurs higher overhead but offers atomicity guarantees. Its parallel phases help reduce the performance gap as the shard count grows.

Related Issue(s)

Checklist

  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on CI?
  • Documentation was added or is not required

Deployment Notes

Signed-off-by: Harshit Gangal <[email protected]>
Copy link
Contributor

vitess-bot bot commented Dec 17, 2024

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • Ensure there is a link to an issue (except for internal cleanup and flaky test fixes), new features should have an RFC that documents use cases and test cases.

Tests

  • Bug fixes should have at least one unit or end-to-end test, enhancement and new features should have a sufficient number of tests.

Documentation

  • Apply the release notes (needs details) label if users need to know about this change.
  • New features should be documented.
  • There should be some code comments as to why things are implemented the way they are.
  • There should be a comment at the top of each new or modified test to explain what the test does.

New flags

  • Is this flag really necessary?
  • Flag names must be clear and intuitive, use dashes (-), and have a clear help text.

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow needs to be marked as required, the maintainer team must be notified.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from vitess-operator and arewefastyet, if used there.
  • vtctl command output order should be stable and awk-able.

@vitess-bot vitess-bot bot added NeedsBackportReason If backport labels have been applied to a PR, a justification is required NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsWebsiteDocsUpdate What it says labels Dec 17, 2024
@github-actions github-actions bot added this to the v22.0.0 milestone Dec 17, 2024
@harshit-gangal harshit-gangal added Component: Query Serving Type: Testing and removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsWebsiteDocsUpdate What it says NeedsIssue A linked issue is missing for this Pull Request NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Dec 17, 2024
Copy link

codecov bot commented Dec 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.51%. Comparing base (45192d2) to head (70d90f5).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17397      +/-   ##
==========================================
- Coverage   67.52%   67.51%   -0.01%     
==========================================
  Files        1581     1581              
  Lines      253948   253945       -3     
==========================================
- Hits       171480   171456      -24     
- Misses      82468    82489      +21     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Harshit Gangal <[email protected]>
@harshit-gangal harshit-gangal marked this pull request as ready for review December 17, 2024 17:17
@harshit-gangal harshit-gangal merged commit 56b5c2a into vitessio:main Dec 19, 2024
101 checks passed
@harshit-gangal harshit-gangal deleted the bench-commit branch December 19, 2024 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFC: Atomic Distributed Transactions
3 participants