Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-11105

Make a version of WT_SESSION::begin_transaction that takes a struct instead of config string

    • Storage Engines
    • StorEng - Defined Pipeline
    • Not Needed

      Create a new API on WT_SESSION that takes a struct of configuration options instead of a config string. Majority of the time in begin_transaction in a read-only workload is spent in config_check and __wt_txn_config. By passing a struct of options, we can eliminate this string parsing time.

      On YCSB, there was a ~9% improvement in 100 read. See https://spruce.mongodb.com/version/6466bd2056234346b7ac572e/tasks?sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC

      Expect outcome:

      A similar improvement in performance of begin_transaction as the POC below:

      Baseline:

      2023-05-19T10:14:11-04:00
      Running build/install/bin/storage_wiredtiger_begin_transaction_block_bm
      Run on (16 X 3200 MHz CPU s)
      CPU Caches:
        L1 Data 32 KiB (x16)
        L1 Instruction 32 KiB (x16)
        L2 Unified 256 KiB (x16)
        L3 Unified 20480 KiB (x2)
      Load Average: 1.12, 0.50, 0.19
      ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      Benchmark                                                                                                                              Time             CPU   Iterations
      ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      BM_WiredTigerBeginTxnBlock                                                                                                           191 ns          191 ns      3491532
      BM_WiredTigerBeginTxnBlockWithArgs<PrepareConflictBehavior::kEnforce, RoundUpPreparedTimestamps::kNoRound>                           381 ns          380 ns      1811775
      BM_WiredTigerBeginTxnBlockWithArgs<PrepareConflictBehavior::kEnforce, RoundUpPreparedTimestamps::kRound>                            1575 ns         1572 ns       439001
      BM_WiredTigerBeginTxnBlockWithArgs<PrepareConflictBehavior::kIgnoreConflicts, RoundUpPreparedTimestamps::kNoRound>                  1138 ns         1136 ns       614137
      BM_WiredTigerBeginTxnBlockWithArgs<PrepareConflictBehavior::kIgnoreConflicts, RoundUpPreparedTimestamps::kRound>                    2782 ns         2777 ns       248564
      BM_WiredTigerBeginTxnBlockWithArgs<PrepareConflictBehavior::kIgnoreConflictsAllowWrites, RoundUpPreparedTimestamps::kNoRound>       1119 ns         1116 ns       604495
      BM_WiredTigerBeginTxnBlockWithArgs<PrepareConflictBehavior::kIgnoreConflictsAllowWrites, RoundUpPreparedTimestamps::kRound>         2768 ns         2764 ns       251661
      BM_setTimestamp                                                                                                                      255 ns          255 ns      2648494
      

      Begin_transaction with Struct:

       2023-05-19T10:12:03-04:00
      Running build/install/bin/storage_wiredtiger_begin_transaction_block_bm
      Run on (16 X 3200 MHz CPU s)
      CPU Caches:
        L1 Data 32 KiB (x16)
        L1 Instruction 32 KiB (x16)
        L2 Unified 256 KiB (x16)
        L3 Unified 20480 KiB (x2)
      Load Average: 1.50, 0.33, 0.10
      ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      Benchmark                                                                                                                              Time             CPU   Iterations
      ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      BM_WiredTigerBeginTxnBlock                                                                                                           203 ns          202 ns      3449411
      BM_WiredTigerBeginTxnBlockWithArgs<PrepareConflictBehavior::kEnforce, RoundUpPreparedTimestamps::kNoRound>                           151 ns          150 ns      4170429
      BM_WiredTigerBeginTxnBlockWithArgs<PrepareConflictBehavior::kEnforce, RoundUpPreparedTimestamps::kRound>                             166 ns          165 ns      4219049
      BM_WiredTigerBeginTxnBlockWithArgs<PrepareConflictBehavior::kIgnoreConflicts, RoundUpPreparedTimestamps::kNoRound>                   166 ns          166 ns      4239556
      BM_WiredTigerBeginTxnBlockWithArgs<PrepareConflictBehavior::kIgnoreConflicts, RoundUpPreparedTimestamps::kRound>                     157 ns          157 ns      4175509
      BM_WiredTigerBeginTxnBlockWithArgs<PrepareConflictBehavior::kIgnoreConflictsAllowWrites, RoundUpPreparedTimestamps::kNoRound>        167 ns          167 ns      4150116
      BM_WiredTigerBeginTxnBlockWithArgs<PrepareConflictBehavior::kIgnoreConflictsAllowWrites, RoundUpPreparedTimestamps::kRound>          166 ns          166 ns      4159999
      BM_setTimestamp                                                                                                                      274 ns          273 ns      2612318
      

      * The reproducing steps, and

      • Links to other relevant tickets/resources.

      POC:
      https://github.com/mongodb/mongo/compare/master...markbenvenuto:mongo:begin_txn_fast?expand=1

      YCSB Per analysis

      https://performance-analyzer.server-tig.prod.corp.mongodb.com/perf-analyzer-viz/?comparison_id=2c87ab6e-2b87-409c-ad41-7a67161d9618&percent_filter=0%7C%7C100&z_filter=0%7C%7C10

            Assignee:
            donald.anderson@mongodb.com Donald Anderson
            Reporter:
            mark.benvenuto@mongodb.com Mark Benvenuto
            Votes:
            0 Vote for this issue
            Watchers:
            20 Start watching this issue

              Created:
              Updated:
              Resolved: