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

Can you please add some download and upload to the demos ? #6

Closed
Er-rchydy opened this issue Sep 7, 2018 · 12 comments
Closed

Can you please add some download and upload to the demos ? #6

Er-rchydy opened this issue Sep 7, 2018 · 12 comments

Comments

@Er-rchydy
Copy link

Can you please add something that shows how much download and upload every peer made to the other demos ( like this demo ) without graphs, a simple div that got updated every 5 seconds for example would be helpful.
because even if you enable debugging there are lot of informations, where sometimes you want just to see the performance ( p2p download vs http download ).
thanks for the great library

@mrlika
Copy link
Member

mrlika commented Sep 7, 2018

We already have this information in our big demo:

Git: https://github.com/Novage/p2p-media-loader/tree/master/p2p-media-loader-demo
Hosted: http://novage.com.ua/p2p-media-loader/demo.html

Small demos (like this demo) are intended to be as simple as possible and you are free to copy them and extend for your needs.

@Er-rchydy
Copy link
Author

Er-rchydy commented Sep 7, 2018

@mrlika yes i saw the big demo, but if someone want to test the performance with big number of users is not going to use the big demo, and put it in his website for like 20k users you know what i mean.
i don't know how to add it myself, can you show us what we should add in this code to console how much data has been transferred via P2P vs HTTP

<script>
        if (p2pml.hlsjs.Engine.isSupported()) {
            var engine = new p2pml.hlsjs.Engine();
            var player = new Clappr.Player({
                parentId: "#video",
                source: "https://akamai-axtest.akamaized.net/routes/lapd-v1-acceptance/www_c4/Manifest.m3u8",
                hlsjsConfig: {
                    liveSyncDurationCount: 7, // To have at least 7 segments in queue
                    loader: engine.createLoaderClass()
                }
            });
            p2pml.hlsjs.initClapprPlayer(player);
            player.setVolume(1); // 1%
            player.play();
            this.engine.on(p2pml.core.Events.PieceBytesDownloaded, this.onBytesDownloaded.bind(this));
            this.engine.on(p2pml.core.Events.PieceBytesUploaded, this.onBytesUploaded.bind(this));            
        } else {
            document.write("Not supported :(");
        }
    </script>

@mrlika
Copy link
Member

mrlika commented Sep 8, 2018

For this particular demo you can do it like this (better before calling play):

engine.on(p2pml.core.Events.PieceBytesDownloaded, (method, bytes) => {
  console.log('download', method, bytes);
});

engine.on(p2pml.core.Events.PieceBytesUploaded, (method, bytes) => {
  console.log('upload', method, bytes);
});

You can modify the code to summarize total P2P and HTTP or, for 20k viewers, it is better to send the statistics somewhere to be stored for further analytics.

@Er-rchydy
Copy link
Author

ok thanks, i have one more question.
what are the of a server specifications (bandwidth, cpu, ...) that i will need to test this library for 20k viewers with non HD video i will test it with 520p ? ( and if you have some hosting suggestions, cheapest once because you know i'm doing this just for testing purposes )

@mrlika
Copy link
Member

mrlika commented Sep 9, 2018

On the server side the library uses webtorrent tracker. It just exchanges peer connection information (like a torrent tracker). It doesn't deal with data that is sent between peers so video size doesn't matter:

https://github.com/webtorrent/webtorrent
or
https://github.com/DiegoRBaquero/uWebTorrentTracker

By default public webtorrent trackers are used but I think for your 20k users swarm you should run your personal webtorrent tracker and configure it with the library.
Webtorrent tracker doesn't require much CPU and bandwith.

@Er-rchydy
Copy link
Author

@mrlika sorry i forgot to mention i wasn't talking about the tracker, i meant what's server's requirements (bandwidth, cpu, line ...) to serve the actual live video. for the tracker i can use just azure or something.

@mrlika
Copy link
Member

mrlika commented Sep 9, 2018

Tracker should not use a lot of CPU and bandwidth but I didn't test it with 20k users.

@Er-rchydy
Copy link
Author

ok thanks, i was just wondering if you have some informations about the required server to serve a video 520p to that number of users ( again not talking about the tracker, i'm talking about rtmp server ).
it's weird i searched about it for hours but i didn't find an article or someone talks about server requirements to serve live video to a lot of users.

@mrlika
Copy link
Member

mrlika commented Sep 10, 2018

P2P Media Loader doesn't support RTMP. It supports segmented streams: HLS and DASH.

To host HLS or DASH you need HTTP server and you have to calculate bandwidth, CPU requirements of your HTTP server and CPU requirements of software that generates the stream (i.e. transcoding etc.)

But if you do not have horizontally scalable HTTP servers infrastructure I recommend for the 20k users test use a CDN and deliver HLS/DASH stream using it.

Because if your stream is 1 Mbps for 20k users in worst case they will download with 20 Gbps speed.

@Er-rchydy
Copy link
Author

@mrlika ok thanks, do you have any cheap CDN suggestions ?

@f1l1b0x
Copy link

f1l1b0x commented Sep 11, 2018

@Er-rchydy check out wowza cloud they are using akamai and will allow you to use their cdn for 20.000 concurrent without any annual commitment but pay as you go

@Er-rchydy
Copy link
Author

@f1l1b0x thanks, do you have any idea about how much it would cost, because i'm doing this for testing purposes.
example: video: 520p fixed, live for 2 hours, 20.000 visitors watching the whole live at the same time, how much it would cost at this scenario, average price of course

@mrlika mrlika closed this as completed Nov 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants