mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-27 23:47:28 +00:00
c4248078d6
* chore: update dependencies * build(deps): bump the dependencies group with 5 updates * build(deps): bump the dependencies group with 6 updates (#2908) Signed-off-by: houseme <housemecn@gmail.com> Co-authored-by: houseme <housemecn@gmail.com> * fix(ecstore): narrow Windows URL drive path rewrite * chore(deps): bump starshard to 1.2.0 * revert(ecstore): restore endpoint Windows path behavior * up * up * up * perf(notify): use cached snapshot mode for scans * fix * chore(deps): bump workspace dependency versions * chore(deps): refresh pinned dependency references * chore(ci): align profiling and decommission tooling updates - enable tokio_unstable cfg in performance profiling build flags\n- bump Rust base image from 1.93 to 1.95 in source and decommission Dockerfiles\n- remove obsolete compose version key from docker-compose-simple.yml\n- add standard Apache-2.0 license header to docker-compose.decommission.yml * chore(deps): bump the dependencies group across 1 directory with 7 updates (#2994) Bumps the dependencies group with 7 updates in the / directory: | Package | From | To | | --- | --- | --- | | [sysinfo](https://github.com/GuillaumeGomez/sysinfo) | `0.39.1` | `0.39.2` | | [dial9-tokio-telemetry](https://github.com/dial9-rs/dial9-tokio-telemetry) | `0.3.9` | `0.3.10` | | [opentelemetry](https://github.com/open-telemetry/opentelemetry-rust) | `0.31.0` | `0.32.0` | | [opentelemetry-otlp](https://github.com/open-telemetry/opentelemetry-rust) | `0.31.1` | `0.32.0` | | [opentelemetry_sdk](https://github.com/open-telemetry/opentelemetry-rust) | `0.31.0` | `0.32.0` | | [opentelemetry-semantic-conventions](https://github.com/open-telemetry/opentelemetry-rust) | `0.31.0` | `0.32.0` | | [opentelemetry-stdout](https://github.com/open-telemetry/opentelemetry-rust) | `0.31.0` | `0.32.0` | Updates `sysinfo` from 0.39.1 to 0.39.2 - [Changelog](https://github.com/GuillaumeGomez/sysinfo/blob/main/CHANGELOG.md) - [Commits](https://github.com/GuillaumeGomez/sysinfo/compare/v0.39.1...v0.39.2) Updates `dial9-tokio-telemetry` from 0.3.9 to 0.3.10 - [Release notes](https://github.com/dial9-rs/dial9-tokio-telemetry/releases) - [Changelog](https://github.com/dial9-rs/dial9/blob/main/CHANGELOG.md) - [Commits](https://github.com/dial9-rs/dial9-tokio-telemetry/compare/dial9-tokio-telemetry-v0.3.9...dial9-tokio-telemetry-v0.3.10) Updates `opentelemetry` from 0.31.0 to 0.32.0 - [Release notes](https://github.com/open-telemetry/opentelemetry-rust/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-rust/blob/main/docs/release_0.32.md) - [Commits](https://github.com/open-telemetry/opentelemetry-rust/compare/opentelemetry-prometheus-0.31.0...opentelemetry-0.32.0) Updates `opentelemetry-otlp` from 0.31.1 to 0.32.0 - [Release notes](https://github.com/open-telemetry/opentelemetry-rust/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-rust/blob/main/docs/release_0.32.md) - [Commits](https://github.com/open-telemetry/opentelemetry-rust/compare/opentelemetry-otlp-0.31.1...opentelemetry-otlp-0.32.0) Updates `opentelemetry_sdk` from 0.31.0 to 0.32.0 - [Release notes](https://github.com/open-telemetry/opentelemetry-rust/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-rust/blob/main/docs/release_0.32.md) - [Commits](https://github.com/open-telemetry/opentelemetry-rust/compare/v0.31.0...opentelemetry_sdk-0.32.0) Updates `opentelemetry-semantic-conventions` from 0.31.0 to 0.32.0 - [Release notes](https://github.com/open-telemetry/opentelemetry-rust/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-rust/blob/main/docs/release_0.32.md) - [Commits](https://github.com/open-telemetry/opentelemetry-rust/compare/v0.31.0...opentelemetry-semantic-conventions-0.32.0) Updates `opentelemetry-stdout` from 0.31.0 to 0.32.0 - [Release notes](https://github.com/open-telemetry/opentelemetry-rust/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-rust/blob/main/docs/release_0.32.md) - [Commits](https://github.com/open-telemetry/opentelemetry-rust/compare/v0.31.0...opentelemetry-stdout-0.32.0) --- updated-dependencies: - dependency-name: sysinfo dependency-version: 0.39.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: dial9-tokio-telemetry dependency-version: 0.3.10 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: opentelemetry dependency-version: 0.32.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: opentelemetry-otlp dependency-version: 0.32.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: opentelemetry_sdk dependency-version: 0.32.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: opentelemetry-semantic-conventions dependency-version: 0.32.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: opentelemetry-stdout dependency-version: 0.32.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: houseme <housemecn@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: houseme <housemecn@gmail.com> * chore(deps): bump workspace dependency versions * chore(deps): refresh lockfile windows crate graph * chore(bench): align snapshot mode labels with coverage * chore(bench): clarify tested snapshot modes * fix(review): address PR2890 Copilot comments --------- Signed-off-by: houseme <housemecn@gmail.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
63 lines
2.4 KiB
Rust
63 lines
2.4 KiB
Rust
use criterion::{BenchmarkId, Criterion, Throughput, criterion_group, criterion_main};
|
|
use rustfs_notify::rules::RulesMap;
|
|
use rustfs_targets::arn::TargetID;
|
|
use starshard::{AsyncShardedHashMap, DEFAULT_SHARDS, SnapshotMode};
|
|
use tokio::runtime::Runtime;
|
|
|
|
fn build_rule_map(target: &TargetID) -> RulesMap {
|
|
let mut rules_map = RulesMap::new();
|
|
rules_map.add_rule_config(&[rustfs_s3_common::EventName::ObjectCreatedPut], "*".to_string(), target.clone());
|
|
rules_map
|
|
}
|
|
|
|
async fn build_map(mode: SnapshotMode, bucket_count: usize) -> AsyncShardedHashMap<String, RulesMap, rustc_hash::FxBuildHasher> {
|
|
let map = AsyncShardedHashMap::with_snapshot_mode(DEFAULT_SHARDS, mode);
|
|
let target = TargetID::new("bench-target".to_string(), "webhook".to_string());
|
|
|
|
for i in 0..bucket_count {
|
|
let bucket = format!("bucket-{i}");
|
|
map.insert(bucket, build_rule_map(&target)).await;
|
|
}
|
|
map
|
|
}
|
|
|
|
async fn scan_target_bound(map: &AsyncShardedHashMap<String, RulesMap, rustc_hash::FxBuildHasher>, target_id: &TargetID) -> bool {
|
|
let items = map.iter().await;
|
|
for (_bucket, rules_map) in items {
|
|
if rules_map.contains_target_id(target_id) {
|
|
return true;
|
|
}
|
|
}
|
|
false
|
|
}
|
|
|
|
fn bench_snapshot_mode_scan(c: &mut Criterion) {
|
|
let rt = Runtime::new().expect("tokio runtime");
|
|
|
|
let mut group = c.benchmark_group("notify_rule_engine_scan_snapshot_mode");
|
|
// Simulate medium-large config sets where full-map scan cost matters.
|
|
let bucket_sizes = [1_000usize, 10_000usize];
|
|
|
|
for bucket_count in bucket_sizes {
|
|
for (mode, mode_name) in [(SnapshotMode::Clone, "clone"), (SnapshotMode::Cached, "cached")] {
|
|
let map = rt.block_on(build_map(mode, bucket_count));
|
|
let miss_target = TargetID::new("missing-target".to_string(), "webhook".to_string());
|
|
|
|
group.throughput(Throughput::Elements(bucket_count as u64));
|
|
group.bench_with_input(BenchmarkId::new(mode_name, bucket_count), &bucket_count, |b, _| {
|
|
b.iter(|| {
|
|
let found = rt.block_on(async {
|
|
scan_target_bound(std::hint::black_box(&map), std::hint::black_box(&miss_target)).await
|
|
});
|
|
std::hint::black_box(found);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
group.finish();
|
|
}
|
|
|
|
criterion_group!(benches, bench_snapshot_mode_scan);
|
|
criterion_main!(benches);
|