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

Use uWebSocket.js encrease I/O productivity few times #310

Open
mrlika opened this issue Feb 13, 2019 · 6 comments
Open

Use uWebSocket.js encrease I/O productivity few times #310

mrlika opened this issue Feb 13, 2019 · 6 comments

Comments

@mrlika
Copy link

mrlika commented Feb 13, 2019

P2P technologies should be scalable and efficient when it goes to high loads.

The goal is to rewrite the code to be able to use uWebSockets.js HTTP/HTTPS/WebSocket server as an option for HTTP I/O. At least to refactor the code to use the maximum of the logic from this project in a new tracker project that will be based on uWebSockets.js I/O.

This article and this one describe how uWebSockets.js is a few times more efficient in I/O than any other Node.js solutions and even C/C++/Golang solutions. Also, it will lead to the use of the built-in uWebSockets.js HTTPS support and remove the need for Nginx in front of the tracker.

The performance of µWebSockets is in most cases what you would expect from an efficient server software. In some cases, especially small messages, the difference in performance can be dramatical (10 - 15x). Because of the nature of WebSocket messages (they are mostly very small at sub 1kb), this plays a major role in performance.

The benefit is that public and private trackers will be able to serve a few times more peers.

It will help to solve #308, #299, #269 (uWebTorrent tracker is written using uws and uWebSockets.js is the successor of it written by the same author) and other related issues.

@Vladislavik
Copy link

Will be good 👍

@DiegoRBaquero
Copy link
Member

It's good to have it back, didn't know it was already publicly released with binaries, had checked 2 weeks back. Will implemented in uwt soon. Or if @feross agrees, just merge all back into this module using uWebSockets

@mrlika
Copy link
Author

mrlika commented Feb 13, 2019

Great! @DiegoRBaquero please keep in mind HTTPS support. Using Nginx as HTTPS proxy in front of the tracker may dramatically decrease I/O productivity.

@mrlika
Copy link
Author

mrlika commented Feb 27, 2019

We decided to create our own open source high-performance implementation of WebTorrent tracker using uWebSockets.js: https://github.com/Novage/wt-tracker

It can handle 100k peers (no SSL) using 1.2Gb of memory and 50% of a single CPU core.

@github-actions
Copy link

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

@Bruce-Hopkins
Copy link
Contributor

Is this relevant? If so, can implement this enhancement?

I'm not sure if uWebSockets.js has compatibility with all systems. Should we implement this as an additional option for ws or a replacement?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants