apisix icon indicating copy to clipboard operation
apisix copied to clipboard

bug: add_target when create healthchecker consume too much cpu

Open dream110fly opened this issue 1 year ago • 4 comments

Current Behavior

we use apisix 2.13.1,api7-lua-resty-healthcheck package version is 3.2.0. we create one upstream with 1000 k8s pods,then update upstream with 1 second period. we find that one or more nginx process cpu load not stable, sometime cpu load reach 100%, then come down.

image

from lua stack flame, we can see that apisix locking_target_list when add_target of upstream one by one consume too much cpu

image image

Expected Behavior

No response

Error Logs

No response

Steps to Reproduce

1.create one upstream with 1000 pods 2.update upstream with 1 second period 3.watch nginx prcess cpu load

Environment

  • APISIX version (run apisix version):
  • Operating system (run uname -a):
  • OpenResty / Nginx version (run openresty -V or nginx -V):
  • etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info):
  • APISIX Dashboard version, if relevant:
  • Plugin runner version, for issues related to plugin runners:
  • LuaRocks version, for installation issues (run luarocks --version):

dream110fly avatar Feb 06 '24 08:02 dream110fly

then update upstream with 1 second period

What does this mean?

create one upstream with 1000 pods

Is this a real use case environment?

shreemaan-abhishek avatar Feb 06 '24 16:02 shreemaan-abhishek

call upstream admin api to update upstream periodicall, and the period is 1 second.

it is our real environment.

then update upstream with 1 second period

What does this mean?

create one upstream with 1000 pods

Is this a real use case environment?

dream110fly avatar Feb 07 '24 01:02 dream110fly

Interesting. I will take a look when I am free. Thanks for the report <3

Please send the flamegraph and other relevant files to my email [email protected]

shreemaan-abhishek avatar Feb 07 '24 02:02 shreemaan-abhishek

https://github.com/Kong/kong/issues/7654 kong also have the same problem

dream110fly avatar Feb 18 '24 03:02 dream110fly