Skip to content
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

多个balancer和observatory搭配使用行为有bug #1792

Open
Smoovsky opened this issue Mar 14, 2023 · 2 comments
Open

多个balancer和observatory搭配使用行为有bug #1792

Smoovsky opened this issue Mar 14, 2023 · 2 comments

Comments

@Smoovsky
Copy link

Smoovsky commented Mar 14, 2023

{
    // ...
    "outbounds": [
        {
            "protocol": "freedom",
            "tag": "direct"
        },
        {
            // ...
            "tag": "x1"
        },
        {
            // ...
            "tag": "x2"
        },
        {
            // ...
            "tag": "y1"
        },
        {
            // ...
            "tag": "y2"
        }
    ],
    "routing": {
        // ...
        "rules": [
            {
                "type": "field",
                "balancerTag": "x",
                "ip": [
                    "192.168.0.0/24"
                ]
            },
            {
                "type": "field",
                "balancerTag": "y",
                "ip": [
                    "192.168.1.0/24"
                ]
            }
        ],
        "balancers": [
            {
                "tag": "x",
                "selector": [
                    "x"
                ],
                "strategy": {
                    "type": "leastPing"
                }
            },
            {
                "tag": "y",
                "selector": [
                    "y"
                ],
                "strategy": {
                    "type": "leastPing"
                }
            }
        ]
    },
    "observatory": {
        "subjectSelector": [
            "x",
            "y"
        ]
        // ...
    }
}

期待的行为是192.168.0.0/24balancer x,192.168.1.0/24balancer y
但实际行为是192.168.1.0/24走了direct,可能是balancer y没有匹配到任何outbound的缘故。
为了进一步验证猜想,将balancer ystrategy改为随机:

            {
                "tag": "y",
                "selector": [
                    "y"
                ],
                "strategy": {
                    "type": "random"
                }
            }

这时候192.168.1.0/24就走了balancer y,问题就不在了。推测observatory的结果只能被使用一次,或者说只会返回一个最快的结果,如果最快的结果不能被另一个balancer匹配,便没有可用的outbound,从而导致了这个问题。

另外还有个问题,假设一切工作正常,请问下面的配置会发生什么:

{
    // ...
    "outbounds": [
        {
            "protocol": "freedom",
            "tag": "direct"
        },
        {
            // ...
            "tag": "x1"
        },
        {
            // ...
            "tag": "x2"
        },
        {
            // ...
            "tag": "xy1"
        },
        {
            // ...
            "tag": "xy2"
        }
    ],
    "routing": {
        // ...
        "rules": [
            {
                "type": "field",
                "balancerTag": "x",
                "ip": [
                    "192.168.0.0/24"
                ]
            },
            {
                "type": "field",
                "balancerTag": "xy",
                "ip": [
                    "192.168.1.0/24"
                ]
            }
        ],
        "balancers": [
            {
                "tag": "x",
                "selector": [
                    "x"
                ],
                "strategy": {
                    "type": "leastPing"
                }
            },
            {
                "tag": "xy",
                "selector": [
                    "xy"
                ],
                "strategy": {
                    "type": "leastPing"
                }
            }
        ]
    },
    "observatory": {
        "subjectSelector": [
            "x"
            // ,"xy" // 应该是多余的,理论上"x"应该已经包括了"xy"
        ]
        // ...
    }
}

期待的行为是192.168.0.0/24可走x1, x2, xy1, xy2,192.168.1.0/24xy1, xy2

@Smoovsky
Copy link
Author

可能相关 #872 #1146

@yuhan6665
Copy link
Member

能否测一下最新版 如果问题复现 能否测一下 burstObservatory 以及 leastLoad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants