Stories
Slash Boxes
Comments

News for nerds, stuff that matters

Slashdot Log In

Log In

Create Account  |  Retrieve Password

Making BitTorrent Clients Prioritize By Geography?

Posted by timothy on Tue Dec 02, 2008 12:43 PM
from the hey-you're-blocking-my-bandwidth dept.
Daengbo writes "While I live in S.Korea and have virtually unlimited bandwidth in and out of the country, not all my Asian friends are so lucky. Many of the SE Asian and African countries have small international pipes. Even when a user has a high-speed local connection, downloads from abroad will trickle in. Bittorrent clients apparently don't prioritize other users on the same ISP or at least in the same country. Why is that? Is it difficult to manage? If I were to write a plug-in for, say, Deluge, what hurdles would I be likely to come across? If this functionality is available in other clients or through plug-ins, please chime in."
+ -
story

Related Stories

This discussion has been archived. No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More
Loading... please wait.
  • by dave562 (969951) on Tuesday December 02 2008, @12:47PM (#25962271) Journal
    There is already a plugin for Azereus that does this. I downloaded it about a year ago. I'm at work right now or otherwise I would look at my installation and tell you the exact name of it.
    • by LSD-OBS (183415) on Tuesday December 02 2008, @12:52PM (#25962369)

      Is that the same plugin that constantly runs a barrage of pings in a hidden shell? Can't remember the name, but I ran a similar sounding plugin and didn't see much speed improvement but it sure did chew up my CPU.

      • Re: (Score:3, Informative)

        It probably is the same one. I seem to remember that it was developed as part of a university project. I probably even read about it right here on /. I never checked the background activity so I can't comment on the barrage of pings. I do recall that it didn't make much of a difference in my torrent speeds. I'm on DSL at home and always get consistently good torrent performance.

        • Re: (Score:3, Insightful)

          The "barrage" of pings may not have been necessary. A good first step is simply running the IPs through a geolocation database. There are various free ones available, and it's a pretty good first step for narrowing things down. They're very effective at getting the country right, and do a decent job at getting you to at least a nearby city.

          From there, if you need farther precision, a single ICMP packet is required to determine the number of hops to a host by checking the TTL. Combine these two things and it

    • by markov_chain (202465) on Tuesday December 02 2008, @01:06PM (#25962583) Homepage

      You can tell me, I work in the same place.

    • It is called Ono and it can be found here [northwestern.edu]
    • You could make a whole lot of ISP's happy by prioritizing the "closest" hosts. To do this would require computing the number of hops between the two devices. Ip packets have a ttl header that is (or should be) decremented by each router in the path. A little "magic" would be required since hosts don't universally have a consistent beginning ttl, and some firewalls play with it to obscure the host information. Discovering it shouldn't be too hard though. Another factor could be latency between hosts. T
    • Ono [northwestern.edu] uses statistical data from CDNs to be a little bit smarter about picking peers in certain cases. In most cases the random solution is fine; your client can just randomly pick peers then stick with fast ones and drop slow ones. Ono aims to improve performance in certain cases where that strategy isn't very good.

      Just in case anyone reading doesn't notice, Ono aims to find peers that are close to you on the network. That doesn't necessarily mean close to you geographically and so doesn't answer this ask /.

      • There is little to no support for multicast by last-mile ISPs.

        It would be nice - ISPs keep bitching about how P2P is eating their bandwidth, but they don't bother implementing multicast which would make P2P use a fraction of the bandwidth it currently does.

        Admittedly, in addition to lack of support, IPv4 multicast is pretty "meh" - there aren't many multicast addresses available and I have yet to see a good way of choosing/assigning them on a global network.

        • Re: (Score:3, Insightful)

          It would be nice - ISPs keep bitching about how P2P is eating their bandwidth, but they don't bother implementing multicast which would make P2P use a fraction of the bandwidth it currently does.

          I believe you mean P2P uses a fraction of the bandwidth it would if we had multicast. I have a constant upstream of 200k/s, to 5 clients, each getting 40k/s down from me. With multicast, I could have a constant upstream of 200k/s, to 5 clients, each getting 200k/s from me. This means I would send 200k/s up; my router would route for about 6 hops, then send duplicate packets out to 5 different routers from that hop, which would then send 200k/s down to various points on the Internet. Instead of consumin

          • Re:Won't work (Score:4, Informative)

            by Andy Dodd (701) <`ude.llenroc' `ta' `7dta'> on Tuesday December 02 2008, @05:19PM (#25967111) Homepage

            Look at it from a different perspective - 100 people want one file of size A megabytes, and you start with one person seeding.

            With classic unicast distribution, 100*A needs to be sent by that one person.

            With P2P, much less needs to be sent, but still 100*A needs to traverse the network. It may or may not traverse fewer hops - it may in fact traverse more.

            With multicast, A megabytes leave the single origin, and that gets multipled by routers as needed in the most efficient manner. In the end, the least amount of data needs to be sent in order for everyone to achieve completion. Yes, in the short term the network load will probably not be reduced much, but the time that high load occurs for will be far less before everyone has the file and there is little need for lots of bandwidth.

      • Re: (Score:3, Insightful)

        Extending a business partnership with them, and convincing them that they CAN allow users to serve content without choking their already oversold bandwidth

        This is fairly easy to do right now eith US ISPs...it's called a "business account".

        They do cost more, but in my case I get 5 static IPs, guaranteed bandwidth, and no interference of any kind with my data (no port blocking, no throttling, and no caps) for $140. Compared to the non-business version with one dynamic IP, port blocking and some throttling (but no caps yet) at $70, it's not a bad deal.

  • "Prioritizing" (Score:5, Insightful)

    by zombietangelo (1394031) on Tuesday December 02 2008, @12:48PM (#25962303)
    IPs could, theoretically, be prioritized based on a database of known general geographies associated with certain digits. Just remember - prioritizing is one thing, but it's a slippery slope to peer exclusion.
    • Re:"Prioritizing" (Score:5, Insightful)

      by evanbd (210358) on Tuesday December 02 2008, @01:27PM (#25962947)

      Just remember - prioritizing is one thing, but it's a slippery slope to peer exclusion.

      Not really. Prioritize who you request data from, but not who you send it to. If all incoming requests are treated equally, but you only request from the optimal peers, you get all the benefits without any of the omgcensorship fud.

  • uTorrent (Score:5, Informative)

    by SpitfireSMS (1388089) on Tuesday December 02 2008, @12:49PM (#25962317)
    uTorrent has a feature called local peer discovery that does that exactly. It was even able to discover other people at my university sharing the files.
    • Re:uTorrent (Score:5, Informative)

      by Fëanáro (130986) on Tuesday December 02 2008, @02:03PM (#25963603)

      Local peer Discovery works only within a lan, the corresponding broadcast messages are not routed over the internet

      • Re:uTorrent (Score:5, Informative)

        by X0563511 (793323) <.draeath. .at. .member.fsf.org.> on Tuesday December 02 2008, @01:04PM (#25962561) Homepage Journal

        rtorrent [rakshasa.no]

          • Re:uTorrent (Score:5, Interesting)

            by Freultwah (739055) on Tuesday December 02 2008, @02:51PM (#25964413) Homepage

            I run rtorrent in a detached screen session on a headless FreeBSD machine tucked away in the closet. I add torrent files to it just by dropping them into rtorrent's watch folder, everything else (starting, stopping, throttle management for off hours) is taken care of automatically. I do not have to have my laptop on or listen to the desktop whine all the time. Plus, rtorrent is blazing fast AND platform agnostic.

            It is also accessible in many ways, ssh being the most obvious, but there are also many GUIs available, with which you can manage torrents from afar. I like it how it is possible to add a torrent to the queue, then take a 3 hour train ride home and find it's all done for you. Magic. So, yes, a torrent client that is run in a terminal can be a Very Good Thing for those who can set it up and use it the way it was meant to be. (And I am pretty sure it was meant to be used that way.)

                • Re:uTorrent (Score:5, Insightful)

                  by Free the Cowards (1280296) on Tuesday December 02 2008, @03:41PM (#25965343)

                  That just means that ws_ftp's GUI is a pile of shit, it doesn't mean that GUIs are inherently slow.

                  • Re: (Score:3, Insightful)

                    Actually they're both true. The OS will schedule the whole process, and react to threads; the GUI thread can overtake the network thread and the whole process will get bumped down as a unit once it's used its CPU allotment. Bad network protocol behavior, reacting to too much i/o demand, etc, and the OS will schedule a lot more CPU time to the GUI and slow down network transmission; bad programming in the UI can also affect this. In either case, the presence of a GUI or extremely active text UI will slow
      • But is there really a better torrent client?

        Negative.

      • Re: (Score:3, Interesting)

        It's not a plugin, and it doesn't make you more or less likely to get busted. It simply searched the peer list from the tracker and prioritizes peers on the same subnet as you, and optionally removes your throughput limits.
        A good feature, but it doesn't completely solve the problem, since it only works within your local subnet, and is therefore inherently incompatible with NAT.

  • Ono (Score:5, Informative)

    by pythonax (769925) on Tuesday December 02 2008, @12:50PM (#25962319)
    There is a plugin for Vuze (formerly Azureus) called Ono which does exactly that. Not sure what the problems they ran into, but as it is a college project I am sure they would be willing to discuss some of it with you. http://www.aqualab.cs.northwestern.edu/projects/Ono.html [northwestern.edu]
  • Non-geo-ip (Score:4, Interesting)

    by rbanffy (584143) on Tuesday December 02 2008, @12:50PM (#25962335) Homepage

    One would not even need to prioritize by geographic location: the client could easily give extra priority points by network class: C first, then B, then A, then the rest. The odds of having a very fat pipe to another machine in the same class C are far better than having a fat pipe to a random machine across the planet.

    And that would also alleviate the load on backbone links.

    • Re: (Score:3, Informative)

      That doesn't work well with networks split with CIDR. For example, the 24.x.y.z block is in the Class A address range, but it's not a class A block.

  • by Anonymous Coward on Tuesday December 02 2008, @12:50PM (#25962337)

    That way they can take advantage of the tendency of IP packets to flow downhill.

  • Already Made "Ono" (Score:5, Informative)

    by StarWreck (695075) on Tuesday December 02 2008, @12:51PM (#25962347) Homepage Journal
    What you're looking for is an Azureus plugin called "Ono". It prioritized based on router hops. Theoretically, this would make those connected to the same ISP preffered. After that it would make ISP's with direct connections to your ISP preferred. After that, resonably close geographically, ie same country.
  • Latency? Hops? (Score:4, Interesting)

    by Midnight Thunder (17205) on Tuesday December 02 2008, @12:52PM (#25962357) Homepage Journal

    How good is latency or hops as indicator of distance from peer? The idea is that if it takes 5 hops, as opposed to 10, then the peer taking the least hops to get to is the closest.

  • by chrysrobyn (106763) on Tuesday December 02 2008, @12:52PM (#25962359)

    For Vuze [vuze.com], formerly Azureus [sourceforge.net], there are Ono [northwestern.edu] and P4P [yale.edu], which should do what you're looking for, although for different reasons. Unfortunately, they both rely on people in your region being interested in the same torrents you are, while P4P additionally benefits from an iTracker, an ISP provided tracker that's topology aware (they did some work to prioritize based on ping latency, using that as a distance estimate, but I don't know if it's a fallback mechanism). Due to the iTracker infrastructure and possibly conflicting supporters, there are some privacy concerns [torrentfreak.com].

  • by VGPowerlord (621254) on Tuesday December 02 2008, @12:57PM (#25962445) Homepage

    "Bittorrent clients apparently don't prioritize other users on the same ISP or at least in the same country. Why is that? Is it difficult to manage?"
    The reason BitTorrent doesn't prioritize other users on the same ISP or the same country is that it doesn't know which ones are part of the same ISP or the same country. For ISPs, since the introduction of CIDR addresses, ISPs can have multiple blocks of IPs. Can you honestly tell me what all of, say, Comcast's IP blocks are with any degree of certainty?

    For countries, you either need to know which IP blocks IANA has allocated to which IP registry or use a geolocation library.

    MaxMind's GeoIP [maxmind.com] seems to be the de facto geolocation library, but they charge money for the "good" version. There is a free version [maxmind.com] now, but it has some annoying requirements, such as having to include "This product includes GeoLite data created by MaxMind, available from http://maxmind.com/ [maxmind.com]" in all advertising materials and documentation. It also only has a 99.5% accuracy as claimed by its creators, which means the the accuracy is probably considerably lower than they claim. Even if it were 99.5%, that means it's wrong for 1 out of every 200 people.

    • Re: (Score:3, Insightful)

      The 99.5% accuracy number is considerably greater than 1/200. The accuracy figure is not a percentage of lookups that are incorrect, but of how close to the correct physical location the query result will be. Even the .5% of wrong locations won't be on the wrong side of the planet so it still makes for a very useful resource for figuring out regions.
  • by PhrostyMcByte (589271) <phrosty@gmail.com> on Tuesday December 02 2008, @12:57PM (#25962457) Homepage
    I've always wondered why ISPs can't give higher speeds if you stay within their network. You'd get your download faster. You'd use less peering bandwidth, costing the ISP less money. Everybody wins.
  • by Nick Ives (317) on Tuesday December 02 2008, @01:08PM (#25962617)

    If your ISPs international pipe is flooded then bittorrent will automatically prefer local peers as they'll be the only people who can send you data at a fast enough rate. If you notice local peers who you're not connected to then it's most likely just because they've already reached their connection limit.

    Most bittorent clients will connect to many peers and try to saturate your downstream bandwidth. They don't care where in the world those peers are as long as they're fast. If, in your part of the world, local peers are faster then that means you should just automatically connect to more local peers.

  • by Aloisius (1294796) on Tuesday December 02 2008, @01:14PM (#25962717) Homepage
    At Napster I wrote a system to weight peers that were closer to the person searching by using network distance.

    It was mostly because universities were complaining and so we weighted everyone on Internet 2 towards each other, but it also worked quite well for service providers like @Home and AOL. Since ISPs don't seem to care as much when their own bandwidth is used, a lot of complaints about our bandwidth consumption disappeared overnight. Indiana state university and someone else helped out if I remember correctly.

    It was a rather simple system that used BGP routing tables from a number of routers to build a graph of network connectivity. It wasn't perfect, but it didn't have to be.

    That said, with IPv6 weighting is *much* easier because of how the IP space is divided up. You can do a super naive implementation just by prefix.

    An Azureus plugin Ono does something similar, though I believe they just look up the IP address for a CDN and weight people that look up the same IP towards each other. It is a decent solution, but it only works for between people who are running the plugin.
  • by WinDev (1422301) on Tuesday December 02 2008, @01:35PM (#25963079)

    The biggest speed issue facing Asia/Australia is the latency of traffic to the rest of the planet. The (Windows) TCP Receive Window is tuned too small for the distances required. If you change the receive window to the maximum, you can get 4x more data in the same period using any client (P2P, browsers, etc...).

    Refer to:
    http://cable-dsl.navasgroup.com/index.htm#IncreasingWindow [navasgroup.com]

  • by PJ The Womble (963477) on Tuesday December 02 2008, @02:17PM (#25963829)
    When I was in my first year at college, we were asked to produce a questionnaire about using ATMs, including the question: "If you could change one thing about your bank's ATMs, what would it be?"

    The most popular answer I managed to get was "if the machine's running out of money, they should restrict the cash withdrawal function to customers of this branch".

    Does anyone see a parallel here?
  • by WittyName (615844) on Tuesday December 02 2008, @07:17PM (#25968833)

    And I proposed it for two popular BitTorrent clients, only to be told, "we don't need that.."

    Simple enough to do. Start with Class C address.. less then 2^24 of them, as some
    are reserved, and not routable. Make a bitmap that big, so divide by 8.
    Only a two meg file. Then just watch your connections, total by bytes received, then divide by 8. If the result is greater than say 1 kb/sec sustained, then
    set the appropriate bit to true. Allow the bitmap to be zeroed if you move or whatever.

    After getting the list of peers, prioritize connection attempts towards those
    that have a useful sustainable rate. Nothing worse than seeing 80% of my
    connections saying connected 30 minutes, 100 KB transferred. Sigh.

    While in china, I had a 2 mb connection. But too many Chinese hammering it, so
    I could sustain, 2 mbit up, and 1 mbit down. Asymmetric the wrong way..

    Seems blindingly obvious to me, yet I still see no clients with this feature.

    • Re:Stop It (Score:5, Insightful)

      by Sparr0 (451780) <sparr0NO@SPAMgmail.com> on Tuesday December 02 2008, @01:01PM (#25962501) Homepage Journal

      Prioritize by network topology is a better way to put it, that just happens to coincide with physical AND political geography in many cases. In the case where you can get 10Mb over a 10-hop connection, or 8Mb over a 3-hop connection, which do you pick? If you pick the latter, there is a good chance that two other users can utilize the other 70% of that 10-hop connection, making total throughput (theoretically) 24Mb.

      • Re: (Score:3, Interesting)

        I think they've got it all wrong. The software shouldn't be connecting people to nodes in their area. It should be connecting people to nodes in regions that can't sue them for uploading.
    • Re: (Score:2, Flamebait)

      Oh, you meant prioritize by politics, not geography.

      No. You can try reading the summary, asshole. Here, I'll repost it here in case you were too lazy to read it above:

      "While I live in S.Korea and have virtually unlimited bandwidth [wired.com] in and out of the country, not all my Asian friends are so lucky. Many of the SE Asian and African countries have small international pipes [nationmaster.com]. Even when a user has a high-speed local connection, downloads from abroad will trickle in.
      Bittorrent clients apparently don't prioritize other users on the same ISP or at least in the same country. Why is that? Is it difficult to manage? If I were to write a plug-in for, say, Deluge [deluge-torrent.org], what hurdles would I be likely to come across? If this functionality is available in other clients or through plug-ins, please chime in."

    • Actually, reading the summary, the submitter is concerned with people in countries which have small international pipes- if they can prioritize peers who aren't constrained by the international bottleneck then those people might see a speed bump with bittorrent.
    • Re: (Score:2, Interesting)

      by Anonymous Coward

      No. Prioritize by ASN. A smart tracker would get a BGP feed and then hook users together based on locality of network connectivity.

      Any other approach is "wrong."