hanzhenfang opened a new pull request, #14072:
URL: https://github.com/apache/apisix/pull/14072

   ## Summary
   
   Backport the shared-memory health status and picker invalidation work from 
apache/apisix#13894 to `release/3.18`, and include the missing `ai-proxy-multi` 
picker cache path noted in that PR's review. This is a draft while #13894 
remains open.
   
   In 3.18.0, active checks write the target state to shared memory, while 
`fetch_node_status()` and the picker cache key use a worker-local view and 
`checker.status_ver`. A worker that misses `resty.events` can keep a stale 
picker. The backport reads shared state before the local cache and makes the 
picker version change when node health changes in shared memory. The same 
status fingerprint is used for both AI instance picker and AI health-status 
caches.
   
   ## Local evidence
   
   - Official `apache/apisix:3.18.0-debian` image 
(`sha256:84e6b5e787e9f889ebff88161cb9a16599bafcffa236c6b54c7f779a0655940d`), 
four workers, isolated HTTPS primary and two fallbacks, priority `0/-1/-1`, 
active/passive checks with the #13888 thresholds: after PID 52 logged 
`unhealthy HTTP increment (2/2)`, 80/80 requests went to fallbacks. The 
reported long-lived natural divergence was **not reproduced** locally.
   - In a separate controlled test, shared memory was set to unhealthy (`2`) 
without publishing a `resty.events` notification, after warming the picker. 
Unpatched 3.18.0 sent 24/24 subsequent requests to the primary; with the core 
backport 24/24 went to fallbacks. This is **partial reproduction by fault 
injection**, not the original spontaneous event loss.
   - AI picker control: with only #13894's two core files, a warmed 
`ai-proxy-multi` route selected the now-unhealthy instance for 10/20 requests 
after a shared-memory-only flip. With this branch's AI cache-key change and 
checkers established, a repeated injection produced 30/30 requests to the 
healthy instance.
   - `git diff --check` and `luajit -bl` on all three modified Lua files exited 
0. Two Test::Nginx regression files are included, but the local Perl 
Test::Nginx dependency is absent, so these files have **not** passed the 
framework locally.
   
   ## Known limitation and review questions
   
   A worker whose checker has not yet been created can still route to an 
unhealthy node during the asynchronous creation window. In one controlled AI 
run, 7/20 first requests after the injected flip selected that node; after the 
checkers were created, 30/30 selected healthy. This PR does **not** claim 
complete convergence for that window. Maintainer review is needed on whether a 
direct shared-memory lookup before checker creation belongs in this backport or 
in a follow-up. The existing all-unhealthy fallback behavior is unchanged.
   
   The health fingerprint reads shared memory for each configured node on a 
request. A single local `ab -n 300 -c 10` comparison showed 0 failures on both 
variants, but is too small and noisy for a throughput conclusion. Please gate 
merge on Test::Nginx/CI, a targeted late-checker test, and the upstream #13894 
decision.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to