Skip to content

Use multiple simultaneous TCP connections  #141

Closed

Description

@malcolmputer

Syncthing only uses one TCP connection to transfer data. This unfortunately means that if your ISP/network limits the speed intentionally (or on accident) per TCP connection you are limited to the single TCP connection speed.

One reason BTSync is so fast is that it uses multiple connections (even between the same two servers).

In my case, my ISP doesn't intentionally limit the single TCP connection speed, but in practice it is limited between 5 and 8 Mbit. Whereas if I open up a torrent client (yes, I know that is torrent protocol, not Block Exchange), I can max out the full 50 Mbit I pay for.

I have tested that it is not a bug in the download speed of syncthing, by intentionally leaving one node offline (out of sync), and then letting all of my other nodes sync up, then starting up the one node. Then I get 5X (number of nodes) Mbit instead of just 5.

Before you say, upload bandwidth is the problem on the server I am downloading from, it isn't. The aforementioned cluster of nodes is on a 100Mbit Symmetric connection.

Activity

  1. calmh commented on Apr 21, 2014

    @calmh
    Member

    While I don't dispute what you say (when the network is congested, using more TCP connections will be faster than just one, due to grabbing more than 1/x of the available bandwidth) I'm inclined to think of this as a network problem more than a syncthing problem... That is, I don't think the subject is a correct description of the problem - if the bandwidth is available, there is no reason a single TCP connection wouldn't make use of it. If the bandwidth isn't available but used by something else, using more TCP connections will grab a larger share by competing more.

  2. malcolmputer commented on Apr 21, 2014

    @malcolmputer
    Author

    I agreed wholeheartedly that it is a network issue, but unfourtunately one that is out of my control.

    With the current state of ISP's in my location (and much of the rest of the US) it would be a welcomed feature however.

  3. changed the title [-]Syncthing makes poor use of available bandwidth[/-] [+]Syncthing needs to implement simultaneous TCP connections [/+] on Apr 21, 2014
  4. malcolmputer commented on Apr 21, 2014

    @malcolmputer
    Author

    Subject has been corrected.

  5. fazo96 commented on Apr 22, 2014

    @fazo96

    That is also the case in italy. I pay for a 6Mbit download connection but a single TCP connection never goes past 200 Kilobytes/s, but if I have multiple connections and sum their bandwidth I get a full 750 Kilobytes/s

    A very simple workaround is to run multiple instances of syncthing on your server and link them to the same cluster, it works because you download stuff from multiple istances and that means multiple connections :)

  6. malcolmputer commented on Apr 22, 2014

    @malcolmputer
    Author

    Thank you for the suggestion, I hadn't thought of that.

    calmh: How likely is that to corrupt things?

  7. calmh commented on Apr 22, 2014

    @calmh
    Member

    Should not result in any corruption, but may result in some double work (two instances syncing the same file from a remote node at the same time) and confusion (one of them might consider it a failure since the temporary file disappeared, moved by the other, then retry). And somewhat of a pain to set up with separate config dirs, keys, etc. All in all I wouldn't recommend it, but it's your computer. :)

  8. malcolmputer commented on Apr 22, 2014

    @malcolmputer
    Author

    I know better than to ask for an ETA, since I am not paying anything, but can we play "hour day week month year never" on the resolution of this enchancement?

    I can understand if it isn't a priority, and I assume it would require a protocol change of some sort.

  9. calmh commented on Apr 22, 2014

    @calmh
    Member

    At the moment it's deep into "if someone submitted a pull request that implemented this cleanly and optionally I would accept it" territory, i.e. no ETA since I'm not working on it. :) I can see the use case, but at the same time it's not something that's an issue in my setup. I consider syncing a background thing (with hopefully low impact on whatever else I'm really doing with my computer), so if there is a case where it doesn't grab all the available resources I'm kind of fine with that...

  10. calmh commented on Apr 22, 2014

    @calmh
    Member

    To summarize, I'm setting this as "won't fix", because thats the current status from my side and it sets the right expectations. But again, a fix from someone else wouldn't be rejected.

  11. viddypiddy commented on Mar 24, 2015

    @viddypiddy

    Any chance that this bug might be re-opened and worked with any time in the future?

    I'm in the same boat here, with my two destinations being 8000 kilometers-ish from eachother being practically being so slow across one TCP connection that we're talking 5-10% of the utilization of the links. They are 1Gbit/s links directly connected via fibre directly into the switch where the syncthing-machines are located on both sides.

    The latency is pretty horrid, so I guess thats why TCP is acting so bad. I managed to get it to act a few percentiles better by messing with TCP windows and qdisc/fq but no better than 15-20% on a REALLY good day.

    When using btsync, lftp or aria2 i can easily use close to 95% of the links. So i guess i'm chiming in to say theres definitely a use case for this. I am aware of the views of this being a network problem, and if these destinations were in the same country or even continent i would be inclined to agree, but there is no loss here, just latency. I have also tried across both IPv4 and native IPv6 on both sides (creds on IPv6 support actually working in syncthing!) with the same results. So I feel theres not much i can do on the network side. We have even tried alot of direct peering deals on the longest stretches, without much luck.

    Using UDP and some sort of control protocol to just throw the data over and retransmit stuff that doesn't get there either by throwing it again or pulling the missed blocks via TCP would also be great for me, but I don't know of anything like that being in the works for syncthing?

  12. 17 remaining items

  13. calmh commented on Dec 10, 2015

    @calmh
    Member

    You may want to contribute to #804 if you want to speed this up, and there is work in that direction somewhat ongoing now and then although not super actively. General discussion of how things should and shouldn't work is better done on the forum.

  14. unlocked this conversation on Jun 1, 2023
  15. reopened this on Jun 1, 2023
  16. added a commit that references this issue on Sep 6, 2023
    c6334e6
  17. added this to the v1.25.0 milestone on Sep 6, 2023
  18. added
    enhancement
    on Sep 6, 2023
  19. changed the title [-]Syncthing needs to implement simultaneous TCP connections [/-] [+]Use multiple simultaneous TCP connections [/+] on Sep 25, 2023
  20. TCB13 commented on Sep 27, 2023

    @TCB13
  21. added a commit that references this issue on Oct 15, 2023
    917698d
  22. brummbrum commented on Jan 17, 2024

    @brummbrum

    THANK YOU, THANK YOU! I only tried this today and it makes a world of difference with my ISP. Finally, I can saturate my contracted upload bandwidth over the internet. I have a 100Mb/s down & 10Mb/s up contract on two different sites. Unfortunately my ISP (deliberately or accidentally) caps uploads at approx 2Mb/s per connection. Download rates are no problem, I can saturate 100Mb/s with just a single link. But single connection uploads suck.
    I have found that this is a quite common problem for many users with different ISPs. It seems that from an ISP perspective they mostly deal with folks that are really only interested in download speeds. The few geeks who are self-hosters or whatever are simply getting under the bus. This makes it cheaper for ISPs because they need less expensive peering agreements with other network operators.
    Now that I can set numConnections between the different sites (syncthing devices) my synchronization speeds are finally at the maximum possible 10Mb/s speed over the WAN!! I know this took a long time and I saw some heated forum discussions related to this topic. But finally, it is working. Thanks again!

  23. added
    frozen-due-to-age
    on Sep 5, 2024
  24. locked and limited conversation to collaborators on Sep 5, 2024
  25. locked and limited conversation to collaborators on Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementfrozen-due-to-age

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions