Skip to content

feat: improve performance introduce an object cache#1016

Open
Manuthor wants to merge 4 commits into
developfrom
perf
Open

feat: improve performance introduce an object cache#1016
Manuthor wants to merge 4 commits into
developfrom
perf

Conversation

@Manuthor

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Not ready to approve

It introduces a critical response/serialization correctness issue in KMIP JSON responses and a high-risk cache-staleness/security concern (multi-instance consistency) that should be resolved before approval.

Pull request overview

This PR targets server throughput/latency improvements by reducing hot-path allocations and database round-trips, primarily via a new in-memory retrieve_object cache and several DB/HTTP tuning changes.

Changes:

  • Add an in-memory object cache in server_database and integrate it into Database::retrieve_object, with invalidation on mutations.
  • Optimize KMIP JSON handling/dispatch (reduced allocations, conditional metrics/policy work) and add an http_workers server setting.
  • Improve load-test benchmarking ergonomics (warmup/cooldown) and tune SQLite backend (PRAGMAs, indexes, cached prepared statements).
File summaries
File Description
documentation/docs/certifications_and_compliance/cryptographic_algorithms/benchmarks/benchmarks_load_tests_5.23.0.md Reformat benchmark result tables.
documentation/docs/certifications_and_compliance/cryptographic_algorithms/benchmarks/benchmarks_load_tests_5.17.0.md Reformat benchmark result tables.
crate/server/src/start_kms_server.rs Apply optional actix-web worker count from config.
crate/server/src/routes/kmip.rs Reduce JSON allocs/serialization overhead and adjust response construction.
crate/server/src/middlewares/otel_http_middleware.rs Import ordering tweaks only.
crate/server/src/main.rs Update test config struct initialization for new server param.
crate/server/src/core/otel_metrics.rs Import grouping tweaks only.
crate/server/src/core/operations/key_ops/crypto_op.rs Local-key fast paths + owner authorization fast-path + unwrap guard.
crate/server/src/core/operations/dispatch.rs Reduce overhead when metrics/policy are disabled.
crate/server/src/core/kms/permissions.rs Remove debug logging from get_user.
crate/server/src/config/wizard/tests.rs Update wizard round-trip test struct for new HTTP config field.
crate/server/src/config/wizard/http_wizard.rs Initialize new HTTP config field in wizard output.
crate/server/src/config/params/server_params.rs Add http_workers to server params and wire it from config.
crate/server/src/config/command_line/http_config.rs Add --http-workers / KMS_HTTP_WORKERS config plumbing and display.
crate/server_database/src/stores/sql/sqlite.rs SQLite PRAGMAs, connection pool sizing, schema bootstrapping indexes, cached prepared statements.
crate/server_database/src/stores/sql/query.sql Add indexes for owner/state/userid lookups.
crate/server_database/src/lib.rs Re-export the new cache type.
crate/server_database/src/core/object_cache.rs New LRU-ish cache with timestamp-based GC for retrieved objects.
crate/server_database/src/core/mod.rs Add object_cache to Database and move object-count helpers to default-store-only impl.
crate/server_database/src/core/database_objects.rs Integrate object cache, add invalidation on writes, tweak store routing fast-path.
crate/kmip/src/ttlv/kmip_ttlv_serializer.rs Pre-allocate serializer stack capacity (constructor no longer const fn).
crate/interfaces/src/stores/objects_store.rs Whitespace cleanup only.
crate/clients/clap/src/actions/bench.rs Add warmup/cooldown flags and rework load-test execution model.

Copilot's findings

  • Files reviewed: 23/23 changed files
  • Comments generated: 13

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.

Comment thread crate/server/src/routes/kmip.rs
Comment thread crate/server/src/start_kms_server.rs
Comment thread crate/server_database/src/core/database_objects.rs
Comment thread crate/server_database/src/core/database_objects.rs Outdated
Comment thread crate/server_database/src/core/database_objects.rs Outdated
Comment thread crate/server_database/src/core/object_cache.rs Outdated
Comment thread crate/clients/clap/src/actions/bench.rs Outdated
Comment thread crate/clients/clap/src/actions/bench.rs
Comment thread crate/clients/clap/src/actions/bench.rs
Comment thread crate/server_database/src/core/object_cache.rs
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.

2 participants