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

Peer connect too long about 10seconds #1087

Closed
bluefchen opened this issue Mar 28, 2017 · 11 comments
Closed

Peer connect too long about 10seconds #1087

bluefchen opened this issue Mar 28, 2017 · 11 comments

Comments

@bluefchen
Copy link

@bluefchen bluefchen commented Mar 28, 2017

What version of WebTorrent?
0.98.13

What operating system and Node.js version?
v7.7.4

What browser and version? (if using WebTorrent in the browser)
Chrome 57.0.2987.98

What did you expect to happen?
Cut connection time

What actually happened?

I record the connection time , it seems too long. about 9s.

  1. Use the webtorrent-desktop to seed my files .
  2. Use the `https://github.com/feross/bittorrent-tracker, and run the command to set up tracker.

node_modules/bittorrent-tracker/bin/cmd.js

So I dont where the time go away.
Here is my code

console.time("Parse Time");
var torrentId = parseTorrent(fs.readFileSync(path.join(__dirname, './w_tracker_change.torrent')));
console.log(torrentId );
console.timeEnd("Parse Time");
console.time("add torrent");
var client = new WebTorrent({tracker:true,dht:false });
client.add(torrentId, function (torrent) {
        console.time("start connecting");
        console.log('Client is downloading:', torrent.infoHash);
        console.timeEnd("add torrent");

        torrent.on('wire', function() {
            console.time("download complete");
            console.timeEnd("start connecting");
        });

        torrent.on('done', function() {
            console.timeEnd("download complete");
        });
 });

image

image
The above process cost too much times.

@bluefchen bluefchen changed the title peer connect too long about 10seconds Peer connect too long about 10seconds in the connecting process Mar 28, 2017
@bluefchen bluefchen changed the title Peer connect too long about 10seconds in the connecting process Peer connect too long about 10seconds Mar 28, 2017
@kocoten1992

This comment has been minimized.

Copy link
Contributor

@kocoten1992 kocoten1992 commented Mar 28, 2017

I suspect it might because of this, https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Protocols

Could you add timer on tracker as well, so we would know if tracker could be the cause

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Mar 28, 2017

There's nothing WebTorrent as a library can do to speed webrtc connections. The tracking itself is very fast. Offers & Answers are pretty much instant and should only take the latency of between the peers and the tracker server, the processing time is negligible.

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Mar 28, 2017

Unfortunately, WebRTC connections can sometimes take a bit of time to set up, as @DiegoRBaquero said.

@feross feross closed this Mar 28, 2017
@bluefchen

This comment has been minimized.

Copy link
Author

@bluefchen bluefchen commented Apr 7, 2017

But actually it seems very fast when i open https://webtorrent.io/
It can establish connection with other peers with almost a negligible time.
How it is optimized?@feross @DiegoRBaquero @kocoten1992

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Apr 7, 2017

@bluefchen

This comment has been minimized.

Copy link
Author

@bluefchen bluefchen commented Apr 11, 2017

thank you for your reply!@DiegoRBaquero @feross

I try to seed file on webseed as the url https://hackernoon.com/how-to-create-a-swarm-cdn-for-free-with-webtorrent-bfa09d193f71 proposal , but it can not establish connection .

I still think about How to reduce the time to establish a connection , and where can I reduce the time to build a connection?

Is it webtorrent-desktop`s question?

@bluefchen

This comment has been minimized.

Copy link
Author

@bluefchen bluefchen commented Apr 24, 2017

Hi, can you please tell me what did you do to make it establish connection with other peers so fast in https://webtorrent.io/ on sintel.torrent @feross

@kocoten1992

This comment has been minimized.

Copy link
Contributor

@kocoten1992 kocoten1992 commented Apr 25, 2017

@bluefchen , it use webseed

var torrentId = 'magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10&dn=Sintel&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F&xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel.torrent'

focus on the last two, ws and xs, if you want to use webseed, combine it with xs (for case you are the only peer)

@bluefchen

This comment has been minimized.

Copy link
Author

@bluefchen bluefchen commented Apr 25, 2017

@kocoten1992 thank you for your reply!!!

Yup! It indeed has a ws and xs strings in the end
and the magnetic link generated by webtorrent-desktop doesn`t have

And i have try it ! when i delete the ws and xs strings &ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F&xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel.torrent

var torrentId = 'magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10&dn=Sintel&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com''

the whole connection time will become too long about 14s

and when i add the ws and xs strings.

it will be fast!

so How can i add this string to my magnetic link? @feross

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Apr 25, 2017

@lock

This comment has been minimized.

Copy link

@lock lock bot commented May 3, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators May 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.