Coder Social home page Coder Social logo

Comments (12)

mrlika avatar mrlika commented on May 18, 2024

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.

from p2p-media-loader.

Er-rchydy avatar Er-rchydy commented on May 18, 2024

@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>

from p2p-media-loader.

mrlika avatar mrlika commented on May 18, 2024

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.

from p2p-media-loader.

Er-rchydy avatar Er-rchydy commented on May 18, 2024

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 )

from p2p-media-loader.

mrlika avatar mrlika commented on May 18, 2024

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.

from p2p-media-loader.

Er-rchydy avatar Er-rchydy commented on May 18, 2024

@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.

from p2p-media-loader.

mrlika avatar mrlika commented on May 18, 2024

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

from p2p-media-loader.

Er-rchydy avatar Er-rchydy commented on May 18, 2024

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.

from p2p-media-loader.

mrlika avatar mrlika commented on May 18, 2024

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.

from p2p-media-loader.

Er-rchydy avatar Er-rchydy commented on May 18, 2024

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

from p2p-media-loader.

f1l1b0x avatar f1l1b0x commented on May 18, 2024

@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

from p2p-media-loader.

Er-rchydy avatar Er-rchydy commented on May 18, 2024

@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

from p2p-media-loader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.