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

[VM][Code cache v2] Some improvements in code cache #15537

Merged
merged 4 commits into from
Dec 11, 2024

Conversation

ziaptos
Copy link
Contributor

@ziaptos ziaptos commented Dec 7, 2024

Some small code optimizations (weaker lock in to avoid readers to wait)

How Has This Been Tested?

Existing tests

Key Areas to Review

Type of Change

  • New feature
  • Bug fix
  • Breaking change
  • Performance improvement
  • Refactoring
  • Dependency update
  • Documentation update
  • Tests

Which Components or Systems Does This Change Impact?

  • Validator Node
  • Full Node (API, Indexer, etc.)
  • Move/Aptos Virtual Machine
  • Aptos Framework
  • Aptos CLI/SDK
  • Developer Infrastructure
  • Move Compiler
  • Other (specify)

Checklist

  • I have read and followed the CONTRIBUTING doc
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I identified and added all stakeholders and component owners affected by this change as reviewers
  • I tested both happy and unhappy path of the functionality
  • I have made corresponding changes to the documentation

@ziaptos ziaptos requested a review from gelash December 7, 2024 20:54
Copy link

trunk-io bot commented Dec 7, 2024

⏱️ 5h 52m total CI duration on this PR
Slowest 15 Jobs Cumulative Duration Recent Runs
execution-performance / single-node-performance 3h 57m 🟩🟩🟩🟩🟩
execution-performance / test-target-determinator 22m 🟩🟩🟩🟩🟩
rust-move-tests 13m 🟩
rust-move-tests 13m 🟩
rust-move-tests 12m 🟩
rust-move-tests 12m 🟩
check-dynamic-deps 10m 🟩🟩🟩🟩🟩 (+2 more)
test-target-determinator 9m 🟩🟩
rust-cargo-deny 7m 🟩🟩🟩🟩
rust-doc-tests 5m 🟩
check 4m 🟩
semgrep/ci 3m 🟩🟩🟩🟩🟩 (+2 more)
general-lints 2m 🟩🟩🟩🟩
fetch-last-released-docker-image-tag 1m 🟩
file_change_determinator 1m 🟩🟩🟩🟩 (+1 more)

🚨 2 jobs on the last run were significantly faster/slower than expected

Job Duration vs 7d avg Delta
execution-performance / single-node-performance 49m 16m +210%
check-dynamic-deps 3m 1m +99%

settingsfeedbackdocs ⋅ learn more about trunk.io


if prev_idx.is_some() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this as it can never happen - the Some(idx) case is dealt with under the same write lock!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is more of a paranoid check, but yes, tis is unreachable so removing should be ok

@georgemitenkov georgemitenkov added CICD:run-execution-performance-test Run execution performance test CICD:run-execution-performance-full-test Run execution performance test (full version) labels Dec 9, 2024
module: module_id,
name: struct_name.to_owned(),
})?);
};
struct_names.push(struct_name_index_map.struct_name_to_idx(&struct_name)?);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems a bit wasteful passing by ref here, but I guess we do not expect miss es to happen often in any case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By reference should actually be more efficient, but compiler optimizations would probably make them the same, or similar.

let idx = index_map.backward_map.len();
let prev_idx = index_map.forward_map.insert(struct_name.clone(), idx);
index_map.backward_map.push(Arc::new(struct_name));
// Possibly need to insert, so make the copies outside of the lock
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: . in the end of a sentence?

) -> PartialVMResult<&'a Arc<StructIdentifier>> {
index_map.backward_map.get(idx.0).ok_or_else(|| {
let msg = format!(
"Index out of bounds when accessing struct name reference \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some of hthe other messages were "when constructing a struct tag" and "when accessing struct name at index". Not sure if we should support custom error messages for use-cases, it's beautiful with the helper - but maybe we can make the error message more generic.

@ziaptos ziaptos enabled auto-merge (squash) December 11, 2024 19:58

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

Copy link
Contributor

✅ Forge suite realistic_env_max_load success on 75a1fb1f6a2560fa13d37f44e09b888f675c378d

two traffics test: inner traffic : committed: 14678.12 txn/s, latency: 2704.79 ms, (p50: 2700 ms, p70: 2700, p90: 3000 ms, p99: 3300 ms), latency samples: 5581020
two traffics test : committed: 99.98 txn/s, latency: 1452.78 ms, (p50: 1400 ms, p70: 1500, p90: 1600 ms, p99: 2000 ms), latency samples: 1700
Latency breakdown for phase 0: ["MempoolToBlockCreation: max: 1.572, avg: 1.486", "ConsensusProposalToOrdered: max: 0.324, avg: 0.292", "ConsensusOrderedToCommit: max: 0.376, avg: 0.363", "ConsensusProposalToCommit: max: 0.663, avg: 0.655"]
Max non-epoch-change gap was: 0 rounds at version 0 (avg 0.00) [limit 4], 0.72s no progress at version 16549 (avg 0.20s) [limit 15].
Max epoch-change gap was: 0 rounds at version 0 (avg 0.00) [limit 4], 0.69s no progress at version 2875236 (avg 0.69s) [limit 16].
Test Ok

Copy link
Contributor

✅ Forge suite compat success on 3c6e693a27339e73520f41030dce8fc9cd504967 ==> 75a1fb1f6a2560fa13d37f44e09b888f675c378d

Compatibility test results for 3c6e693a27339e73520f41030dce8fc9cd504967 ==> 75a1fb1f6a2560fa13d37f44e09b888f675c378d (PR)
1. Check liveness of validators at old version: 3c6e693a27339e73520f41030dce8fc9cd504967
compatibility::simple-validator-upgrade::liveness-check : committed: 17295.35 txn/s, latency: 1968.67 ms, (p50: 2100 ms, p70: 2100, p90: 2200 ms, p99: 2400 ms), latency samples: 555500
2. Upgrading first Validator to new version: 75a1fb1f6a2560fa13d37f44e09b888f675c378d
compatibility::simple-validator-upgrade::single-validator-upgrading : committed: 7062.73 txn/s, latency: 4018.54 ms, (p50: 4500 ms, p70: 4900, p90: 5100 ms, p99: 5300 ms), latency samples: 130960
compatibility::simple-validator-upgrade::single-validator-upgrade : committed: 7348.26 txn/s, latency: 4503.16 ms, (p50: 4800 ms, p70: 4900, p90: 5100 ms, p99: 5300 ms), latency samples: 242860
3. Upgrading rest of first batch to new version: 75a1fb1f6a2560fa13d37f44e09b888f675c378d
compatibility::simple-validator-upgrade::half-validator-upgrading : committed: 7313.46 txn/s, latency: 3840.32 ms, (p50: 4300 ms, p70: 4600, p90: 4800 ms, p99: 4800 ms), latency samples: 133100
compatibility::simple-validator-upgrade::half-validator-upgrade : committed: 7404.31 txn/s, latency: 4403.85 ms, (p50: 4700 ms, p70: 4900, p90: 5000 ms, p99: 5300 ms), latency samples: 248020
4. upgrading second batch to new version: 75a1fb1f6a2560fa13d37f44e09b888f675c378d
compatibility::simple-validator-upgrade::rest-validator-upgrading : committed: 3558.62 txn/s, latency: 7979.69 ms, (p50: 10200 ms, p70: 10800, p90: 13200 ms, p99: 13500 ms), latency samples: 61360
compatibility::simple-validator-upgrade::rest-validator-upgrade : committed: 11063.47 txn/s, latency: 2833.66 ms, (p50: 2700 ms, p70: 3300, p90: 3500 ms, p99: 3700 ms), latency samples: 371660
5. check swarm health
Compatibility test for 3c6e693a27339e73520f41030dce8fc9cd504967 ==> 75a1fb1f6a2560fa13d37f44e09b888f675c378d passed
Test Ok

Copy link
Contributor

✅ Forge suite framework_upgrade success on 3c6e693a27339e73520f41030dce8fc9cd504967 ==> 75a1fb1f6a2560fa13d37f44e09b888f675c378d

Compatibility test results for 3c6e693a27339e73520f41030dce8fc9cd504967 ==> 75a1fb1f6a2560fa13d37f44e09b888f675c378d (PR)
Upgrade the nodes to version: 75a1fb1f6a2560fa13d37f44e09b888f675c378d
framework_upgrade::framework-upgrade::full-framework-upgrade : committed: 1422.95 txn/s, submitted: 1426.49 txn/s, failed submission: 3.54 txn/s, expired: 3.54 txn/s, latency: 2083.69 ms, (p50: 2100 ms, p70: 2300, p90: 2700 ms, p99: 3600 ms), latency samples: 128700
framework_upgrade::framework-upgrade::full-framework-upgrade : committed: 1376.72 txn/s, submitted: 1379.21 txn/s, failed submission: 2.49 txn/s, expired: 2.49 txn/s, latency: 2205.52 ms, (p50: 2100 ms, p70: 2400, p90: 3300 ms, p99: 5400 ms), latency samples: 121780
5. check swarm health
Compatibility test for 3c6e693a27339e73520f41030dce8fc9cd504967 ==> 75a1fb1f6a2560fa13d37f44e09b888f675c378d passed
Upgrade the remaining nodes to version: 75a1fb1f6a2560fa13d37f44e09b888f675c378d
framework_upgrade::framework-upgrade::full-framework-upgrade : committed: 522.95 txn/s, submitted: 523.84 txn/s, failed submission: 0.90 txn/s, expired: 0.90 txn/s, latency: 6526.85 ms, (p50: 7000 ms, p70: 7800, p90: 8700 ms, p99: 10200 ms), latency samples: 46660
Test Ok

@ziaptos ziaptos merged commit 1dab352 into main Dec 11, 2024
64 of 89 checks passed
@ziaptos ziaptos deleted the zi/small-code-cache-refactor branch December 11, 2024 20:54
georgemitenkov pushed a commit that referenced this pull request Jan 6, 2025
* some improvements in code cache

* more refactoring

* fixed comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CICD:run-execution-performance-full-test Run execution performance test (full version) CICD:run-execution-performance-test Run execution performance test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants