-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v5: Health Check & LeastLoad Strategy #589
Conversation
Can we have the An example of load balancer that does the job well is https://github.com/shadowsocks/shadowsocks-rust/blob/master/crates/shadowsocks-service/src/local/loadbalancing/server_stat.rs. It pulls TCP and UDP separately every 6 seconds, calculates the score based on different weights applied to RTT, failure rate, and latency stdev from the last 10 minutes. |
Thanks for the information.
I wrote these codes without reading any other implementations (and I cannot read Rust), there of course can be better implementations, I hope someone else can continue the work since it works enough for me now:
|
@database64128 I wonder about why they just measures by Suppose the outbound is setup like PS: I ever considered about measuring node by speed tests, that could be more reliable compares to ping, but it's more heavier to do so. Many clients, like |
@qjebbs shadowsocks-rust sends real requests for latency measurements. My point was, in addition to the TCP latency test with HTTP 204 pings as implemented in your PR, ss-rust also implements a UDP test by sending DNS requests. TCP and UDP scores are calculated separately, and is likely to end up selecting different servers for TCP and UDP. This helps a lot in situations where certain servers perform well with TCP traffic but poorly with UDP traffic. |
This PR could possibly introduce characteristic for packet inspection in the client side(Many extreme small payload size requests in each interval of time)? I choose to keep it for personal use. |
I'd love to see this PR merged. The feature is quite useful and extensible. And users can always choose to use it or not. |
It's probably not uncommon for application protocols to have keep-alive messages that are sent at regular intervals. |
@database64128 I have no expertise for this field, If the v2fly team discussed and choose to merge it, I was glad to see it happens. 😁 |
Work in this area is meaningful, I support a merge. In the future, we don’t need a regular network test, We can get information from the route logs |
Yes, it's a good plan and we can even collects speed info for balancing strategy, though the disadvantage is that, we will firstly request to a failed node, then to decide not to use it next time. I'm not good at v2ray underlying logic, like |
We can support multiple types of balancers, And keep timing measurements. |
@kslr Yes, the PR supports multiple balancers with different strategies and different strategies settings. Currently we have |
@qjebbs
|
> it causes data racing
@LazyZhu 有个大BUG,用最新的应该修复了 @kslr 新增了 cost加权、failure tolerance、手工覆盖均衡器、网络连通性检查。想做的都做了,没做的做不了或者不想做了😂
PS: testCases := []*RoutingContext{
{InboundTag: "in", OutboundTag: "out"},
{TargetIPs: [][]byte{{1, 2, 3, 4}}, TargetPort: 8080, OutboundTag: "out"},
{TargetDomain: "example.com", TargetPort: 443, OutboundTag: "out"},
{SourcePort: 9999, TargetPort: 9999, OutboundTag: "out"},
{Network: net.Network_UDP, OutboundGroupTags: []string{"outergroup", "innergroup"}, OutboundTag: "out"},
{Protocol: "bittorrent", OutboundTag: "blocked"},
{User: "example@v2fly.org", OutboundTag: "out"},
{SourceIPs: [][]byte{{127, 0, 0, 1}}, Attributes: map[string]string{"attr": "value"}, OutboundTag: "out"},
} |
* switch sync.Mutex to avoid potential racing * add more tests * code optimize
好了,收工。
|
Great! 只差写一下文档了 p.s 很有可能,不过这个功能作者已经弃坑了,如果未来一段时间没人接手,我可能会选择删掉,换一种简单的方式实现 ( 指找一个库换上 |
🎆 |
这个合到v5分支了,但是现在的v5 release只有LeastLoad的添加,那几个api command都没有,想问问怎么回事? |
The following config explains everything:
More about
baselines
&expected
:To inspect how
LeastLoad
strategy works to tweak settings:PS: Default strategy is Random (the original strategy), the behavior is unchanged, user doesn't need to explicitly set to it.