Slide 1

Slide 1 text

Cluecon – Tuesday 7th August 2012 Mark Webster - Senior Voice Architect Email: [email protected]

Slide 2

Slide 2 text

• UK based Conference Service Provider (CSP) • Founded 2003 • 50+ employees • 8 million+ minutes a week • Turnover 2012 predicted $20m • Diversifying into UC • Telco and DID provider • powwownow.com

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

• Server side development platform designed for building dynamic network applications • Built on Google’s V8 Javascript Engine • Adds Process, File and Network I/O APIs to V8 • Fast – V8 offers Javascript performance wins “for free” • Fast by Design – event driven non-blocking I/O -> high concurrency • Scalable - data-intensive real-time applications across distributed devices • Lightweight and efficient • Supports heavy I/O • Event loop - memory efficient

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

• Not just for the browser • Expressive and powerful dynamic object-oriented general-purpose language • Prototypal (not “class”) inheritance • Functions are first class objects • Code is data

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

• Multiple components functioning independently • Separate proprietary conference bridges  No failover  Expensive  Difficult to manage  Impossible to customise  8000 Hz G.711only  Not scalable • SBCs – PJSIP based  Logic and media in same place  Difficult to upgrade and customise  No hot failover • IVR servers - Freeswitch  Very reliable  Completely scriptable

Slide 26

Slide 26 text

Node.js!

Slide 27

Slide 27 text

• Separation of logic from audio components • “Dumb” audio mixers  Hot failover  Runs on inexpensive commodity servers  Nothing to manage  Small basic set of intrinsic behaviours  8000 to 32000 Hz  Highly scalable • SBC  Just an audio media relay + dsp  Removed all signalling and routing logic • “Brain”  Centralised logic and signalling  Management of SBCs and mixers in one place  Infinitely scriptable and customisable  Hot failover between instances • IVRs  Freeswitch is already perfect for our purposes!

Slide 28

Slide 28 text

• Can choke under heavy load – unresponsive during garbage collection • No heavy duty computation • Just event/response • Async I/O model • Can mitigate by moving some of the core functionality into C compiled Node modules

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

• Float both the IP address and the MAC address  Avoid OS/device-specific ARP cache behaviour  Instant re-routing between physical devices on the “same switch” • macvlan kernel module to create virtual ethernet device • Brain uses VIP for SIP signalling, & control API • SBCs use VIPs for RTP / media

Slide 32

Slide 32 text

• “Brain” creates compressed JSON objects containing everything needed to recreate:  each call - sent to the SBC carrying the call  each conference - sent to the mixer bridging the conference

Slide 33

Slide 33 text

• If brain fails or is removed from service  no interruption in audio  all components retry connection to brain IP until success  standby brain takes the Virtual IP & MAC addresses

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

• Need not be loaded as modules. Node gives us the ability to run external sandboxed scripts: • Expose application functions & data through sandbox object • Execute script to expose its functions & data to application though sandbox object

Slide 36

Slide 36 text

• Modules are cached by Node, but you can: • The next time you require() the module, it is reloaded from disk • But what about data persistence?  Store module data in global shared object created in main file:

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

• One TX thread + one RX thread per network device  can have multiple threads per device if CPU-bound (eg, transcoding) • Custom UDP/IP stack built on Linux's "PACKET_MMAP“  same mechanism used by pcap / tcpdump  but using "TX_RING" to send ethernet frames  avoids kernel context switching when sending/receiving packets  avoids BSD sockets entirely  create/remove VIPs, MACs, IP routes easily and instantly in user-space  Brain therefore has comprehensive control over network behaviour of SBCs • Custom built & modified kernel  remove all unneeded network layers / protocols from kernel processing  instant 30-40% increase in packet rate  custom IOCTL to force PACKET_MMAP to front of network processing chain  custom IOCTL to disable generation of ICMP UNREACHABLE • Gigabit saturation per CPU core / network device pair  7-figure packet rates on a $1500 server

Slide 39

Slide 39 text

• Brain config defines port ranges for RTP/media  each port range represents a slice of audio "capacity“  SBCs can carry multiple port ranges • Brain gives each SBC some port ranges & associated VIPs • SBC <-> Brain TCP connection, with very low keep-alive timer • If SBC is removed from service (or crashes), the Brain:  removes port range from SBC  assigns port range to least-busy remaining SBC  audio interruption almost undetectable

Slide 40

Slide 40 text

• SSE4 optimised  5000 x 8kHz calls mixed per CPU core  that's 1650 conferences of 3 calls each (worst case)  $1500 server hardware • Shared NFS mount for audio recordings / prompts • No need for VIPs  SBC is only device which talks audio to Mixer  Brain therefore updates SBCs with new Mixer IP upon failure • Almost undetectable failover  Any audio prompt currently playing would be cut off  Audio recording barely interrupted

Slide 41

Slide 41 text

• Fully featured suite of libraries  Audio processing (VAD, AGC, Noise-sup, PLC, AEC, and more  Audio device management  Video encoding  Network transport • Based on GIPS but for free! • Aimed at desktop/mobile developers using API  BUT easy to commandeer specific low-level components for our purposes • Low-level implementation written by skilled DSP engineers  we've re-implemented a few key components in SSE4 for speed • Future client development  browser integration for Audio/Video, a leap above HTML5  High level API – can be used by web and mobile developers • Future video development?

Slide 42

Slide 42 text

• Rapid prototyping and development • Can be clumsy  Loose typing can lead to object hell!  Nested call backs – needs to understand to avoid • Thriving developer community • 10,000+ Node modules available • Still relatively young but maturing fast • Complete scriptability is the future of telephony – not just for callflows or IVR

Slide 43

Slide 43 text

• Opus codec • SBC already in production for 20% of calls • Bridge already in production for our UC product (codename Visualise) • Needs some refactoring of code  Extended prototype  Lessons learned • Will roll out for various services Q4 2012 • Expect to start full rollout Q1 2013 • Further integration into Visualise and customer console (MyPowwownow) • Open Source SIP.js wrapper • Look at Open Sourcing more

Slide 44

Slide 44 text

Cluecon – Tuesday 7th August 2012 Mark Webster - Senior Voice Architect Email: [email protected]