9 Lab 3: Scaling with P2PSP

9.1 Download P2PSP

wget https://github.com/P2PSP/p2psp/archive/master.zip  
unzip master.zip  
# A directory named "p2psp-master" should appear.  
rm master.zip

9.2 Splitter

  1. Select a mount-point in any of the available Icecast servers. Lets suppose that you have picked a mount-point named test.ogg at your local server, which is listening to the port 8000. Therefore, the channel you are going to stream in your P2PSP team is:

    http://localhost:8000/test.ogg

    This is the so called channel in the P2PSP’s jargon. Each team broadcasts only one channel.

  2. Check if the splitter has been correctly installed by checking the default values for the input (command line) parameters:
     
    cd p2psp-master/src  
    python3 splitter.py -h

  3. Notice that, in order to connect the splitter as a listener to the icecast server, both, the source_addr and the source_port could need to be specified. In our case, we are using a server running in our host and listening to the port 8000, which are the default values for the splitter. So, we run:
     
    python3 splitter.py  
     
    # Note, if the splitter fails, check that your /etc/hosts file contains a line such as:  
    #  
    # "127.0.0.1 localhost.localdomain localhost       your_hostname_here

    Now, your terminal should show something like:

    10:54:49 Running in debug mode  
    10:54:49 My IP address is = 127.0.0.1  
    10:54:49 Buffer size = 256  
    10:54:49 Channel = "test.ogg"  
    10:54:49 Chunk size = 1024  
    10:54:49 Header size = 10  
    10:54:49 Listening port = 4552  
    10:54:49 Source address =  127.0.0.1  
    10:54:49 Source port = 8000  
    10:54:49 IP unicast mode selected  
    10:54:49 Maximun chunk loss = 32  
    10:54:49 Maximun number of monitor peers = 1

    10:54:49 IMS: Buffer size (in chunks) = 256  
    10:54:49 IMS: Chunk size (in bytes) = 1024  
    10:54:49 IMS: Channel =" test.ogg "  
    10:54:49 IMS: Header size (in chunks) = 10  
    10:54:49 IMS: Listening (and multicast) port = 4552  
    10:54:49 IMS: Source IP address = 127.0.0.1  
    10:54:49 IMS: Source port = 8000  
    10:54:49 IMS: Multicast address = 0.0.0.0  
    10:54:49 IMS: Initialized

    10:54:49 DBS: max_chunk_loss = 32  
    10:54:49 DBS: mcast_addr = 0.0.0.0  
    10:54:49 DBS: Initialized

    10:54:49 IMS: Requesting the stream header ...

             | Received  | Sent      | Number       losses/ losses  
        Time | (kbps)    | (kbps)    | peers (peer) sents   threshold period kbps  
    ---------+-----------+-----------+-----------------------------------...

    10:54:49 IMS: (’0.0.0.0’, 0) connecting to the source (’127.0.0.1’, 8000) ...  
    10:54:49 IMS: (’127.0.0.1’, 60576) connected to (’127.0.0.1’, 8000)  
    10:54:49 IMS: (’127.0.0.1’, 60576) IMS: GET_message = GET /test.ogg HTTP/1.1  
     
     
    10:54:49 IMS: Stream header received!

    10:54:49 DBS: (’0.0.0.0’, 4552): waiting for the monitor peers ...

    10:54:50 |         0 |         0 | 0  
    10:54:51 |         0 |         0 | 0  
    10:54:52 |         0 |         0 | 0

    At this moment, the splitter is waiting for the monitor peer, and the rest of “normal” peers.

9.3 Monitor

  1. Test whether the peer is appropiately installed:
     
      python3 peer.py -h

  2. If yes, start the monitor:
     
      python3 peer.py

    An output such as:

    22:06:08 Running in debug mode  
    22:06:08 Splitter address = 127.0.0.1  
    22:06:08 Splitter port = 8001  
    22:06:08 (Peer) PORT = 0  
    22:06:08 Listening port (player) = 9999  
    22:06:08 Maximun chunk debt = 128

    22:06:08 IMS: Player port = 9999  
    22:06:08 IMS: Splitter = 127.0.0.1  
    22:06:08 IMS: (Peer) port = 0  
    22:06:08 IMS: Initialized  
    22:06:08 IMS: Waiting for the player at (’0.0.0.0’, 9999)

    should be displayed.

    By default, peers (including monitors) will connect to the splitter at localhost:8000, that is the end-point where the splitter is listening to if these parameters were not specified.

  3. Finally, run a player that will produce that the monitor will start receiving chunks from the splitter:

    vlc http://localhost:9000 &

    By default, all peers serve the stream at localhost:9999.

9.4 Grow the team

  1. Run many peers as you want. All of them will be a part of the same team as long as they use the same splitter. If you check the output of the splitter, you will notice that the splitter always sends only one copy of the stream.

9.5 I need more, More, MORE, ..!

  1. Go to:
    1. P2PSP’s home page.
    2. P2PSP’s code site at GitHub.