Skip to content

Conversation

fyrsta7
Copy link

@fyrsta7 fyrsta7 commented Sep 12, 2025

Summary

This PR optimizes the performance of the function TwoLevelIterator::Seek in table/two_level_iterator.cc.
Performance was measured using the project's standard benchmark tools. Out of 22 test cases, the optimization achieves a maximum improvement of 68.56% while guaranteeing no regression exceeds 1.56% in any other case.

Test Plan

  1. Correctness: All existing unit tests pass.
  2. Performance: A comprehensive performance evaluation was conducted using the built-in db_bench tool. The automated script covers several key aspects of database performance, ensuring no regressions and evaluating the impact of the changes under various workloads. The specific benchmarks executed include:
    1. Core Read/Write Operations
    2. Concurrency and Database Management
    3. Configuration Impact: Compared random write performance with different value sizes (100 bytes vs. 1KB) to understand the impact on throughput.

Performance Evaluation & Results

Testing Protocol:

  • The benchmark was run on an isolated Ubuntu 24.04 server.
  • The first run was discarded to account for cold-start effects.
  • The results below are the average of 5 subsequent runs.
  • The improvement for a test case is calculated as (new_value - old_value) / old_value * 100% if a higher value is better (e.g., throughput), or (old_value - new_value) / new_value * 100% if a lower value is better (e.g., latency). A positive percentage indicates a performance gain.

Results:

Test Case Improvement
section_1_core_read_write.1_2_fillrandom.throughput_mb_s -0.23%
section_1_core_read_write.1_6_overwrite.throughput_mb_s 0.12%
section_1_core_read_write.1_3_readseq.throughput_mb_s 0.92%
section_1_core_read_write.1_1_fillseq.throughput_mb_s -0.26%
section_1_core_read_write.1_6_fillrandom.throughput_mb_s 0.42%
section_1_core_read_write.1_2_fillrandom.micros_per_op -0.31%
section_1_core_read_write.1_6_overwrite.micros_per_op 0.13%
section_1_core_read_write.1_4_readrandom.micros_per_op -0.46%
section_1_core_read_write.1_5_seekrandom.micros_per_op 68.56%
section_1_core_read_write.1_3_readseq.micros_per_op 0.96%
section_1_core_read_write.1_1_fillseq.micros_per_op -0.38%
section_1_core_read_write.1_6_fillrandom.micros_per_op 0.42%
section_2_concurrent_compression.2_2_fillrandom.micros_per_op 1.67%
section_2_concurrent_compression.2_1_readwhilewriting.micros_per_op 5.54%
section_2_concurrent_compression.2_2_compact.micros_per_op 1.30%
section_2_concurrent_compression.2_3_fillsync.micros_per_op -1.56%
section_2_concurrent_compression.2_2_fillrandom.throughput_mb_s 1.71%
section_2_concurrent_compression.2_3_fillsync.throughput_mb_s 0.00%
section_3_config_comparison.3_1_fillrandom_small.micros_per_op 0.38%
section_3_config_comparison.3_2_fillrandom_medium.micros_per_op -0.20%
section_3_config_comparison.3_1_fillrandom_small.throughput_mb_s 0.35%
section_3_config_comparison.3_2_fillrandom_medium.throughput_mb_s -0.23%

@fyrsta7
Copy link
Author

fyrsta7 commented Sep 21, 2025

Could a maintainer please approve the workflow to run? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant