Files
vigilcare-clinical/docs/performance/phase-43-throughput-hot-paths.md
T
Trent 68a2ab3204
CI / changes (push) Successful in 17s
CI / frontend (push) Skipped
CI / backend (push) Successful in 15m10s
Fix Kafka retry seek, bound buffers, and cut hot-path CPU/memory waste (Phases 41–44).
Stop consumers from committing past failed offsets, harden Rabbit/DataLake/gateway backpressure, dispose JsonDocument/MinIO correctly, and batch expensive DB/HTTP paths. Track progress in docs/performance.
2026-11-30 21:32:43 +08:00

1.5 KiB

Phase 43 — Throughput Hot Paths

Field Value
Status Complete
Audit findings 6, 9, 10, 11, 12, 13
Depends on Phase 42

Goal

Cut DB and HTTP round-trips under peak traffic and gateway catch-up without changing clinical scoring semantics.

What to build

  • Clinical sync: removed nested TX around ApplySyncedObservation (SaveChanges + Clear on conflict)
  • PHI list audit: LogViewsAsync batch + one SaveChanges
  • Reconciliation checks: preload open keys + single SaveChanges
  • Ward AddHttpClient("central"): BaseAddress + 30s timeout; per-request headers (no DefaultRequestHeaders mutation)
  • Encounter replica sync: upsert from list summary when patient exists; detail GET only for new patients
  • Encounter timeline: 7-day window + Take(500) per event type
  • Ward list: latest-per-encounter GroupBy/First for NEWS2/SOFA/GCS/sepsis

Key files

  • ClinicalSyncBatchProcessor.cs, ObservationService.cs
  • PatientService.cs, PhiAccessLogService.cs
  • Reconciliation checks under BackgroundServices/Reconciliation/
  • VigilCare.WardGateway/Program.cs, EncounterReplicaSyncService.cs
  • EncounterService.cs

Acceptance criteria

  • Fewer commits per sync batch / patient list / reconciliation run
  • Named HttpClient configured once with timeout
  • Timeline and ward-list score queries bounded
  • Relevant tests green

Verification notes

  • API + WardGateway build green after changes.
  • Focused unit tests (PoisonPill/KafkaConsumerRetry/DataLakeEventParser) green.