- 优秀的负载均衡算法
理想状态下,负载均衡算法应该能够最小化服务响应时间(RTT),使系统吞吐量最高,从而保持高性能服务能力。
自适应负载均衡是指负载均衡算法能够根据服务能力动态的进行流量调度,无论当系统处在空闲、稳定还是繁忙状态,系统都可以保持较好的性能,不会产生饥饿或者宕机。 - 目标
- 保证系统稳定性,任何情况下服务都不能被打挂;
- 保证请求成功率,尽可能的让更多的请求在较短的时间内被处理;
- 尽可能避免因重试导致流量被过度放大。
- 为降低难度,本次比赛题目只使用了一个 Consumer。但负载均衡算法应该是可扩展的,需要考虑多 Consumer 和多 Provider 的情况。
示例
wrk -t4 -c1024 -d90s -T5 --script=./wrk.lua --latency http://localhost:8087/invoke
-c, --connections: total number of HTTP connections to keep open with
each thread handling N = connections/threads
-d, --duration: duration of the test, e.g. 2s, 2m, 2h
-t, --threads: total number of threads to use
-s, --script: LuaJIT script, see SCRIPTING
-H, --header: HTTP header to add to request, e.g. "User-Agent: wrk"
--latency: print detailed latency statistics
--timeout: record a timeout if a response is not received within
this amount of time.
- 制定provider启动参数
-Dquota=large 、-Dquota=medium、-Dquota=small
对应的端口号
large 890
medium 870
small 880
网友评论