shadowsocks / shadowsocks/shadowsocks-rust

The server chosen by balancer is NOT the "best"

Open
#2,030 19 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
10.9k
Forks
1.5k
Avg merge
4d 15h
Merged PRs (30d)
5

Description

I have a local transparent proxy with the balancer:

{
    "locals": [
        {
            "local_address": "127.0.0.1",
            "local_port": 61082,
            "protocol": "redir",
            "tcp_redir": "redirect"
        }
    ],

    "servers": [
        // The domestic server(local host):
        {
            "address": "127.0.0.1",
            "port": 51080,
            "method": "none",
            "tcp_weight": 1.0
        }

        // The overseas server:
        {
            "address": "65.x.x.x",
            "port": xxxx,
            "method": "aes-256-gcm",
            "password": "password_string",
            "tcp_weight": 0.6
        },
    ],

    "balancer": {
        "max_server_rtt": 3,
        "check_interval": 120,
        "check_best_interval": 5
    },

    "mode": "tcp_only",
    "no_delay": false,
    "fast_open": true
}

I hope most traffic will be via the domestic server, and the overseas server will act as a backup. At the beginning the chosen server is domestic, but after a while the overseas server will be chosen and from then on it seems that the balancer will always think the overseas server as the best. See log please:

Image What did it happen and how to config? Thanks.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the balancer configuration and attached log, focusing on how server RTT, weights, check_interval, and check_best_interval affect selection. Reproduce the switch from the domestic to overseas server and determine whether the observed choice matches the documented balancing behavior. Done means explaining the selection and identifying a configuration or implementation change needed to make the domestic server the preferred fallback.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.