Replies: 2 comments 6 replies
-
In fact, watch_dir already has a rand operation, see: apisix/apisix/core/config_etcd.lua Lines 586 to 589 in 51eec3e is the rand interval not large enough? |
Beta Was this translation helpful? Give feedback.
4 replies
-
i set resync_delay default value to 20 , and call ngx_sleep before sync_data, the cpu is now stable, and always below 4%. before this change, the cpu would be very high every 30 seconds.
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
hi.
I created a issue a few days ago.
etcd cpu high in my test machine #6576
I use the default configuration, and the CPU becomes very high every 30 seconds.
now i find the reason now.
in core/config_etcd.lua _automatic_fetch() will sync_data() for each work processes.
and sync_data() call watchdir() to watch keys of apisix in etcd such as /apisix/upstreams, /apisix/consumers, /apisix/consumers, /apisix/routes, /apisix/plugin_metadata, /apisix/global_rules, /apisix/proto, etc.
The reason for my situation is that all processors will call watchdir() for all keys at the same time(every 30 seconds) . If I configure 8 worker processors, there are 8 keys here to watch, watchdir() is called 8x8=64 times at the same time.
I modified the timeout of watchdir() so that timeout = 20 + rand(20) for different keys. now cpu is normal.
I'm not sure if this is a bug, I just found out what happened to me.
Beta Was this translation helpful? Give feedback.
All reactions