-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Problem
C# request flow currently performs extra DB round-trips in hot paths:
- Update path does pre-read in controller and another read in repository.
- Create/Update paths call ReloadAsync() after SaveChangesAsync() to fetch refreshed values.
These patterns add latency and reduce throughput under load.
Goal
Reduce unnecessary round-trips in write paths while preserving API semantics and not-found behavior.
Scope
- Refactor controller/repository interaction for update/delete/create paths.
- Keep response contract unchanged.
Proposed changes
- Remove controller pre-read and let repository/service own not-found detection via affected rows or single read path.
- Eliminate unconditional ReloadAsync() on hot path where not strictly required.
- Review retry behavior for benchmark mode (EnableRetryOnFailure) to avoid artificial latency overhead in controlled tests.
Acceptance criteria
- Update path avoids duplicated pre-read + repository read pattern.
- Create/Update no longer always issue ReloadAsync() unless required for correctness.
- Not-found and status-code behavior remains unchanged.
- C# tests pass (unit/integration).
- Benchmark rerun shows improved C# DB p95/p99 and/or max stable RPS.
Notes
The objective is to keep EF Core idiomatic while minimizing per-request DB work.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels