我一直试图找到一种方法来避免docker swarm的性能问题。 我使用以下情形:
ab -> [SWARM: nginx -> nginx]
其中
return 200 'serv x'
。问题是请求速率开始下降,大约为14000个请求,其余请求延迟了1秒。
vagrant@ubuntu-xenial:/vagrant/sources/ab$ ab -n 15000 -c 100 http://172.28.128.3:8080/pass
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 172.28.128.3 (be patient)
[CUT]
Server Software: nginx/1.15.1
Server Hostname: 172.28.128.3
Server Port: 8080
Document Path: /pass
Document Length: 7 bytes
Concurrency Level: 100
Time taken for tests: 26.662 seconds
Complete requests: 15000
Failed requests: 0
Total transferred: 2235000 bytes
HTML transferred: 105000 bytes
Requests per second: 562.59 [#/sec] (mean)
Time per request: 177.750 [ms] (mean)
Time per request: 1.777 [ms] (mean, across all concurrent requests)
Transfer rate: 81.86 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 59 235.2 0 1002
Processing: 3 116 223.3 62 1208
Waiting: 3 116 223.3 61 1208
Total: 9 175 458.2 62 2209
Percentage of the requests served within a certain time (ms)
50% 62
66% 66
75% 69
80% 70
90% 77
95% 2000
98% 2004
99% 2011
100% 2209 (longest request)
我发现了docker的以下两个问题:
看起来很相似,所以我添加了评论,但还没有回复。
出现问题的可能原因:
这些问题中有趣的评论之一是:
raarts:在我看来,这里讨论的问题的真正原因是,对于基于ipvs的内部swarm负载均衡器,所有请求都来自同一ip地址。而且由于它散布在source-ip / port上,因此很容易用完哈希表中的空间。
不幸的是,我无法验证这一理论,但是如果我理解正确,那么docker balance就是iptables + ipvs的组合,因此可以将服务VIP直接映射到发生实际平衡的ipvs。
有人有类似的问题,并且知道一种解决方法,或者至少可以避免它吗?
-
我一直在使用最新的docker edge版本Server Version: 18.05.0-ce