Giter Site home page Giter Site logo

p2psp / simulator Goto Github PK

View Code? Open in Web Editor NEW
18.0 18.0 18.0 48.26 MB

A complete stand-alone simulator for the P2PSP protocol

License: GNU General Public License v3.0

Python 93.41% Shell 5.13% Gnuplot 0.40% Makefile 1.06%
network-analysis network-visualization p2p p2psp python3 research-project simulator

simulator's Introduction

Welcome to the Peer-to-Peer Straightforward Protocol (P2PSP) Project!

Join the chat at https://gitter.im/P2PSP/p2psp

P2PSP is a protocol for the streaming of real-time video/audio sequences on Peer-to-Peer (P2P) networks. In this repository you can find an implementation.

This is a description of the files/directories:

  • doc: information about compiling, using, etc. P2PSP.

  • README.md: this file.

  • src: the implementation.

  • tools: some useful scripts.

More information about the protocol at:

Thanks for downloading the P2PSP and happy broadcasting!

The P2PSP team.

simulator's People

Contributors

cristobalmedinalopez avatar jpramez avatar lsg945 avatar prayassahni avatar sachinsngh165 avatar sergio-gps avatar vicente-gonzalez-ruiz avatar vishwasmittal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

simulator's Issues

missing .gitignore

.gitignore file is missing so, there is always a possibility of adding unwanted files (like .pyc or venv) to the git file tree.

Implementation of a Vorbis/Theora transcoder for Scalable Coding

Similarly to #51, a Scalable Video Coding (SVC) transcoder could improve the performance in variable-bandwidth scenarios. In this case, the forward transcoder would input an OGG stream and output a number of layers (OGG streams), each one presenting a different level of a Laplacian Pyramid.

The inverse transcoder would reconstruct the original OGG sequence (or an approximation of it) using all (or a smaller number of) layers.

Feeding the simulator with a real source

At this moment, we simulate that the chunks of stream are received by the splitter, at a chunk-rate controlled by a sleep(). In the current implementation, the chunks are "empty" (only a single character is transmitted). This is quite simple, but the simulation times are not accurate.

The splitter, as in a real situation, should be fed by an Icecast or VLC instances. The chunks should be transmitted.

We can control the number of transmitted chunks per second by changing the chunk size and the stream bit-rate (using, for example, stream with different bit-rates).

Implementation of a Vorbis/Theora transcoder for Multiple Description Coding

Multiple Description Coding (MDC) is a coding technique that can improve real-time communications in variable-bandwidth transmission contexts. On the other hand, the Multi-Channel Set (MCS) can be used to receive more than one stream simultaneously.

In this scenario, an forward MDC transcoder would input an OGG stream and output so many OGG streams as descriptions. A good starting point can subsample the images using a simple pattern:

+---+---+
| a | b |
+---+---+
| c | d |
+---+---+

if a, b, c and d are neighbor pixels of an image, description (images) A would be formed only by the pixels a, description B only by b pixels and so on.

The inverse MDC transcoder would compose the original resolution of the video using one or more descriptions (missing descriptions should be interpolated).

Avoding burst mode in peers

Using a list of destinations (peers) for every received chunk and indexed by the origin peer of such chunk, it can be possible to send more than one chunk for every received chunk in those situations where peers, by a requirement of the topology, must send more than they receive.

This issue should be implemented in branch "avoding_burst_mode".

Lost data recovery system using error correction codes

The communication channels that we use is not a reliable source of transmission. It is common that the data received after the transmission is changed. This is mainly due to the introduction of noise during the transmission of the message.

This problem can be solved by using a technique called Forward Error Correction. Here, the message is encoded in a redundant way using an error correcting code. The redundancy enables the receiver to detect some of the errors that may occur anywhere in the message, and often to correct these errors without retransmission of data from the source.

Reed-Solomon is one of the oldest algorithms used for this purpose. This process encodes a message of length k into a codeword of length N (>k). Any combinations of k words received can be used to recover the complete data. This process to transmit data with increased reliability over the transmission channel.

More info can be found out on Wikiversity

A peer should be able to send the chunks to more than one player

In the current version of the protocol, one peer only can serve to one player (notice the data flow is controlled by the source, not by the peers or the players). It would be interesting that a peer can serve to more than one player (again, the data flow should be only controlled by the source).

Add examples to README.md

IMHO it would be better if the documentation had some sample examples for using the simulator, so that new-comers can get a better understanding of how it works and also the source code.

Implementation of a splitters synchronizer

Issue #48 introduces a new entity which is able to synchronize two or more streams.

This issue proposes an alternative (and probably much more efficient) way of obtaining the same result. In this case (as it is explained in the MCS layer) if the splitters conform the chunks exactly with the same content, two or more peers (or a peer with the ability of retrieve chunks from more than a team). For achieving this, the load-balancer should provide instructions to the splitters to be synchronized.

Some useful code can be found here: https://github.com/P2PSP/console/blob/master/src/synchronizer.cc

IndexError when it draws in real time

A IndexError occurs randomly in the draw function when it is drawing in real time (while it is simulating).
It could be because it reads a new line when the line is not fully written, so it splits something in a wrong way, causing that m doesn't have a correct format (there are missing elements).

Now it is catched, but with no action. Maybe we could repeat the reading of the same line in this case.

Peer lists sorted by RTT

Now, lists of peers are sorted by the order the incoming peers join the team. This implies that the first peers to join will be the first peers to be served by the rest of peers when a chunk is received from the splitter, and the last peers to arrive, the last peers to be served and the peers that will be served in the burst mode with the highest probability (something that can produce network congestion in the downloading link of these peers).

To solve this, peers could sort their list of peers using, for example, the RTT to each of the peers of their lists. This RTT can be computed using a heartbeat mechanism.

The branch associated with this issue is "peerlist_sorted_by_RTT".

Console/graphical isolation

Currently, simulator.py imports mathplotlib even if the graphical output has not been activated. It would be useful if two different scripts were available (simulate.py and play.py, for example) in order to avoid using it in those systems where matplotlib has not been sucessfully ported.

Problem with Matplotlib version 2.1.0

When version 2.1.0 of Matplotlib is installed, there is a problem with the graphics generator.
The chart generated at the end of the simulation is shown empty.
In version 2.0.0 there is no problem.
This is the detailed bug:

2017-12-31 13:50:37,730 - __main__ - CRITICAL - Critical messages enabled.
2017-12-31 13:50:37,730 - __main__ - ERROR - Error messages enabled.
Traceback (most recent call last):
  File "simulator.py", line 482, in <module>
    fire.Fire(Simulator)
  File "/home/billy/.local/lib/python3.5/site-packages/fire/core.py", line 127, in Fire
    component_trace = _Fire(component, args, context, name)
  File "/home/billy/.local/lib/python3.5/site-packages/fire/core.py", line 366, in _Fire
    component, remaining_args)
  File "/home/billy/.local/lib/python3.5/site-packages/fire/core.py", line 542, in _CallCallable
    result = fn(*varargs, **kwargs)
  File "simulator.py", line 349, in draw
    self.update_team(m[1], m[2], m[3])
  File "simulator.py", line 202, in update_team
    self.team_ax.draw_artist(self.lineMonitors)
  File "/usr/local/lib/python3.5/dist-packages/matplotlib/axes/_base.py", line 2453, in draw_artist
    a.draw(self._cachedRenderer)
  File "/usr/local/lib/python3.5/dist-packages/matplotlib/artist.py", line 55, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/matplotlib/lines.py", line 744, in draw
    self.recache()
  File "/usr/local/lib/python3.5/dist-packages/matplotlib/lines.py", line 657, in recache
    xconv = self.convert_xunits(self._xorig)
  File "/usr/local/lib/python3.5/dist-packages/matplotlib/artist.py", line 191, in convert_xunits
    return ax.xaxis.convert_units(x)
  File "/usr/local/lib/python3.5/dist-packages/matplotlib/axis.py", line 1491, in convert_units
    ret = self.converter.convert(x, self.units, self)
  File "/usr/local/lib/python3.5/dist-packages/matplotlib/category.py", line 49, in convert
    vmap = dict(zip(axis.unit_data.seq, axis.unit_data.locs))
AttributeError: 'NoneType' object has no attribute seq

DBS2

DBS2 is a simple extension of DBS where peers can create alternative paths for those chunks that do not arrive from a known origin peer.

When a peer detects a lost chunk, it requests it to one of the peers that is in its list of peers. The selected peer should be chosen at random among those peers that have a chunk debt smaller than a given threshold.

The branch associated with this issue is "dbs2".

To Move the work of painting graphs to different processes.

Painting the network overlay graphs is heavy. Could be a good idea to move the work of painting each graph to one differnte process? Would be a better idea to replace matplotlib with another way for painting graphs in real time (something faster)?

PyQT/play.py KeyError when update_buffer was called

I got the following KeyError:

File "PyQt/play.py", line 274, in draw
    self.update_buffer(m[1], m[2])
  File "PyQt/play.py", line 175, in update_buffer
    ix = self.buffer_order[sender]
KeyError: '127.0.1.1,47525'
Violación de segmento

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.