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

More Related Content

What's hot (20)

Bcs 052 solved assignment
Bcs 052 solved assignmentBcs 052 solved assignment
Bcs 052 solved assignment
Indira Gnadhi National Open University (IGNOU)
 
Tom Peters, Software Engineer, Ufora at MLconf ATL 2016
Tom Peters, Software Engineer, Ufora at MLconf ATL 2016Tom Peters, Software Engineer, Ufora at MLconf ATL 2016
Tom Peters, Software Engineer, Ufora at MLconf ATL 2016
MLconf
 
“TinyML Isn’t Thinking Big Enough,” a Presentation from Perceive
“TinyML Isn’t Thinking Big Enough,” a Presentation from Perceive“TinyML Isn’t Thinking Big Enough,” a Presentation from Perceive
“TinyML Isn’t Thinking Big Enough,” a Presentation from Perceive
Edge AI and Vision Alliance
 
cas_Knowledge_Network
cas_Knowledge_Networkcas_Knowledge_Network
cas_Knowledge_Network
Oliver Eichel
 
Kaz Sato, Evangelist, Google at MLconf ATL 2016
Kaz Sato, Evangelist, Google at MLconf ATL 2016Kaz Sato, Evangelist, Google at MLconf ATL 2016
Kaz Sato, Evangelist, Google at MLconf ATL 2016
MLconf
 
ProcessOne Push Platform: XMPP-based Push Solutions
ProcessOne Push Platform: XMPP-based Push SolutionsProcessOne Push Platform: XMPP-based Push Solutions
ProcessOne Push Platform: XMPP-based Push Solutions
Mickaël Rémond
 
Let's Be HAV1ng You - London Video Tech October 2019
Let's Be HAV1ng You - London Video Tech October 2019Let's Be HAV1ng You - London Video Tech October 2019
Let's Be HAV1ng You - London Video Tech October 2019
Derek Buitenhuis
 
Cartographer, or Building A Next Generation Management Framework
Cartographer, or Building A Next Generation Management FrameworkCartographer, or Building A Next Generation Management Framework
Cartographer, or Building A Next Generation Management Framework
ansmtug
 
5 maximazing networkcapacity_v4-jorge_alvarado
5 maximazing networkcapacity_v4-jorge_alvarado5 maximazing networkcapacity_v4-jorge_alvarado
5 maximazing networkcapacity_v4-jorge_alvarado
SSPI Brasil
 
Application Layer
Application LayerApplication Layer
Application Layer
ushabarad142
 
Keras Tutorial For Beginners | Creating Deep Learning Models Using Keras In P...
Keras Tutorial For Beginners | Creating Deep Learning Models Using Keras In P...Keras Tutorial For Beginners | Creating Deep Learning Models Using Keras In P...
Keras Tutorial For Beginners | Creating Deep Learning Models Using Keras In P...
Edureka!
 
Amazon Deep Learning
Amazon Deep LearningAmazon Deep Learning
Amazon Deep Learning
Amanda Mackay (she/her)
 
Hands-on Learning with KubeFlow + Keras/TensorFlow 2.0 + TF Extended (TFX) + ...
Hands-on Learning with KubeFlow + Keras/TensorFlow 2.0 + TF Extended (TFX) + ...Hands-on Learning with KubeFlow + Keras/TensorFlow 2.0 + TF Extended (TFX) + ...
Hands-on Learning with KubeFlow + Keras/TensorFlow 2.0 + TF Extended (TFX) + ...
Chris Fregly
 
Deep learning with TensorFlow
Deep learning with TensorFlowDeep learning with TensorFlow
Deep learning with TensorFlow
Ndjido Ardo BAR
 
Convolutional Neural Networks at scale in Spark MLlib
Convolutional Neural Networks at scale in Spark MLlibConvolutional Neural Networks at scale in Spark MLlib
Convolutional Neural Networks at scale in Spark MLlib
DataWorks Summit
 
Probabilistic Approach to Provisioning of ITV - By Amos_Kohn
Probabilistic Approach to Provisioning of ITV - By Amos_KohnProbabilistic Approach to Provisioning of ITV - By Amos_Kohn
Probabilistic Approach to Provisioning of ITV - By Amos_Kohn
Amos Kohn
 
Dynamic Adaptive Point Cloud Streaming
Dynamic Adaptive Point Cloud StreamingDynamic Adaptive Point Cloud Streaming
Dynamic Adaptive Point Cloud Streaming
Alpen-Adria-Universität
 
Huffman ppt
Huffman ppt Huffman ppt
Huffman ppt
ALexHunter69
 
IMPROVING IPV6 ADDRESSING TYPES AND SIZE
IMPROVING IPV6 ADDRESSING TYPES AND SIZEIMPROVING IPV6 ADDRESSING TYPES AND SIZE
IMPROVING IPV6 ADDRESSING TYPES AND SIZE
IJCNCJournal
 
Braxton McKee, CEO & Founder, Ufora at MLconf NYC - 4/15/16
Braxton McKee, CEO & Founder, Ufora at MLconf NYC - 4/15/16Braxton McKee, CEO & Founder, Ufora at MLconf NYC - 4/15/16
Braxton McKee, CEO & Founder, Ufora at MLconf NYC - 4/15/16
MLconf
 
Tom Peters, Software Engineer, Ufora at MLconf ATL 2016
Tom Peters, Software Engineer, Ufora at MLconf ATL 2016Tom Peters, Software Engineer, Ufora at MLconf ATL 2016
Tom Peters, Software Engineer, Ufora at MLconf ATL 2016
MLconf
 
“TinyML Isn’t Thinking Big Enough,” a Presentation from Perceive
“TinyML Isn’t Thinking Big Enough,” a Presentation from Perceive“TinyML Isn’t Thinking Big Enough,” a Presentation from Perceive
“TinyML Isn’t Thinking Big Enough,” a Presentation from Perceive
Edge AI and Vision Alliance
 
cas_Knowledge_Network
cas_Knowledge_Networkcas_Knowledge_Network
cas_Knowledge_Network
Oliver Eichel
 
Kaz Sato, Evangelist, Google at MLconf ATL 2016
Kaz Sato, Evangelist, Google at MLconf ATL 2016Kaz Sato, Evangelist, Google at MLconf ATL 2016
Kaz Sato, Evangelist, Google at MLconf ATL 2016
MLconf
 
ProcessOne Push Platform: XMPP-based Push Solutions
ProcessOne Push Platform: XMPP-based Push SolutionsProcessOne Push Platform: XMPP-based Push Solutions
ProcessOne Push Platform: XMPP-based Push Solutions
Mickaël Rémond
 
Let's Be HAV1ng You - London Video Tech October 2019
Let's Be HAV1ng You - London Video Tech October 2019Let's Be HAV1ng You - London Video Tech October 2019
Let's Be HAV1ng You - London Video Tech October 2019
Derek Buitenhuis
 
Cartographer, or Building A Next Generation Management Framework
Cartographer, or Building A Next Generation Management FrameworkCartographer, or Building A Next Generation Management Framework
Cartographer, or Building A Next Generation Management Framework
ansmtug
 
5 maximazing networkcapacity_v4-jorge_alvarado
5 maximazing networkcapacity_v4-jorge_alvarado5 maximazing networkcapacity_v4-jorge_alvarado
5 maximazing networkcapacity_v4-jorge_alvarado
SSPI Brasil
 
Keras Tutorial For Beginners | Creating Deep Learning Models Using Keras In P...
Keras Tutorial For Beginners | Creating Deep Learning Models Using Keras In P...Keras Tutorial For Beginners | Creating Deep Learning Models Using Keras In P...
Keras Tutorial For Beginners | Creating Deep Learning Models Using Keras In P...
Edureka!
 
Hands-on Learning with KubeFlow + Keras/TensorFlow 2.0 + TF Extended (TFX) + ...
Hands-on Learning with KubeFlow + Keras/TensorFlow 2.0 + TF Extended (TFX) + ...Hands-on Learning with KubeFlow + Keras/TensorFlow 2.0 + TF Extended (TFX) + ...
Hands-on Learning with KubeFlow + Keras/TensorFlow 2.0 + TF Extended (TFX) + ...
Chris Fregly
 
Deep learning with TensorFlow
Deep learning with TensorFlowDeep learning with TensorFlow
Deep learning with TensorFlow
Ndjido Ardo BAR
 
Convolutional Neural Networks at scale in Spark MLlib
Convolutional Neural Networks at scale in Spark MLlibConvolutional Neural Networks at scale in Spark MLlib
Convolutional Neural Networks at scale in Spark MLlib
DataWorks Summit
 
Probabilistic Approach to Provisioning of ITV - By Amos_Kohn
Probabilistic Approach to Provisioning of ITV - By Amos_KohnProbabilistic Approach to Provisioning of ITV - By Amos_Kohn
Probabilistic Approach to Provisioning of ITV - By Amos_Kohn
Amos Kohn
 
IMPROVING IPV6 ADDRESSING TYPES AND SIZE
IMPROVING IPV6 ADDRESSING TYPES AND SIZEIMPROVING IPV6 ADDRESSING TYPES AND SIZE
IMPROVING IPV6 ADDRESSING TYPES AND SIZE
IJCNCJournal
 
Braxton McKee, CEO & Founder, Ufora at MLconf NYC - 4/15/16
Braxton McKee, CEO & Founder, Ufora at MLconf NYC - 4/15/16Braxton McKee, CEO & Founder, Ufora at MLconf NYC - 4/15/16
Braxton McKee, CEO & Founder, Ufora at MLconf NYC - 4/15/16
MLconf
 

Similar to Scaling Streaming - Concepts, Research, Goals (20)

PeerToPeerComputing (1)
PeerToPeerComputing (1)PeerToPeerComputing (1)
PeerToPeerComputing (1)
MurtazaB
 
Solutions for Exercises: Distributed Systems 5th Edition by Coulouris & Dolli...
Solutions for Exercises: Distributed Systems 5th Edition by Coulouris & Dolli...Solutions for Exercises: Distributed Systems 5th Edition by Coulouris & Dolli...
Solutions for Exercises: Distributed Systems 5th Edition by Coulouris & Dolli...
industriale82
 
Serhiy Kalinets "Embracing architectural challenges in the modern .NET world"
Serhiy Kalinets "Embracing architectural challenges in the modern .NET world"Serhiy Kalinets "Embracing architectural challenges in the modern .NET world"
Serhiy Kalinets "Embracing architectural challenges in the modern .NET world"
Fwdays
 
EQR Reporting: Rails + Amazon EC2
EQR Reporting:  Rails + Amazon EC2EQR Reporting:  Rails + Amazon EC2
EQR Reporting: Rails + Amazon EC2
jeperkins4
 
Lesson 2
Lesson 2Lesson 2
Lesson 2
Sandra Ahn
 
Lunar Way and the Cloud Native "stack"
Lunar Way and the Cloud Native "stack"Lunar Way and the Cloud Native "stack"
Lunar Way and the Cloud Native "stack"
Kasper Nissen
 
Nss Labs Dpi Intro V3
Nss Labs Dpi Intro V3Nss Labs Dpi Intro V3
Nss Labs Dpi Intro V3
gueste47133
 
Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...
Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...
Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...
Nati Shalom
 
Introduction to requirement of microservices
Introduction to requirement of microservicesIntroduction to requirement of microservices
Introduction to requirement of microservices
Avik Das
 
Open Source in the Enterprise
Open Source in the EnterpriseOpen Source in the Enterprise
Open Source in the Enterprise
Social Media Performance Group
 
Tuenti teams - Php Conference
Tuenti teams - Php ConferenceTuenti teams - Php Conference
Tuenti teams - Php Conference
Guille -bisho-
 
Other distributed systems
Other distributed systemsOther distributed systems
Other distributed systems
Sri Prasanna
 
Handling Data in Mega Scale Systems
Handling Data in Mega Scale SystemsHandling Data in Mega Scale Systems
Handling Data in Mega Scale Systems
Directi Group
 
CH02-Computer Organization and Architecture 10e.pptx
CH02-Computer Organization and Architecture 10e.pptxCH02-Computer Organization and Architecture 10e.pptx
CH02-Computer Organization and Architecture 10e.pptx
HafizSaifullah4
 
DM Radio Webinar: Adopting a Streaming-Enabled Architecture
DM Radio Webinar: Adopting a Streaming-Enabled ArchitectureDM Radio Webinar: Adopting a Streaming-Enabled Architecture
DM Radio Webinar: Adopting a Streaming-Enabled Architecture
DATAVERSITY
 
moveMountainIEEE
moveMountainIEEEmoveMountainIEEE
moveMountainIEEE
Christopher Gallo
 
RFP-Final3
RFP-Final3RFP-Final3
RFP-Final3
Antonio Billard
 
introduction to distributed computing.pptx
introduction to distributed computing.pptxintroduction to distributed computing.pptx
introduction to distributed computing.pptx
ApthiriSurekha
 
Waters Grid & HPC Course
Waters Grid & HPC CourseWaters Grid & HPC Course
Waters Grid & HPC Course
jimliddle
 
UnConference for Georgia Southern Computer Science March 31, 2015
UnConference for Georgia Southern Computer Science March 31, 2015UnConference for Georgia Southern Computer Science March 31, 2015
UnConference for Georgia Southern Computer Science March 31, 2015
Christopher Curtin
 
PeerToPeerComputing (1)
PeerToPeerComputing (1)PeerToPeerComputing (1)
PeerToPeerComputing (1)
MurtazaB
 
Solutions for Exercises: Distributed Systems 5th Edition by Coulouris & Dolli...
Solutions for Exercises: Distributed Systems 5th Edition by Coulouris & Dolli...Solutions for Exercises: Distributed Systems 5th Edition by Coulouris & Dolli...
Solutions for Exercises: Distributed Systems 5th Edition by Coulouris & Dolli...
industriale82
 
Serhiy Kalinets "Embracing architectural challenges in the modern .NET world"
Serhiy Kalinets "Embracing architectural challenges in the modern .NET world"Serhiy Kalinets "Embracing architectural challenges in the modern .NET world"
Serhiy Kalinets "Embracing architectural challenges in the modern .NET world"
Fwdays
 
EQR Reporting: Rails + Amazon EC2
EQR Reporting:  Rails + Amazon EC2EQR Reporting:  Rails + Amazon EC2
EQR Reporting: Rails + Amazon EC2
jeperkins4
 
Lunar Way and the Cloud Native "stack"
Lunar Way and the Cloud Native "stack"Lunar Way and the Cloud Native "stack"
Lunar Way and the Cloud Native "stack"
Kasper Nissen
 
Nss Labs Dpi Intro V3
Nss Labs Dpi Intro V3Nss Labs Dpi Intro V3
Nss Labs Dpi Intro V3
gueste47133
 
Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...
Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...
Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...
Nati Shalom
 
Introduction to requirement of microservices
Introduction to requirement of microservicesIntroduction to requirement of microservices
Introduction to requirement of microservices
Avik Das
 
Tuenti teams - Php Conference
Tuenti teams - Php ConferenceTuenti teams - Php Conference
Tuenti teams - Php Conference
Guille -bisho-
 
Other distributed systems
Other distributed systemsOther distributed systems
Other distributed systems
Sri Prasanna
 
Handling Data in Mega Scale Systems
Handling Data in Mega Scale SystemsHandling Data in Mega Scale Systems
Handling Data in Mega Scale Systems
Directi Group
 
CH02-Computer Organization and Architecture 10e.pptx
CH02-Computer Organization and Architecture 10e.pptxCH02-Computer Organization and Architecture 10e.pptx
CH02-Computer Organization and Architecture 10e.pptx
HafizSaifullah4
 
DM Radio Webinar: Adopting a Streaming-Enabled Architecture
DM Radio Webinar: Adopting a Streaming-Enabled ArchitectureDM Radio Webinar: Adopting a Streaming-Enabled Architecture
DM Radio Webinar: Adopting a Streaming-Enabled Architecture
DATAVERSITY
 
introduction to distributed computing.pptx
introduction to distributed computing.pptxintroduction to distributed computing.pptx
introduction to distributed computing.pptx
ApthiriSurekha
 
Waters Grid & HPC Course
Waters Grid & HPC CourseWaters Grid & HPC Course
Waters Grid & HPC Course
jimliddle
 
UnConference for Georgia Southern Computer Science March 31, 2015
UnConference for Georgia Southern Computer Science March 31, 2015UnConference for Georgia Southern Computer Science March 31, 2015
UnConference for Georgia Southern Computer Science March 31, 2015
Christopher Curtin
 
Ad

More from kamaelian (19)

Kamaelia lightning2010opensource
Kamaelia lightning2010opensourceKamaelia lightning2010opensource
Kamaelia lightning2010opensource
kamaelian
 
Kamaelia Europython Tutorial
Kamaelia Europython TutorialKamaelia Europython Tutorial
Kamaelia Europython Tutorial
kamaelian
 
Embracing concurrency for fun utility and simpler code
Embracing concurrency for fun utility and simpler codeEmbracing concurrency for fun utility and simpler code
Embracing concurrency for fun utility and simpler code
kamaelian
 
Kamaelia Protocol Walkthrough
Kamaelia Protocol WalkthroughKamaelia Protocol Walkthrough
Kamaelia Protocol Walkthrough
kamaelian
 
Sharing Data and Services Safely in Concurrent Systems using Kamaelia
Sharing Data and Services Safely in Concurrent Systems using KamaeliaSharing Data and Services Safely in Concurrent Systems using Kamaelia
Sharing Data and Services Safely in Concurrent Systems using Kamaelia
kamaelian
 
Practical concurrent systems made simple using Kamaelia
Practical concurrent systems made simple using KamaeliaPractical concurrent systems made simple using Kamaelia
Practical concurrent systems made simple using Kamaelia
kamaelian
 
Sociable Software
Sociable SoftwareSociable Software
Sociable Software
kamaelian
 
Kamaelia Grey
Kamaelia GreyKamaelia Grey
Kamaelia Grey
kamaelian
 
Open Source at the BBC: When, Why, Why not & How
Open Source at the BBC: When, Why, Why not & HowOpen Source at the BBC: When, Why, Why not & How
Open Source at the BBC: When, Why, Why not & How
kamaelian
 
Open Source at the BBC
Open Source at the BBCOpen Source at the BBC
Open Source at the BBC
kamaelian
 
Kamaelia - Fave 2005
Kamaelia - Fave 2005Kamaelia - Fave 2005
Kamaelia - Fave 2005
kamaelian
 
SWP - A Generic Language Parser
SWP - A Generic Language ParserSWP - A Generic Language Parser
SWP - A Generic Language Parser
kamaelian
 
Kamaelia - Networking Using Generators
Kamaelia - Networking Using GeneratorsKamaelia - Networking Using Generators
Kamaelia - Networking Using Generators
kamaelian
 
Timeshift Everything, Miss Nothing - Mashup your PVR with Kamaelia
Timeshift Everything, Miss Nothing - Mashup your PVR with KamaeliaTimeshift Everything, Miss Nothing - Mashup your PVR with Kamaelia
Timeshift Everything, Miss Nothing - Mashup your PVR with Kamaelia
kamaelian
 
Kamaelia Internals
Kamaelia InternalsKamaelia Internals
Kamaelia Internals
kamaelian
 
Managing Creativity
Managing CreativityManaging Creativity
Managing Creativity
kamaelian
 
Building systems with Kamaelia
Building systems with KamaeliaBuilding systems with Kamaelia
Building systems with Kamaelia
kamaelian
 
Free software: How does it work?
Free software: How does it work?Free software: How does it work?
Free software: How does it work?
kamaelian
 
The Selfish Programmer
The Selfish ProgrammerThe Selfish Programmer
The Selfish Programmer
kamaelian
 
Kamaelia lightning2010opensource
Kamaelia lightning2010opensourceKamaelia lightning2010opensource
Kamaelia lightning2010opensource
kamaelian
 
Kamaelia Europython Tutorial
Kamaelia Europython TutorialKamaelia Europython Tutorial
Kamaelia Europython Tutorial
kamaelian
 
Embracing concurrency for fun utility and simpler code
Embracing concurrency for fun utility and simpler codeEmbracing concurrency for fun utility and simpler code
Embracing concurrency for fun utility and simpler code
kamaelian
 
Kamaelia Protocol Walkthrough
Kamaelia Protocol WalkthroughKamaelia Protocol Walkthrough
Kamaelia Protocol Walkthrough
kamaelian
 
Sharing Data and Services Safely in Concurrent Systems using Kamaelia
Sharing Data and Services Safely in Concurrent Systems using KamaeliaSharing Data and Services Safely in Concurrent Systems using Kamaelia
Sharing Data and Services Safely in Concurrent Systems using Kamaelia
kamaelian
 
Practical concurrent systems made simple using Kamaelia
Practical concurrent systems made simple using KamaeliaPractical concurrent systems made simple using Kamaelia
Practical concurrent systems made simple using Kamaelia
kamaelian
 
Sociable Software
Sociable SoftwareSociable Software
Sociable Software
kamaelian
 
Kamaelia Grey
Kamaelia GreyKamaelia Grey
Kamaelia Grey
kamaelian
 
Open Source at the BBC: When, Why, Why not & How
Open Source at the BBC: When, Why, Why not & HowOpen Source at the BBC: When, Why, Why not & How
Open Source at the BBC: When, Why, Why not & How
kamaelian
 
Open Source at the BBC
Open Source at the BBCOpen Source at the BBC
Open Source at the BBC
kamaelian
 
Kamaelia - Fave 2005
Kamaelia - Fave 2005Kamaelia - Fave 2005
Kamaelia - Fave 2005
kamaelian
 
SWP - A Generic Language Parser
SWP - A Generic Language ParserSWP - A Generic Language Parser
SWP - A Generic Language Parser
kamaelian
 
Kamaelia - Networking Using Generators
Kamaelia - Networking Using GeneratorsKamaelia - Networking Using Generators
Kamaelia - Networking Using Generators
kamaelian
 
Timeshift Everything, Miss Nothing - Mashup your PVR with Kamaelia
Timeshift Everything, Miss Nothing - Mashup your PVR with KamaeliaTimeshift Everything, Miss Nothing - Mashup your PVR with Kamaelia
Timeshift Everything, Miss Nothing - Mashup your PVR with Kamaelia
kamaelian
 
Kamaelia Internals
Kamaelia InternalsKamaelia Internals
Kamaelia Internals
kamaelian
 
Managing Creativity
Managing CreativityManaging Creativity
Managing Creativity
kamaelian
 
Building systems with Kamaelia
Building systems with KamaeliaBuilding systems with Kamaelia
Building systems with Kamaelia
kamaelian
 
Free software: How does it work?
Free software: How does it work?Free software: How does it work?
Free software: How does it work?
kamaelian
 
The Selfish Programmer
The Selfish ProgrammerThe Selfish Programmer
The Selfish Programmer
kamaelian
 
Ad

Recently uploaded (20)

Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 

Scaling Streaming - Concepts, Research, Goals

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