Skip to content

Refactor runtime state for atomic configuration updates - #2

Merged
ktrubilo9 merged 4 commits into
mainfrom
refactor/runtime-consistency
Jun 12, 2026
Merged

ktrubilo9 merged 4 commits into
mainfrom
refactor/runtime-consistency

Conversation

@ktrubilo9

Copy link
Copy Markdown
Owner

Summary

Refactors runtime state management so requests always use one consistent configuration version during concurrent admin updates.

Changes

  • Introduce immutable RuntimeState published through atomic.Pointer
  • Load one runtime state for the complete request lifecycle
  • Add a concurrency-safe backend status registry
  • Preserve backend statuses across compatible configuration updates
  • Keep status views available to requests using an older runtime state
  • Serialize configuration mutations through applyUpdate
  • Atomically publish snapshot, HTTP client, load balancer, and status view
  • Reuse the HTTP client when transport settings are unchanged
  • Rebuild the HTTP client only when timeout configuration changes
  • Rebuild the load balancer only when its strategy changes
  • Close idle connections of replaced HTTP clients
  • Synchronize backend metrics during configuration updates
  • Make rate-limit callbacks concurrency-safe and optional
  • Update health checks and operational handlers to use consistent state views

Testing

Added tests covering:

  • backend status reconciliation
  • preservation and removal of backend statuses
  • runtime component reuse
  • failed configuration updates
  • concurrent configuration mutations
  • old state visibility after backend removal
  • concurrent proxy traffic during routing updates
  • HTTP client preservation during routing changes

@ktrubilo9
ktrubilo9 merged commit ec72a10 into main Jun 12, 2026
1 check passed
@ktrubilo9
ktrubilo9 deleted the refactor/runtime-consistency branch June 12, 2026 22:58
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.

1 participant