nginx-upsync-module icon indicating copy to clipboard operation
nginx-upsync-module copied to clipboard

OpenResty-1.15.8+nginx-upsync-module-2.1.3版本CPU高

Open lizj3624 opened this issue 3 years ago • 0 comments

  1. 环境 OpenResty-1.15.8+nginx-upsync-module-2.1.3

  2. 配置比较多 upstream有6500个,upstream中的server有4.5w个

  3. 相应的upsync配置

upstream my-ups {
    server 127.0.0.1:11111;

    upsync 127.0.0.1:2379/v2/keys/upstreams/my-ups/ upsync_timeout=6m upsync_interval=30s upsync_type=etcd strong_dependency=off;
    upsync_dump_path /nginx/conf/backend/http-my-ups.conf;
    include /nginx/conf/backend/http-my-ups.conf;

    #check interval=5000 rise=1 fall=2 timeout=1000 type=tcp default_down=false;
}
  1. 启动后每个worker的CPU使用率到90%,但是这时候没有任何请求量 ME1645073858774 ME1645073852801

perf查看一下,inet_hash_connect比较高,感觉有大量的tcp连接,把端口占满了

ss -s

Total: 142109 (kernel 142711)
TCP:   142363 (estab 99721, closed 5000, orphaned 58, synrecv 0, timewait 375/0), ports 64512

Transport Total     IP        IPv6
*	  142711    -         -
RAW	  0         0         0
UDP	  8         7         1
TCP	  137363    137359    4
INET	  137371    137366    5
FRAG	  0         0         0

感觉大量upstream时,这个模块有问题

lizj3624 avatar Feb 17 '22 04:02 lizj3624