Scaling BBC Streaming Concepts, Current Research, Future Goals,  Michael Sparks BBC R&D [email_address]
Streaming at the BBC <ul><li>Peak is around 40-50K concurrent streams </li></ul><ul><li>Both live & on-demand </li></ul><u...
Caveat! <ul><li>Very mixed talk! </li></ul><ul><li>Lots relating to current work </li></ul><ul><li>Some blue sky/where nex...
Caveat! <ul><li>No really, this might be death by powerpoint </li></ul><ul><ul><li>Even though powerpoint never came near ...
What is Scalability? <ul><li>Practical definition: </li></ul><ul><ul><li>Predictability and affordability when systems get...
Common Techniques <ul><li>Server Software: </li></ul><ul><li>At operating system level, optimise threading, processes, sch...
Areas Under Research <ul><li>Alternative concurrency models </li></ul><ul><ul><li>Modern language primitives </li></ul></u...
Scaling & Software Cost <ul><li>Writing out own  testbed  server </li></ul><ul><li>platform </li></ul><ul><li>Unencumbered...
Scaling & Software Cost <ul><li>Dirac </li></ul><ul><ul><li>Was in prototype stage when MPEG 4 costs initially bandied abo...
Scaling Network Systems <ul><li>Get the network to distribute your content </li></ul><ul><li>We've been working to get mul...
Kamaelia <ul><li>Kamaelia is the name of our in-house testbed media server project </li></ul><ul><li>Uses a rather differe...
Other aspects to be covered <ul><li>Protocol scalability </li></ul><ul><ul><li>RTP is well designed for VoIP, not aimed pr...
Scaling BBC Streaming <ul><li>20 million homes, 700,000 hours of video/audio (approx) </li></ul><ul><li>Everyone watching ...
Bandwidth issues <ul><li>Digital TV: </li></ul><ul><ul><li>20000000*5Mbits = 100Tbit/s </li></ul></ul><ul><ul><li>Quality ...
Number of Servers <ul><li>Assume servers are capable of flatlining their network card. (Rare) </li></ul><ul><li>Assume 1Gb...
Physical Space Requirements <ul><li>7400 servers </li></ul><ul><ul><li>1U servers, 42U racks – 176 racks ~ 300 sq m </li><...
Legal Issues <ul><li>We don't own all rights outright </li></ul><ul><li>Rights need tracking and to be protected </li></ul...
Scaling Internet Costs <ul><li>Software fees often related to audience size/number of servers  </li></ul><ul><li>Can we gr...
Here to Stay <ul><li>BBC TV is 5 decades old (or so) </li></ul><ul><li>BBC Radio is 8 decades old </li></ul><ul><li>Mainte...
Hidden Assumptions <ul><li>Linear scalability at worst case </li></ul><ul><li>Moore's law & its variations continue to ope...
Measuring Cost <ul><li>Lots of literature about measuring algorithm and system cost </li></ul><ul><ul><li>3 key results </...
License & Standards “Costs” <ul><li>F/OSS is fixed software cost for any problem size </li></ul><ul><li>Proprietary softwa...
Protocol Cost – Example ICP <ul><li>Internet Cache Protocol is used by web caches to query others for misses </li></ul><ul...
Protocol Cost: Example RTCP <ul><li>Feedback mechanism in RTP </li></ul><ul><li>Scarce resource issue </li></ul><ul><li>Mu...
So What? <ul><li>Bandwidth costs will be offset if others redistribute our content </li></ul><ul><ul><li>Better for us to ...
What are we working on? <ul><li>2 main projects are working on scaling distribution </li></ul><ul><li>Kamaelia is focused ...
Server Architectures <ul><li>Lots of concurrent connections </li></ul><ul><li>Scalability often driven by concurrency choi...
OS Concurrency <ul><li>Used by Apache & Inetd </li></ul><ul><ul><li>Scales fairly well - on some operating systems better ...
Manual Concurrency <ul><li>Most commonly used approach for building scalable servers </li></ul><ul><ul><ul><li>Unless our ...
Language Based Concurrency <ul><li>Not many languages support this approach </li></ul><ul><ul><li>Hence not commonly used ...
Kamaelia: Architecture <ul><li>Single threaded, select based concurrency through language support </li></ul><ul><ul><li>Co...
Python Generators 1 <ul><li>These are used as the base concurrency mechanism. example: def fib(base1, base2):   while True...
Python Generators 2 <ul><li>More complex usage >>> fibs=[fib(0,i) for i in range(10)] >>> for i in range(10):  ...  print ...
Python Generators 3 <ul><li>Look like normal functions, but actually return generator objects </li></ul><ul><ul><li>yield ...
Generators – Issues, Solutions <ul><li>No means of communication – only globals and initial arguments </li></ul><ul><li>Ca...
Wrapping Generators <ul><li>Many ways, this is simplest, we use a slightly more complex approach. Utility functon: </li></...
Wrapping Generators - 2 <ul><li>Suppose we wish to allow the following behaviour: </li></ul><ul><ul><li>We communicate onl...
Sample Behaviour <ul><li>Details aren't important, just the fact this is simple to code: </li></ul><ul><li>class com(objec...
Sample Wrapped Generator <ul><li>@wrapgenerator(com) def forwarder(self):   &quot;Simple data forwarding generator&quot;  ...
Essentials of Kamaelia's Components <ul><li>Generators with named in/out-boxes </li></ul><ul><li>Linkages join outboxes to...
Kamaelia: Building Communication <ul><li>Linkages are tied to the substructure of a component, and are formed via a method...
Scheduling Generators <ul><li>Our (simplified) scheduler is trivial:   while(self.running):   for mprocess in self.threads...
Postman Logic <ul><li>The postman is a generator </li></ul><ul><ul><li>One per component.  </li></ul></ul><ul><ul><li>It g...
Co-ordinating Assistant Tracker <ul><li>Provides book-keeping and service lookup </li></ul><ul><ul><li>Services are (compo...
Writing Servers Using Generators <ul><li>We have components for: </li></ul><ul><ul><li>Listening for new connections </li>...
Note regarding Code Examples <ul><li>Please don't try to read everything! </li></ul><ul><ul><li>I'm going to largely whisk...
Listening for connections <ul><li>@wrapgenerator(component,  queues=[&quot;DataReady&quot;, &quot;_csa_feedback&quot;,&quo...
Listening for connections 2 <ul><li>Handle closed connection messages </li></ul><ul><li>if self.dataReady(&quot;_csa_feedb...
Listening for Connections 3 <ul><li>Handle new connection messages </li></ul><ul><li>if self.dataReady(&quot;DataReady&quo...
Listening for Connections 4 <ul><li>Everything on one slide: (too small to read probably) @wrapgenerator(component, queues...
Handling active connections <ul><li>@wrapgenerator(component, queues=[&quot;DataReady&quot;, &quot;DataSend&quot;, &quot;c...
Protocol handling <ul><li>Depends on protocol. This implements an echo protocol. Note: we've seen this today! </li></ul><u...
Select  Based Connection Tracking <ul><li>@wrapgenerator(AdaptiveCommsComponent,  queues=[&quot;inbox&quot;, &quot;control...
Connection Tracking 2 <ul><li>handle notify messages if self.dataReady(&quot;notify&quot;):   msg = self.recv(&quot;notify...
Connection Tracking 3 <ul><li>handle readable socket   (feedbackInboxName, signalOutboxName,   theComponent) = self.lookup...
Building a Generic Server <ul><li>The example that follows is that of a generic server.  </li></ul><ul><ul><li>You provide...
Building a Generic Server 2 <ul><li>@wrapgenerator(AdaptiveCommsComponent,    queues=[&quot;_oobinfo&quot;]) def SimpleSer...
Building a Generic Server 3 <ul><li>handle messages received via _oobinfo   if self.dataReady(&quot;_oobinfo&quot;):   dat...
Building a Generic Server 4 <ul><li>handling closed connections </li></ul><ul><li>def handleClosedCSA(self,data):   CSA = ...
Building a Generic Server 5 <ul><li>handling closed connections def handleNewCSA(self, data):   CSA = data.object   pHandl...
Interlude <ul><li>The code on the preceding slides is the core code for a scalable server which can accept more or less an...
Implementing A TCP Client <ul><li>The real question is how much reuse can we get in a network  client ? </li></ul><ul><li>...
Implementing A TCP Client 2 <ul><li>@wrapgenerator(AdaptiveCommsComponent, queues=[&quot;_oobinfo&quot;]) def TCPClient(se...
Implementing A TCP Client 3 <ul><li>Setup CSA </li></ul><ul><li>def setupCSA(self, sock):   CSA = ConnectedSocketAdapter(s...
Implementing A TCP Client 4 <ul><li>Safe Connect (not so safe – error handling removed(!)...)   def safeConnect(self, sock...
Implementing A TCP Client 5 <ul><li>Wait CSA Close </li></ul><ul><li>if self.dataReady(&quot;_socketFeedback&quot;): </li>...
Notes About the TCP Client <ul><li>Not really that much simpler than a TCP server really </li></ul><ul><ul><li>Corrollary:...
Some Key Results <ul><li>Individual components : Simple.  </li></ul><ul><li>Complex systems via controlled composition </l...
Some Key Results <ul><li>Protocol implementation can be done independent of network code </li></ul><ul><li>Provides a tool...
Less Obvious Stuff <ul><li>Owning the code allows us to ship the server in the client </li></ul><ul><li>Lightweight nature...
More Less Obvious Stuff <ul><li>Interesting possibility: </li></ul><ul><ul><li>Client tuner utility with embedded RTSP/RTP...
Kamaelia: Ongoing Work <ul><li>Lots of things to do: </li></ul><ul><ul><li>Integration of RTP/RTSP components </li></ul></...
RTP is not a Streaming Protocol <ul><li>RTP isn't designed for unidirectional streaming.  </li></ul><ul><ul><li>Does somet...
RTP For Streaming <ul><li>Everyone (?) who does open standards streaming and doesn't do HTTP does RTP </li></ul><ul><li>Wh...
What problem does streaming solve?
What problem does streaming solve? <ul><li>Audio/Video delivery?  </li></ul><ul><li>Quickest way of delivery? </li></ul><u...
What problem does streaming solve? <ul><li>Audio/Video delivery?  </li></ul><ul><ul><li>No, HTTP downloading handles that ...
Characteristics of streaming? <ul><li>Capped bitrate connection </li></ul><ul><ul><li>Expected to stay at that capped bitr...
What problem does streaming solve? <ul><li>OK, an answer: </li></ul><ul><ul><li>Timely delivery of content down pipes norm...
Observations <ul><li>High compression, packet loss == unwatchable video </li></ul><ul><li>Buffering common to mask transpo...
Observations 2 <ul><li>If bitrate >> capacity of link - why deny access - which not allow switch to maximum speed download...
Good Transport Protocol Aspects <ul><li>Content agnostic - you can send  anything </li></ul><ul><li>Fully defines all aspe...
RTP Problems (for streaming) <ul><li>Half a transport protocol </li></ul><ul><ul><li>Doesn't define how to send  anything ...
RTP Problems (for streaming) <ul><li>Time based, not content based </li></ul><ul><li>RTCP has issues  large  multicast gro...
P2P Issues <ul><li>Unknown quantity really. No, really.  </li></ul><ul><ul><li>Remember we're after how to serve ~ 7Tbit/s...
P2P Issues 2 <ul><li>How do ensure producers of art get paid? </li></ul><ul><ul><li>We all want the &quot;next Matrix&quot...
P2P Issues 3 <ul><li>Copyright infringement isn't really a P2P issue </li></ul><ul><ul><li>P2P makes it simpler because P2...
P2P Issues 4 <ul><li>It's a social responsibility issue. </li></ul><ul><li>We can choose to define protocols that will adh...
Need for simpler Media Storage <ul><li>RTP has to understand every media wrapper, and often codec details </li></ul><ul><l...
Simpler Media Storage <ul><li>Rather than leave content unchanged, why not stuff it into a standard format? </li></ul><ul>...
Simpler Server Storage <ul><li>One obvious approach: </li></ul><ul><ul><li>Define in header “this is maximum bit rate”, “t...
 
Need for a New Streaming Protocol <ul><li>Wish list (partial): </li></ul><ul><ul><li>Transmission between a/v caches </li>...
Need for a New Streaming Protocol <ul><li>Wish list (partial): (cont) </li></ul><ul><ul><li>Provide mechanisms for arbitra...
Copyright License <ul><ul><ul><li>This presentation is part of the Kamaelia Project, and was presented at Firenze World Vi...
Upcoming SlideShare
Loading in …5
×

Scaling Streaming - Concepts, Research, Goals

1,397 views

Published on

This was a talk, largely on Kamaelia & its original context given at a Free Streaming Workshop in Florence, Italy in Summer 2004. Many of the core
concepts still hold valid in Kamaelia today

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,397
On SlideShare
0
From Embeds
0
Number of Embeds
33
Actions
Shares
0
Downloads
51
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Scaling Streaming - Concepts, Research, Goals

  1. 1. Scaling BBC Streaming Concepts, Current Research, Future Goals, Michael Sparks BBC R&D [email_address]
  2. 2. Streaming at the BBC <ul><li>Peak is around 40-50K concurrent streams </li></ul><ul><li>Both live & on-demand </li></ul><ul><li>Small audience by BBC standards </li></ul><ul><ul><li>Want to enable larger services, cost effectively </li></ul></ul><ul><li>Real, because it's cross platform </li></ul><ul><ul><li>BBC prefers open standards/platforms </li></ul></ul>
  3. 3. Caveat! <ul><li>Very mixed talk! </li></ul><ul><li>Lots relating to current work </li></ul><ul><li>Some blue sky/where next </li></ul><ul><li>I'm aiming for high content ratio – means I might go fast </li></ul><ul><ul><li>Slides contain: lots of text since mixed audience; illustrative code to show key points – not actually from main codebase </li></ul></ul>
  4. 4. Caveat! <ul><li>No really, this might be death by powerpoint </li></ul><ul><ul><li>Even though powerpoint never came near this presentation, but hey </li></ul></ul>
  5. 5. What is Scalability? <ul><li>Practical definition: </li></ul><ul><ul><li>Predictability and affordability when systems get large </li></ul></ul><ul><li>Not just concerned with unit efficiency </li></ul><ul><li>However unit efficiency becomes important when you have scarce resources/big numbers </li></ul>
  6. 6. Common Techniques <ul><li>Server Software: </li></ul><ul><li>At operating system level, optimise threading, processes, schedulers </li></ul><ul><ul><li>Not portable by definition </li></ul></ul><ul><li>In applications build their own concurrency primitives </li></ul><ul><ul><li>State machines, event wheels, reactors </li></ul></ul><ul><ul><li>Can easily obfuscate the system </li></ul></ul>
  7. 7. Areas Under Research <ul><li>Alternative concurrency models </li></ul><ul><ul><li>Modern language primitives </li></ul></ul><ul><li>Alternative composition models </li></ul><ul><ul><li>The world is filled with concurrent systems relatively simple to understand: </li></ul></ul><ul><ul><ul><li>TVs, Radios </li></ul></ul></ul><ul><ul><ul><li>Clocks, Roads, Companies </li></ul></ul></ul><ul><ul><ul><li>Unix pipelines </li></ul></ul></ul>
  8. 8. Scaling & Software Cost <ul><li>Writing out own testbed server </li></ul><ul><li>platform </li></ul><ul><li>Unencumbered Licensing: </li></ul><ul><ul><li>(choice of LGPL, MPL, GPL) </li></ul></ul><ul><ul><li>To encourage take up of any experimental protocols, as per RFC </li></ul></ul><ul><li>Allows embedding in PVRs and clients </li></ul>
  9. 9. Scaling & Software Cost <ul><li>Dirac </li></ul><ul><ul><li>Was in prototype stage when MPEG 4 costs initially bandied about (initially prohibitively high) </li></ul></ul><ul><ul><li>Cost free, high quality codec </li></ul></ul><ul><ul><li>Theora was pre-alpha stage at this point </li></ul></ul><ul><li>Dirac and Theora complement each other, the more open codecs, the better </li></ul>
  10. 10. Scaling Network Systems <ul><li>Get the network to distribute your content </li></ul><ul><li>We've been working to get multicast deployed by UK ISPs to allow us to serve larger audiences at better quality for lower cost </li></ul><ul><li>Having our own server allows integration with effective P2P </li></ul><ul><ul><li>Long way off, but that's a goal </li></ul></ul>
  11. 11. Kamaelia <ul><li>Kamaelia is the name of our in-house testbed media server project </li></ul><ul><li>Uses a rather different architecture from other network servers </li></ul><ul><li>This talk covers it in as much detail as is practical in an hour </li></ul>
  12. 12. Other aspects to be covered <ul><li>Protocol scalability </li></ul><ul><ul><li>RTP is well designed for VoIP, not aimed primarily at unidirectional streaming </li></ul></ul><ul><ul><li>This causes problems </li></ul></ul><ul><li>Is Streaming the right thing? </li></ul><ul><ul><li>What sort of protocol do we really need? </li></ul></ul><ul><li>Social aspects of architecture and enabling participation. </li></ul>
  13. 13. Scaling BBC Streaming <ul><li>20 million homes, 700,000 hours of video/audio (approx) </li></ul><ul><li>Everyone watching something different? </li></ul><ul><li>Problems: </li></ul><ul><ul><li>Bandwidth, number of servers, physical space, legal issues, costs </li></ul></ul><ul><ul><li>Will be here for long term if a success </li></ul></ul><ul><li>What problem does streaming solve? </li></ul>
  14. 14. Bandwidth issues <ul><li>Digital TV: </li></ul><ul><ul><li>20000000*5Mbits = 100Tbit/s </li></ul></ul><ul><ul><li>Quality fairly predictable </li></ul></ul><ul><li>Comfortable DSL: </li></ul><ul><ul><li>20000000*370Kbit/s = 7.4 Tbit/s </li></ul></ul><ul><ul><li>Quality dependent on codec/content </li></ul></ul><ul><li>No single location will work </li></ul>
  15. 15. Number of Servers <ul><li>Assume servers are capable of flatlining their network card. (Rare) </li></ul><ul><li>Assume 1Gbit/s NICs </li></ul><ul><li>7.4Tbit/s / 1Gbit/s = 7400 servers </li></ul>
  16. 16. Physical Space Requirements <ul><li>7400 servers </li></ul><ul><ul><li>1U servers, 42U racks – 176 racks ~ 300 sq m </li></ul></ul><ul><li>Archive would be about 15,000 Terabytes </li></ul><ul><ul><li>Would fill a small building? </li></ul></ul><ul><ul><li>How practical? </li></ul></ul><ul><li>This is without redundancy – bad, numbers are underestimates </li></ul>
  17. 17. Legal Issues <ul><li>We don't own all rights outright </li></ul><ul><li>Rights need tracking and to be protected </li></ul><ul><li>Sample issues: </li></ul><ul><ul><li>Geographical distribution agreements, repurposing for internet, background music, background pictures, finding people </li></ul></ul><ul><li>Copyright will expire though – what then? </li></ul><ul><ul><li>NB. I am not a lawyer, this is not legal advice! </li></ul></ul>
  18. 18. Scaling Internet Costs <ul><li>Software fees often related to audience size/number of servers </li></ul><ul><li>Can we grow service by 3 orders of magnitude? </li></ul><ul><li>Software fees increasing 1000 fold would be welcomed by vendors, but cripple ability to make programmes </li></ul>
  19. 19. Here to Stay <ul><li>BBC TV is 5 decades old (or so) </li></ul><ul><li>BBC Radio is 8 decades old </li></ul><ul><li>Maintenance is key issue, designing for the long term </li></ul><ul><ul><li>Fortran, Lisp, Cobol all 4-5 decades old and still used due to long term systems </li></ul></ul><ul><ul><li>Where are the proprietary languages of then? </li></ul></ul>
  20. 20. Hidden Assumptions <ul><li>Linear scalability at worst case </li></ul><ul><li>Moore's law & its variations continue to operate in our favour </li></ul><ul><li>Neither are guaranteed. If these fail, we still need to deal with it. Need to plan for outlandish optimisation ideas. </li></ul>
  21. 21. Measuring Cost <ul><li>Lots of literature about measuring algorithm and system cost </li></ul><ul><ul><li>3 key results </li></ul></ul><ul><ul><ul><li>Same cost no matter size of problem </li></ul></ul></ul><ul><ul><ul><li>Cost is proportional to problem size (or cheaper) </li></ul></ul></ul><ul><ul><ul><li>Unit cost increases as problem size increases </li></ul></ul></ul><ul><ul><li>Fourth important metric is scarce resouce </li></ul></ul><ul><ul><li>Cost/resource is defined as CPU cycles, memory, storage, money, etc </li></ul></ul>
  22. 22. License & Standards “Costs” <ul><li>F/OSS is fixed software cost for any problem size </li></ul><ul><li>Proprietary software is category 2 </li></ul><ul><li>Custom/bespoke software might be category 3 </li></ul><ul><ul><li>Open standards are between 1& 2 generally. (MPEG4 is 2, HTTP is 1) </li></ul></ul><ul><ul><li>Category 1 is best for consumers </li></ul></ul>
  23. 23. Protocol Cost – Example ICP <ul><li>Internet Cache Protocol is used by web caches to query others for misses </li></ul><ul><ul><li>Each request runs risk of 2s timeout </li></ul></ul><ul><ul><ul><li>2 caches - 1 request to the other cache </li></ul></ul></ul><ul><ul><ul><li>10 caches - 9 requeststo the other caches </li></ul></ul></ul><ul><ul><ul><li>n caches - n-1 requests to the other caches </li></ul></ul></ul><ul><li>As you grow service, you add caches </li></ul><ul><ul><li>Unit cost per request goes up with service growth </li></ul></ul>
  24. 24. Protocol Cost: Example RTCP <ul><li>Feedback mechanism in RTP </li></ul><ul><li>Scarce resource issue </li></ul><ul><li>Multicast session of 20M homes </li></ul><ul><ul><li>20M*128bits alone. </li></ul></ul><ul><ul><li>If reporting every 5 minutes = 8Mbit/s being sent to everyone </li></ul></ul><ul><ul><li>If drop this down to 10% of dialup bandwidth, you get one report per user a week (useless) </li></ul></ul>
  25. 25. So What? <ul><li>Bandwidth costs will be offset if others redistribute our content </li></ul><ul><ul><li>Better for us to figure out how to do this than someone else </li></ul></ul><ul><li>Software costs will be offset of costs are closer to that of open source </li></ul><ul><ul><li>Working on the this could help with the first point </li></ul></ul>
  26. 26. What are we working on? <ul><li>2 main projects are working on scaling distribution </li></ul><ul><li>Kamaelia is focused on the software aspects, and looking at architectures for long term scaling, not short term win </li></ul><ul><li>We set up private multicast peering with ISPs for the Olympics. </li></ul><ul><li>We leave the latter for a different time </li></ul>
  27. 27. Server Architectures <ul><li>Lots of concurrent connections </li></ul><ul><li>Scalability often driven by concurrency choice </li></ul><ul><ul><li>OS supported concurrency (threads/processes) </li></ul></ul><ul><ul><li>Manual concurrency handling (events etc) </li></ul></ul><ul><ul><li>Language concurrency primitves </li></ul></ul><ul><li>Last two are logically equivalent </li></ul>
  28. 28. OS Concurrency <ul><li>Used by Apache & Inetd </li></ul><ul><ul><li>Scales fairly well - on some operating systems better than others </li></ul></ul><ul><ul><li>Code remains relatively clear looking </li></ul></ul><ul><ul><li>With high levels of concurrency context switching becomes a problem when dealing cross platform </li></ul></ul><ul><ul><li>Ruled out because it restricts OS, and portability </li></ul></ul>
  29. 29. Manual Concurrency <ul><li>Most commonly used approach for building scalable servers </li></ul><ul><ul><ul><li>Unless our approach pans out, use this for your servers! </li></ul></ul></ul><ul><ul><li>Often state machine/event based </li></ul></ul><ul><ul><li>Problem is this is back to one step above “goto” </li></ul></ul><ul><ul><li>Ruled out because it makes joining & maintaining project potentially a lot harder </li></ul></ul>
  30. 30. Language Based Concurrency <ul><li>Not many languages support this approach </li></ul><ul><ul><li>Hence not commonly used </li></ul></ul><ul><ul><li>Like manual concurrency risks lock up due to being co-operative multitasking </li></ul></ul><ul><ul><li>Allows your code to remain single threaded </li></ul></ul><ul><li>Chosen because it simplifies joining & maintaining the project if provide a sensible framework for management </li></ul>
  31. 31. Kamaelia: Architecture <ul><li>Single threaded, select based concurrency through language support </li></ul><ul><ul><li>Concurrency wrapped up in components </li></ul></ul><ul><ul><li>Components only communicate via named boxes. Boxes are connected via linkages. </li></ul></ul><ul><ul><ul><li>Components do not know who they are communicating with </li></ul></ul></ul><ul><ul><li>Same idea as: Unix pipes, CSP, async hardware, hardware systems </li></ul></ul>
  32. 32. Python Generators 1 <ul><li>These are used as the base concurrency mechanism. example: def fib(base1, base2): while True: yield base2 base1,base2 = base2, base1+base2 </li></ul><ul><li>usage: </li></ul><ul><li>>>> fibs=fib(0,1) >>> for i in range(10): print fibs.next(), ... 1 1 2 3 5 8 13 21 34 55 </li></ul>
  33. 33. Python Generators 2 <ul><li>More complex usage >>> fibs=[fib(0,i) for i in range(10)] >>> for i in range(10): ... print [fibs[i].next() for x in fibs] ... [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [1, 1, 2, 3, 5, 8, 13, 21, 34, 55] [2, 2, 4, 6, 10, 16, 26, 42, 68, 110] ... snip ... [9, 9, 18, 27, 45, 72, 117, 189, 306, 495] </li></ul><ul><li>Note the inherent concurrency in generators </li></ul>
  34. 34. Python Generators 3 <ul><li>Look like normal functions, but actually return generator objects </li></ul><ul><ul><li>yield x rather than return x </li></ul></ul><ul><ul><li>Calling gen.next() advances gen to the next yield, which returns value to caller </li></ul></ul><ul><ul><li>Essentially allows a “return and continue” </li></ul></ul><ul><ul><li>Multiple initialised generators are allowed, and essentially run concurrently </li></ul></ul>
  35. 35. Generators – Issues, Solutions <ul><li>No means of communication – only globals and initial arguments </li></ul><ul><li>Can only yield to immediate caller </li></ul><ul><ul><li>Does mean that generators generally stay simple – which can some things </li></ul></ul><ul><li>No default scheduler system </li></ul><ul><li>Solution: give generators context by wrapping them inside a class </li></ul>
  36. 36. Wrapping Generators <ul><li>Many ways, this is simplest, we use a slightly more complex approach. Utility functon: </li></ul><ul><li>import copy def wrapgenerator(bases=object, **attrs): def decorate(func): class statefulgenerator(bases): __doc__ = func.__doc__ def __init__(self,*args): super(statefulgenerator, self) __init__(*args) self.func=func(self,*args) for k in attrs.keys(): self.__dict__[k] = copy.deepcopy(attrs[k]) self.next=self.__iter__().next def __iter__(self): return iter(self.func) return statefulgenerator return decorate </li></ul>
  37. 37. Wrapping Generators - 2 <ul><li>Suppose we wish to allow the following behaviour: </li></ul><ul><ul><li>We communicate only with named queues </li></ul></ul><ul><ul><li>We allow components to nest, communicating only with their named queues </li></ul></ul><ul><li>We can encapsulate this in a class and then use our utility function to apply it to the generator </li></ul>
  38. 38. Sample Behaviour <ul><li>Details aren't important, just the fact this is simple to code: </li></ul><ul><li>class com(object): def __init__(_, *args): # Default queues _.queues = {&quot;inbox&quot;:[],&quot;control&quot;:[], &quot;outbox&quot;:[], &quot;signal&quot;:[]} def send(_,box,obj): _.queues[box].append(obj) def dataReady(_,box): return len(_.queues[box])>0 def recv(_, box): # NB. Exceptions aren't caught X=_.queues[box][0] del _.queues[box][0] return X </li></ul>
  39. 39. Sample Wrapped Generator <ul><li>@wrapgenerator(com) def forwarder(self): &quot;Simple data forwarding generator&quot; while 1: if self.dataReady(&quot;inbox&quot;): self.send(&quot;outbox&quot;,self.recv(&quot;inbox&quot;)) elif self.dataReady(&quot;control&quot;): if self.recv(&quot;control&quot;) == &quot;shutdown&quot;: break yield 1 self.send(&quot;signal&quot;,&quot;shutdown&quot;) yield 0 </li></ul>
  40. 40. Essentials of Kamaelia's Components <ul><li>Generators with named in/out-boxes </li></ul><ul><li>Linkages join outboxes to inboxes </li></ul><ul><li>A Scheduler </li></ul><ul><li>A postman for delivery of messages along linkages </li></ul><ul><ul><li>Runs independently of components </li></ul></ul><ul><li>A co-ordinating assistant tracker </li></ul>
  41. 41. Kamaelia: Building Communication <ul><li>Linkages are tied to the substructure of a component, and are formed via a method call. The method call registers the linkage with the local postman. Example: </li></ul><ul><ul><li>self.link((socket_handler,&quot;outbox&quot;), (protocol_handler,&quot;inbox&quot;)) self.link((protocol_handler,&quot;outbox&quot;), (socket_handler,&quot;inbox&quot;)) </li></ul></ul><ul><li>Note we link component/box to component/box </li></ul>
  42. 42. Scheduling Generators <ul><li>Our (simplified) scheduler is trivial: while(self.running): for mprocess in self.threads: if mprocess: try: result = mprocess.next() if self.newProcesses(result): self.activateProcesses(result): except StopIteration: self.shutdownProcess(result) </li></ul>
  43. 43. Postman Logic <ul><li>The postman is a generator </li></ul><ul><ul><li>One per component. </li></ul></ul><ul><ul><li>It gets shutdown when it's component is shutdown </li></ul></ul><ul><li>Logic is trivial while 1: for link in self.linkages: if link.dataToMove(): link.moveData() yield 1 </li></ul>
  44. 44. Co-ordinating Assistant Tracker <ul><li>Provides book-keeping and service lookup </li></ul><ul><ul><li>Services are (component, inbox) pairs </li></ul></ul><ul><li>Consider biological systems </li></ul><ul><ul><li>Nervous system is point to point </li></ul></ul><ul><ul><li>Non-specific comms is useful for certain tasks. Biological systems use hormones for this purpose. </li></ul></ul>
  45. 45. Writing Servers Using Generators <ul><li>We have components for: </li></ul><ul><ul><li>Listening for new connections </li></ul></ul><ul><ul><li>Handling active connections </li></ul></ul><ul><ul><li>Protocol handling </li></ul></ul><ul><ul><li>Checking that network connections for activity </li></ul></ul><ul><ul><li>This can all be wrapped up as a component itself. </li></ul></ul><ul><ul><ul><li>Code that follows lacks error checking </li></ul></ul></ul>
  46. 46. Note regarding Code Examples <ul><li>Please don't try to read everything! </li></ul><ul><ul><li>I'm going to largely whisk past them </li></ul></ul><ul><li>The idea is to show the common structure that results and reuse it encourages </li></ul><ul><li>Furthermore it's designed to show that each subsection essentially remains looking single threaded despite an active server being highly concurrent </li></ul>
  47. 47. Listening for connections <ul><li>@wrapgenerator(component, queues=[&quot;DataReady&quot;, &quot;_csa_feedback&quot;,&quot; protocolHandlerSignal&quot;, &quot;signal&quot;]) def TCPServer(self, listenport): self.listenport = listenport self.listener,junk = makeTCPServerPort(listenport, maxlisten=5) service, newlycreated = selectorComponent.getSelectorService(self.tracker) if newlycreated: self.addChildren(newSelector) self.link((self, &quot;signal&quot;),service) self.send(newServer(self, (self,self.listener)), &quot;signal&quot;) yield newComponent(*(self.children)) while 1: Handle closed connection messages Handle new connection messages yield 1 </li></ul>
  48. 48. Listening for connections 2 <ul><li>Handle closed connection messages </li></ul><ul><li>if self.dataReady(&quot;_csa_feedback&quot;): data = self.recv(&quot;_csa_feedback&quot;) if isinstance( data, socketShutdown): theComponent,sock = self.closeSocket(data) self.send( shutdownCSA(self,(theComponent,sock)), &quot;signal&quot;) self.removeChild(theComponent) </li></ul>
  49. 49. Listening for Connections 3 <ul><li>Handle new connection messages </li></ul><ul><li>if self.dataReady(&quot;DataReady&quot;): data = self.recv(&quot;DataReady&quot;) CSA = self.mkConnectedSocket(self.listener) self.send(_ki.newCSA(self, CSA), &quot;protocolHandlerSignal&quot;) self.addChildren(CSA) self.link((CSA, &quot;FactoryFeedback&quot;), (self,&quot;_csa_feedback&quot;)) self.send(newCSA(CSA, (CSA,CSA.socket)), &quot;signal&quot;) return CSA </li></ul>
  50. 50. Listening for Connections 4 <ul><li>Everything on one slide: (too small to read probably) @wrapgenerator(component, queues=[&quot;DataReady&quot;, &quot;_csa_feedback&quot;,&quot;protocolHandlerSignal&quot;, &quot;signal&quot;]) def TCPServer(self, listenport): self.listenport = listenport self.listener,junk = makeTCPServerPort(listenport, maxlisten=5) service, newlycreated = selectorComponent.getSelectorService(self.tracker) if newlycreated: self.addChildren(newSelector) self.link((self, &quot;signal&quot;),service) self.send(newServer(self, (self,self.listener)), &quot;signal&quot;) yield newComponent(*(self.children)) while 1: if self.dataReady(&quot;_csa_feedback&quot;): data = self.recv(&quot;_csa_feedback&quot;) if isinstance( data, socketShutdown): theComponent,sock = self.closeSocket(data) self.send(shutdownCSA(self, (theComponent,sock)), &quot;signal&quot;) self.removeChild(theComponent) if self.dataReady(&quot;DataReady&quot;): data = self.recv(&quot;DataReady&quot;) CSA = self.createConnectedSocket(self.listener) self.send(_ki.newCSA(self, CSA), &quot;protocolHandlerSignal&quot;) self.addChildren(CSA) self.link((CSA, &quot;FactoryFeedback&quot;),(self,&quot;_csa_feedback&quot;)) self.send(newCSA(CSA, (CSA,CSA.socket)), &quot;signal&quot;) return CSA yield 1 </li></ul>
  51. 51. Handling active connections <ul><li>@wrapgenerator(component, queues=[&quot;DataReady&quot;, &quot;DataSend&quot;, &quot;control&quot;, &quot;outbox&quot;, &quot;FactoryFeedback&quot;,&quot;signal&quot;]) def ConnectedSocketAdapter(self, listenport): self.socket = listensocket while self.running: if self.dataReady(&quot;DataReady&quot;): data = self.recv(&quot;DataReady&quot;) socketdata = _saferecv(self.socket, 1024) if (socketdata): self.send(socketdata, &quot;outbox&quot;) if self.dataReady(&quot;DataSend&quot;): data = self.recv(&quot;DataSend&quot;) _safesend(self.socket, data) if self.dataReady(&quot;control&quot;): data = self.recv(&quot;control&quot;) if isinstance(data, producerFinished): self.send(socketShutdown(self,self.socket), &quot;FactoryFeedback&quot;) self.send(socketShutdown(self), &quot;signal&quot;) </li></ul>
  52. 52. Protocol handling <ul><li>Depends on protocol. This implements an echo protocol. Note: we've seen this today! </li></ul><ul><li>@wrapgenerator(component) def EchoProtocol(self): &quot;Simple data forwarding generator&quot; while 1: if self.dataReady(&quot;inbox&quot;): self.send(&quot;outbox&quot;,self.recv(&quot;inbox&quot;)) elif self.dataReady(&quot;control&quot;): if self.recv(&quot;control&quot;) == &quot;shutdown&quot;: break yield 1 self.send(&quot;signal&quot;,&quot;shutdown&quot;) yield 0 </li></ul>
  53. 53. Select Based Connection Tracking <ul><li>@wrapgenerator(AdaptiveCommsComponent, queues=[&quot;inbox&quot;, &quot;control&quot;,&quot;notify&quot;,&quot;outbox&quot;,&quot;signal&quot;]) def selectorComponent Initialisation. (not covered, not particularly interesting) while 1: handle notify messages readables, writeables, excepts = select.select( self.readersockets, self.writersockets, [],0) for sock in readables: passBackResult = handle readable socket (sock) if passBackResult: yield passBackResult for sock in writeables: passBackResult = handle writeable socket (sock) if passBackResult: yield passBackResult </li></ul>
  54. 54. Connection Tracking 2 <ul><li>handle notify messages if self.dataReady(&quot;notify&quot;): msg = self.recv(&quot;notify&quot;) (managingComponent, sock) = msg.object if shutdown(message): self.writersockets.remove(sock) else: if message.handlesWriting(): self.writersockets.append(sock) else: self.readersockets.append(sock) self.wireInComponent((managingComponent, sock)) </li></ul>
  55. 55. Connection Tracking 3 <ul><li>handle readable socket (feedbackInboxName, signalOutboxName, theComponent) = self.lookupBoxes[sock] self.send(status(&quot;data ready&quot;),signalOutboxName) </li></ul><ul><li>handle writeable socket (feedbackInboxName, signalOutboxName, theComponent) = self.lookupBoxes[sock] self.send(status(&quot;write ready&quot;),signalOutboxName) </li></ul><ul><li>Lots of detail omitted, esp error handling </li></ul><ul><ul><li>Particularly omitted wiring in & unwiring new components mapped by sockets </li></ul></ul>
  56. 56. Building a Generic Server <ul><li>The example that follows is that of a generic server. </li></ul><ul><ul><li>You provide a protocol component and port </li></ul></ul><ul><ul><li>It runs a server on that port passing over all data to the supplied protocol handler </li></ul></ul><ul><ul><li>This means to write a server, you just implement the protocol </li></ul></ul><ul><ul><li>You don't have to worry about transport at all </li></ul></ul>
  57. 57. Building a Generic Server 2 <ul><li>@wrapgenerator(AdaptiveCommsComponent, queues=[&quot;_oobinfo&quot;]) def SimpleServer(self, protocol, port=1601): self.protocolClass = protocol myPLS = _ic.TCPServer(listenport=port) self.link((myPLS,&quot;protocolHandlerSignal&quot;), (self,&quot;_oobinfo&quot;)) self.addChildren(myPLS) yield newComponent(myPLS) while 1: result = handle messages received via _oobinfo if result: yield result </li></ul>
  58. 58. Building a Generic Server 3 <ul><li>handle messages received via _oobinfo if self.dataReady(&quot;_oobinfo&quot;): data = self.recv(&quot;_oobinfo&quot;) if newConnectedSocketAdaptor(data): return self.handleNewCSA(data) if socketShutdownMessage(data): self.handleClosedCSA(data) </li></ul>
  59. 59. Building a Generic Server 4 <ul><li>handling closed connections </li></ul><ul><li>def handleClosedCSA(self,data): CSA = data.caller inboxes, outboxes, pHandler = self.retrieveTrackedResourceInformation(CSA) self.send(&quot;shutdown&quot;,outboxes[0]) self.removeChild(CSA) self.removeChild(pHandler) self.deleteOutbox(outboxes[0]) self.ceaseTrackingResource(CSA) </li></ul>
  60. 60. Building a Generic Server 5 <ul><li>handling closed connections def handleNewCSA(self, data): CSA = data.object pHandler = self.protocolClass() pHandlerShutdownOutbox= self.addOutbox( &quot;protocolHandlerShutdownSignal&quot;) self.trackResourceInformation(CSA, [], [pHandlerShutdownOutbox], pHandler) self.addChildren(CSA,pHandler) self.link((CSA,&quot;outbox&quot;),(pHandler,&quot;inbox&quot;)) self.link((pHandler,&quot;outbox&quot;),(CSA,&quot;DataSend&quot;)) self.link((CSA,&quot;signal&quot;),(self,&quot;_oobinfo&quot;)) self.link((self,pHandlerShutdownOutbox), (pHandler, &quot;control&quot;)) if &quot;signal&quot; in pHandler.Outboxes: self.link((pHandler,&quot;signal&quot;),(CSA, &quot;control&quot;)) return newComponent(CSA,pHandler) </li></ul>
  61. 61. Interlude <ul><li>The code on the preceding slides is the core code for a scalable server which can accept more or less any protocol </li></ul><ul><ul><li>This makes it ideal and simple for playing with protocols </li></ul></ul><ul><ul><li>That's the idea behind the system – a little more work to make things easy for people </li></ul></ul><ul><ul><li>Essentially the entire architecture is plugins </li></ul></ul>
  62. 62. Implementing A TCP Client <ul><li>The real question is how much reuse can we get in a network client ? </li></ul><ul><li>Lets try! </li></ul>
  63. 63. Implementing A TCP Client 2 <ul><li>@wrapgenerator(AdaptiveCommsComponent, queues=[&quot;_oobinfo&quot;]) def TCPClient(self,host,port): message = None try: sock = socket.socket(AF_INET, SOCK_STREAM); yield 0.3 sock.setblocking(0); yield 0.6 while not Safe Connect (self,sock,(self.host, self.port)): yield 1 yield newComponent(* Setup CSA (self,sock)) while Wait CSA Close (self): self.pause() ; yield 2 result = sock.shutdown(1) ; yield 3 sock.close() ; yield 4 except socket.error, e: message = e self.send(message, &quot;signal&quot;) </li></ul>
  64. 64. Implementing A TCP Client 3 <ul><li>Setup CSA </li></ul><ul><li>def setupCSA(self, sock): CSA = ConnectedSocketAdapter(sock) self.addChildren(CSA) selectorService , newSelector = getSelectorService(self.tracker) </li></ul><ul><li>if newSelector: self.addChildren(newSelector) self.link((self, &quot;_selectorSignal&quot;),selectorService) self.link((CSA, &quot;FactoryFeedback&quot;), (self,&quot;_socketFeedback&quot;)) self.link((CSA, &quot;outbox&quot;), (self, &quot;outbox&quot;), passthrough=2) self.link((self, &quot;inbox&quot;), (CSA, &quot;DataSend&quot;), passthrough=1) self.send(newCSA(self, (CSA,sock)), &quot;_selectorSignal&quot;) return self.childComponents() </li></ul>
  65. 65. Implementing A TCP Client 4 <ul><li>Safe Connect (not so safe – error handling removed(!)...) def safeConnect(self, sock, *sockArgsList): try: sock.connect(*sockArgsList); self.connecting,self.connected=0,1 return True except socket.error, socket.msg: (errno, errmsg) = socket.msg.args if (errno==EALREADY or errno==EINPROGRESS): self.connecting=1 return False raise socket.msg </li></ul>
  66. 66. Implementing A TCP Client 5 <ul><li>Wait CSA Close </li></ul><ul><li>if self.dataReady(&quot;_socketFeedback&quot;): </li></ul><ul><li>message = self.recv(&quot;_socketFeedback&quot;) </li></ul><ul><li>if socketShutdownMessage(message): </li></ul><ul><li>return False </li></ul><ul><li>return True </li></ul>
  67. 67. Notes About the TCP Client <ul><li>Not really that much simpler than a TCP server really </li></ul><ul><ul><li>Corrollary: servers don't have to be hard </li></ul></ul><ul><li>Note we reused without any changes: </li></ul><ul><ul><li>ConnectedSocketAdaptor </li></ul></ul><ul><ul><li>Selector </li></ul></ul><ul><li>Small components encourages reuse rather than duplication </li></ul>
  68. 68. Some Key Results <ul><li>Individual components : Simple. </li></ul><ul><li>Complex systems via controlled composition </li></ul><ul><li>Replacing select with poll == simple </li></ul><ul><li>Replacing TCP with UDP similarly limits knockon changes </li></ul><ul><li>Single layer yield encourages small focussed components </li></ul>
  69. 69. Some Key Results <ul><li>Protocol implementation can be done independent of network code </li></ul><ul><li>Provides a toolset for experimenting with protocols, transports </li></ul><ul><li>Very similar feel to building unix pipelines </li></ul>
  70. 70. Less Obvious Stuff <ul><li>Owning the code allows us to ship the server in the client </li></ul><ul><li>Lightweight nature makes writing clients this way simple </li></ul><ul><li>Merging code from other projects written in python is relatively simple: </li></ul><ul><ul><li>Add in a number of yields in strategic points </li></ul></ul><ul><ul><li>Add in support for communication/control </li></ul></ul>
  71. 71. More Less Obvious Stuff <ul><li>Interesting possibility: </li></ul><ul><ul><li>Client tuner utility with embedded RTSP/RTP server and Bit Torrent client. </li></ul></ul><ul><ul><li>Cursory looks suggest that the component nature makes this a realistic possibility. </li></ul></ul><ul><li>High decoupling: parallelism across threads, CPUs, machines practical. </li></ul><ul><ul><li>Resulting structure lends itself to optimisation in hardware . </li></ul></ul>
  72. 72. Kamaelia: Ongoing Work <ul><li>Lots of things to do: </li></ul><ul><ul><li>Integration of RTP/RTSP components </li></ul></ul><ul><ul><li>Stream oriented UDP </li></ul></ul><ul><ul><li>Implement better a/v delivery protocol </li></ul></ul><ul><ul><li>Optimisation of bottlenecks (linkages) </li></ul></ul><ul><ul><li>Use python features to remove cruft </li></ul></ul><ul><ul><li>Investigate Twisted “ integration” with </li></ul></ul><ul><ul><li>Lots more! </li></ul></ul>
  73. 73. RTP is not a Streaming Protocol <ul><li>RTP isn't designed for unidirectional streaming. </li></ul><ul><ul><li>Does somethings that break hard in streaming </li></ul></ul><ul><ul><li>Misses out key things streaming protocols do </li></ul></ul><ul><ul><ul><li>Stream thinning </li></ul></ul></ul><ul><ul><ul><li>Stream indexing </li></ul></ul></ul><ul><ul><ul><li>Define a mechanism for going over TCP. </li></ul></ul></ul>
  74. 74. RTP For Streaming <ul><li>Everyone (?) who does open standards streaming and doesn't do HTTP does RTP </li></ul><ul><li>Why? </li></ul><ul><ul><li>Because it's the only open standard that comes close to the requirements </li></ul></ul><ul><li>So let's look at streaming </li></ul>
  75. 75. What problem does streaming solve?
  76. 76. What problem does streaming solve? <ul><li>Audio/Video delivery? </li></ul><ul><li>Quickest way of delivery? </li></ul><ul><li>Digital Restrictions Management - preventing unauthorised copies? </li></ul>
  77. 77. What problem does streaming solve? <ul><li>Audio/Video delivery? </li></ul><ul><ul><li>No, HTTP downloading handles that fine </li></ul></ul><ul><li>Quickest way of delivery? </li></ul><ul><ul><li>No, again, HTTP </li></ul></ul><ul><li>Digital Restrictions Management - preventing unauthorised copies? </li></ul><ul><ul><li>No – a lot of streaming is over HTTP </li></ul></ul>
  78. 78. Characteristics of streaming? <ul><li>Capped bitrate connection </li></ul><ul><ul><li>Expected to stay at that capped bitrate </li></ul></ul><ul><li>Play as you recieve </li></ul><ul><ul><li>On demand, play now. </li></ul></ul><ul><li>Time oriented seeking </li></ul><ul><ul><li>Fine grained, but not conceptual - why not act, chapter, content oriented? </li></ul></ul>
  79. 79. What problem does streaming solve? <ul><li>OK, an answer: </li></ul><ul><ul><li>Timely delivery of content down pipes normally too small to take it </li></ul></ul><ul><li>That's why we have capped bit rates </li></ul><ul><li>That's why we use compression. </li></ul><ul><li>Timely means people want to watch now, rather than wait for higher quality </li></ul>
  80. 80. Observations <ul><li>High compression, packet loss == unwatchable video </li></ul><ul><li>Buffering common to mask transport errors </li></ul><ul><li>Devices have lots of local store </li></ul><ul><ul><li>If bitrate of video < capacity of client link, why not switch to download faster and large local cache model? ie Actually switch protocols? </li></ul></ul>
  81. 81. Observations 2 <ul><li>If bitrate >> capacity of link - why deny access - which not allow switch to maximum speed download to local cache model ? </li></ul><ul><ul><li>ie allow people to choose quality or timeliness and then act accordingly </li></ul></ul><ul><li>What about letting multiple source feed a single stream? </li></ul><ul><ul><li>RTP doesn't really fit these models... </li></ul></ul>
  82. 82. Good Transport Protocol Aspects <ul><li>Content agnostic - you can send anything </li></ul><ul><li>Fully defines all aspects of usage </li></ul><ul><li>Simple to use </li></ul><ul><li>Changing content doesn't require understanding the content structure </li></ul><ul><ul><li>P2P is good at this </li></ul></ul><ul><ul><li>HTTP is good at this </li></ul></ul><ul><ul><li>RTP sucks at this </li></ul></ul>
  83. 83. RTP Problems (for streaming) <ul><li>Half a transport protocol </li></ul><ul><ul><li>Doesn't define how to send anything </li></ul></ul><ul><ul><li>Defines protocol profiles for lots of content types </li></ul></ul><ul><ul><ul><li>Lots of content types missing containers </li></ul></ul></ul><ul><ul><ul><ul><li>Vorbis, Speex, Theora, Dirac, ... </li></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>Vorbis has an (expired?) IETF draft </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>Not anyone's &quot;fault&quot; - protocol issue </li></ul></ul></ul></ul></ul><ul><ul><li>Doesn't define framing over TCP </li></ul></ul>
  84. 84. RTP Problems (for streaming) <ul><li>Time based, not content based </li></ul><ul><li>RTCP has issues large multicast groups. </li></ul><ul><ul><li>This is due to RTP not really having the concept of unidirectional sessions </li></ul></ul><ul><ul><li>Multicast has similar issues generally </li></ul></ul><ul><ul><li>Or you don't implement the protocol </li></ul></ul><ul><li>Lots of features not needed in streaming </li></ul><ul><li>Designed for a/v conferencing </li></ul>
  85. 85. P2P Issues <ul><li>Unknown quantity really. No, really. </li></ul><ul><ul><li>Remember we're after how to serve ~ 7Tbit/s </li></ul></ul><ul><ul><ul><li>How many 256Kbit/s DSL uplinks? </li></ul></ul></ul><ul><ul><li>Can't do it just from the edge </li></ul></ul><ul><ul><li>Can't do it just from the centre </li></ul></ul><ul><ul><li>Legitimate Bit Torrent use – eg linux distros has proven moderate sized audience can work </li></ul></ul><ul><ul><li>Large numbers grabbing lots of things? </li></ul></ul>
  86. 86. P2P Issues 2 <ul><li>How do ensure producers of art get paid? </li></ul><ul><ul><li>We all want the &quot;next Matrix&quot;? </li></ul></ul><ul><ul><li>We all want the &quot;next Really Cool Film/Song&quot; </li></ul></ul><ul><ul><li>Films are a real problem – not a one man job, nor really suitable for open source style </li></ul></ul><ul><ul><li>Current approaches aren't working </li></ul></ul><ul><ul><ul><li>Do we really want people breaking laws? </li></ul></ul></ul><ul><ul><ul><li>Do we really want to terrify the **AA down roads no-one wants to go? </li></ul></ul></ul>
  87. 87. P2P Issues 3 <ul><li>Copyright infringement isn't really a P2P issue </li></ul><ul><ul><li>P2P makes it simpler because P2P is an effective user controlled distribution system </li></ul></ul><ul><ul><li>I grew up with Star Wars & Superman as a kid </li></ul></ul><ul><ul><li>My kids get LOTR & Spiderman </li></ul></ul><ul><ul><li>P2P has the power to ensure that your kids don't get their epics </li></ul></ul>
  88. 88. P2P Issues 4 <ul><li>It's a social responsibility issue. </li></ul><ul><li>We can choose to define protocols that will adhere to rights. </li></ul><ul><li>Systems that look at creative commons licenses embedded in content are a GREAT start </li></ul><ul><li>Maybe new protocols could consider this? </li></ul>
  89. 89. Need for simpler Media Storage <ul><li>RTP has to understand every media wrapper, and often codec details </li></ul><ul><li>Users can ask via RTSP for specific time indexes. This must be satisfied. </li></ul><ul><li>Parsing thousands of files at once is VERY expensive </li></ul><ul><li>Darwin streaming server hints the content </li></ul><ul><ul><li>Patented by apple... </li></ul></ul>
  90. 90. Simpler Media Storage <ul><li>Rather than leave content unchanged, why not stuff it into a standard format? </li></ul><ul><ul><li>Like usenet servers do </li></ul></ul><ul><ul><li>Like XML repositories </li></ul></ul><ul><ul><li>Like DNS defines </li></ul></ul><ul><li>Having a shared approach makes reuse simpler </li></ul><ul><li>Note, I'm talking specifically for server use </li></ul>
  91. 91. Simpler Server Storage <ul><li>One obvious approach: </li></ul><ul><ul><li>Define in header “this is maximum bit rate”, “this is time granularity for index points” </li></ul></ul><ul><ul><li>Instantly have mapping of bytes and time </li></ul></ul><ul><ul><li>Pad chunks for VBR </li></ul></ul><ul><ul><li>Content agnostic </li></ul></ul><ul><ul><li>Could provide semantic -> time mapping </li></ul></ul><ul><ul><li>Very similar to IFF formats (19 years old) </li></ul></ul>
  92. 93. Need for a New Streaming Protocol <ul><li>Wish list (partial): </li></ul><ul><ul><li>Transmission between a/v caches </li></ul></ul><ul><ul><li>Transmission mode migration </li></ul></ul><ul><ul><ul><li>Downloading should allow swarming behaviour </li></ul></ul></ul><ul><ul><ul><li>Similarly for streaming where practical </li></ul></ul></ul><ul><ul><li>Stream thinning </li></ul></ul><ul><ul><li>Semantic indexing as well as time </li></ul></ul><ul><ul><li>Mechanisms for arbitrary content distribution </li></ul></ul>
  93. 94. Need for a New Streaming Protocol <ul><li>Wish list (partial): (cont) </li></ul><ul><ul><li>Provide mechanisms for arbitrary content distribution </li></ul></ul><ul><ul><li>Mechanisms similar to those in Scattercast would be useful when combined with P2P for a self organising media distribution network </li></ul></ul><ul><li>Too large a topic for this talk </li></ul>
  94. 95. Copyright License <ul><ul><ul><li>This presentation is part of the Kamaelia Project, and was presented at Firenze World Vision: Free Streaming 2004 session, organised by the Media Innovation Unit of Firenze Technologia </li></ul></ul></ul><ul><ul><ul><li>As such it and the code it contains may be used under the terms of the LGPL (v2.1), MPL (v1.1), or GPL (v2.0) </li></ul></ul></ul><ul><ul><ul><ul><ul><li>http://www.opensource.org/licenses/mozilla1.1.php </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>http://www.gnu.org/copyleft/lesser.html </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>http://www.gnu.org/licenses/gpl.html </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><li>(This is due to the large code element in this presentation) </li></ul></ul></ul></ul>

×