LiteSun commented on issue #13961:
URL: https://github.com/apache/apisix/issues/13961#issuecomment-6397924965

   I reproduced this issue locally and found the cause.
   
   **Cause**: APISIX 3.18 upgraded its Prometheus dependency. The new version 
cleans up expired metrics once an hour. After each cleanup, all workers do a 
heavy full sync at the same time. That causes an hourly CPU spike and stalls 
requests.
   
   **Fix status**:
   - api7/nginx-lua-prometheus#25 has been merged and fixes the main problem. 
In my tests, the stall went from about 20 seconds to about 1 second.
   - api7/nginx-lua-prometheus#23 is still under review. It removes the 
remaining 1-second stall.
   - Neither fix has been released yet, so **current APISIX versions are still 
affected**. Once both are released and APISIX upgrades the dependency, the 
issue will be fully resolved.
   
   **Workaround**: Replace 
`/usr/local/apisix/deps/share/lua/5.1/prometheus_keys.lua` in APISIX with the 
`prometheus_keys.lua` from api7/nginx-lua-prometheus#25. I tested this and it 
works.
   


-- 
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