almgong / NDNOverWifiDirect

1 stars 0 forks source link

Daisy chaining is too slow for video #12

Closed almgong closed 7 years ago

almgong commented 7 years ago

The ratio of getFromBuffer and addToBuffer is far too large - we should instead have a tcp window-like implementation that allows you to have x standing interests tasks running in parallel, that pieces together the data before putting into the buffer

[x][x][ ][x] should wait for the 3rd element -> once it comes add all 4 in succession, etc.

almgong commented 7 years ago

Dumb, simple way


Adaptive way

One way: Circular arrays

almgong commented 7 years ago

Another way

Coupled circular array

I like this option the best due to its simplicity (and avoidance of any parallel data structures).

almgong commented 7 years ago

Some skeleton outline for coupled circular array:

loop indefinitely:

  1. for all open slots, send interests
  2. onData for each interest, put the data portion into the appropriate slot - if any of the data portion has the EOF_FLAG stop outer loop
  3. Sleep (wait) for some time, say 1 second
  4. Call send to buffer method
  5. return to loop
  6. on outer loop break, check one last time to make sure that the circular array is emptied (possibly via an instance method) - if not, send all data to buffer
almgong commented 7 years ago

Daisy chaining is actually FASTER with my device, as my device(s) are weaker...

However I think it may be an issue wherein the overhead of creating async tasks overwhelm the benefits of parallelism. We should implement a thread (or a service) that does this...

almgong commented 7 years ago

Implementation of above at: b7d9e57

almgong commented 7 years ago

On second thought, it is very difficult for window to work in a single thread (because we need to sleep in between processEvents() calls (it would kill performance otherwise)... And this alone would defeat the purpose...

So for now, implementing for daisy chaining for benchmarking purposes.

almgong commented 7 years ago

No benefit from using another thread -- avgs 500ms perpacket regardless...

almgong commented 7 years ago

For now, we cannot proceed further on #14 because of the network and device limitation... Best approximation is simply being able to buffer media from multiple devices, and therefore waiting on your own end to watch a video.

This being said, we can still implement seek on consumer end, which will update the seq num appropriately.

almgong commented 7 years ago

Just tried reducing the processEvents timer to ~100ms each, speed improved drastically.

Daisy chaining is a fine method.