Skip to content

strelaysrv: -per-session-rate parameter seems to not be working as expected #10072

@szu17dmy

Description

@szu17dmy

What happened?

Hi everyone,

Our team has been utilizing Syncthing and recently started exploring the -per-session-rate parameter to manage bandwidth more granularly.

Our understanding is that -per-session-rate should cap each individual device pair's connection speed, but the aggregate speed across all connections could exceed this limit.

However, we've encountered behavior where the total aggregate transfer rate seems to be unexpectedly capped at the value set by -per-session-rate, even when multiple peers are actively syncing. We wanted to inquire if this is expected or if we might be seeing an issue.

Actual Observed Behavior

Below (or attached) is a screenshot from our monitoring of the relay server's network traffic during a relevant period. During this time, the strelaysrv instance was running with parameters including -global-rate=50000000 and -per-session-rate=6250000.

Image

50000000bytes/s == 50000KB/s == 50MB/s == 400Mbps; approx.
6250000bytes/s == 6250KB/s == 6.25MB/s == 50Mbps; approx.

Expected Behavior

We expected each individual session (e.g., A<->B, C<->D) to be independently capped at approximately 50Mbps.

We expected the total aggregate transfer rate for them to be the sum of the active session rates, potentially reaching up to 400Mbps if connected to more peers.

Our Questions

Based on our observations, and after a preliminary review of the relevant code sections, it appears the rate limiter instance associated with the -per-session-rate parameter in strelaysrv might be implemented as a single, shared instance across all relayed sessions, rather than as distinct limiters created per session. Could you please confirm if this understanding of the current implementation is accurate?

sessionLimiter *rate.Limiter

Thanks.

Syncthing version

v1.22.1, no related changes were made after this version

Platform & operating system

Linux amd64

Browser version

No response

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA problem with current functionality, as opposed to missing functionality (enhancement)needs-triageNew issues needed to be validated

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions