Remove readiness cache - #419
Open
timmarkhuff wants to merge 7 commits into
Open
Conversation
added 2 commits
May 27, 2026 17:02
timmarkhuff
commented
May 27, 2026
| MIN_ROLLOUTS = 2 | ||
|
|
||
|
|
||
| def disable_transport_retries(gl: ExperimentalApi) -> None: |
Contributor
Author
There was a problem hiding this comment.
Moving these functions to groundlight_helpers.py so that they can be reused.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
After a detector's inference pod becomes ready, inference requests would intermittently fail with:
Failures lasted ~3-5 seconds then stopped on their own. This was most visible immediately after
gl.edge.set_config()returns, since that's when pods freshly roll out, but the underlying issue could surface any time pod readiness state changed (e.g. after a model update rollout).Root cause
is_edge_inference_ready()was decorated with a 5-second per-process TTL cache. The server runs 8 uvicorn workers, each with its own private cache instance. When a pod becomes ready, whichever worker happens to check first cachesTrue-- but the other workers still hold a staleFalsefor up to 5 more seconds. Image queries round-robining across those workers got 503s from any worker that hadn't yet refreshed its cached negative result.Fix
Remove the cache and the pre-flight
inference_is_available()check entirely. Instead of checking/health/readybefore every request, just fire the inference POST directly and handleRuntimeErroron failure. This is faster on the success path (one fewer HTTP round trip per query) and eliminates the stale-cache window.The
/edge-detector-readinessendpoint (used byset_config()polling) now calls a newcheck_inference_ready()free function that hits/health/readylive with no caching, so readiness reporting is always accurate.A 1-second connect timeout was added to inference POSTs so that requests to a K8s Service with no ready endpoints fail quickly rather than hanging indefinitely.
Testing
Added
load-testing/fresh_pod_readiness_test.py, which reproduced the failure reliably (11/194 requests failed in a 10s burst immediately afterset_config()returned). After this fix the same script should declare victory with zero failures.