SlideShare a Scribd company logo
1 of 31
Download to read offline
“Parsing binaries and protocols 
    with erlang ?!”


      Bhasker V Kode
      co­founder  & CTO at hover.in

      at foss.in
      December 4th, 2009
                                
                                      http://developers.hover.in
“WHY ... ?!”




                                                                
    foss.in/2009                                                                                        http://developers.hover.in
“BUT I'm BUILDING webapps !?!”




                                                                
    foss.in/2009                                                                                        http://developers.hover.in
“Everything's quick enough :D”




                                                                
    foss.in/2009                                                                                        http://developers.hover.in
“doh!”




                                                                
    foss.in/2009                                                                                        http://developers.hover.in
“ha! ofcourse i knew that...
        err.... but people scale...
        that's what they do ..... 
        that's our way out !!! 
        scaling out ...
        scaling up ...
        auto scaling even...!!!
 
        : O ”                                                   
    foss.in/2009                                                                                        http://developers.hover.in
“scale UP ...!
        more RAM seems to stop those 
        stall those silly CPU­unit warnings 
        my hosting provider gives...

        bring on those infinite loops & 
        polling crons. RealTimeWeb FTW!”
                                                                
    foss.in/2009                                                                                        http://developers.hover.in
“scaling OUT , maybe with a 
        distributed filesystem
        and figure out a way for nodes to 
        talk, and... Replication... and 
        location transparency during 
        weekends... and  commodity 
        hardware which i can't pay for ”
                                                                
    foss.in/2009                                                                                        http://developers.hover.in
More data becoming archival 
      NOT by choice, but forced to. 

      Not pushed to handling streams of 
      data well ( even hadoop!) #bigdata 

      If you're not compromising, you're 
      not pushing enough. Disk's loss 
      must be some else's gain. 
      fixed­length eg's at fb, twitter, google                  
    foss.in/2009                                                                                        http://developers.hover.in
Erlang for RAM
             on the web is the new
                             Embedded C




                                                                
    foss.in/2009                                                                                        http://developers.hover.in
“THE NEWS TODAY. Once popular 
        retro format 'binary' continues to 
        go unnoticed after brief sightings 
        on wallpapers during the matrix 
        trilogy ....”
        pssst! in files of any mime/content type
        in db's that accept binary
        in RAM, via caching engines
        compact for n/w transfer & storage
 
        the answer to unicode                                   
    foss.in/2009                                                                                        http://developers.hover.in
“fine! Binaries are everywhere, 
        disk's are not keeping up, and i've 
        got more cores on my nodes every 
        year.”



                                                                
    foss.in/2009                                                                                        http://developers.hover.in
“But i'm not still not going near a  
      strict, dynamically typed functional 
      programming language with 
      support for concurrency, 
      communication, and distribution, 
      automatic memory management & 
      supports multiple platforms !!!”
                                                                
    foss.in/2009                                                                                        http://developers.hover.in
Erlang!!!

        over­rated ?
                             OR
                               under­appreciated ?


        “ [ 87, 84, 70]  :O !”
                                                                
    foss.in/2009                                                                                        http://developers.hover.in
What happens when you start a erlang shell  . SMP did'nt exist before erlang build R11 ('06)
                                                                  
      foss.in/2009                                                                                        http://developers.hover.in
“ahh... so processes are pseudo 
       threads in the erlang VM that are 
       light weight & the base of erlang 
       programs having their own heap or 
       message inbox & are meant for 
       message passing erlang 
       primitaves. Also the developer can 
       configure how many cores are 
       used based on # of schedulers, 
       which run process's.
                                                                
    foss.in/2009                                                                                        http://developers.hover.in
Max of 1024 schedulers can be set =>  your erlang src today should utilize box's upto 1024 cores
                                                                    
        foss.in/2009                                                                                        http://developers.hover.in
Let M=  msgs to random users
      Let N= 100,000 users
      Route M msgs to right N users !
      typical one­node approach : 
      for i to M
        for j to N 
          if match, add_update
      actor approach: 
      N concurrent processes listening to all msgs 
      As new msg arrives, msg pass to all N pids
      in each concurrent process: if match, add_update
                                                                
    foss.in/2009                                                                                        http://developers.hover.in
3 papers to rule them all & 1 garbage collection method to free them!
                                                                 
     foss.in/2009                                                                                        http://developers.hover.in
3 papers to rule them all & 1 garbage collection method to free them!
                                                                 
     foss.in/2009                                                                                        http://developers.hover.in
3 papers to rule them all & 1 garbage collection method to free them!
                                                                 
     foss.in/2009                                                                                        http://developers.hover.in
EUREKA!!! we have a winner 
                                                                
    foss.in/2009                                                                                        http://developers.hover.in
“ahh... so this is what the no 
        shared memory in erlang, or light 
        weight process's being garbage 
        collected easily since they dont 
        have references to data in each 
        other's process heap, & messages  
        copied or shared based on it's 
        size, likelihood of reuse and also 
        optimized for binary. tellmemore!!”
                                                                
    foss.in/2009                                                                                        http://developers.hover.in
“How do you spawn a process?”




                                                                
    foss.in/2009                                                                                        http://developers.hover.in
“Where can you spawn a 
      process?”




                                                                
    foss.in/2009                                                                                        http://developers.hover.in
“Can a spawned process talk back 
      to the callee?”




                                                                
    foss.in/2009                                                                                        http://developers.hover.in
“Can a spawned process listen as 
      long as i want it to?”

      “Can a spawned process stop 
      listening when I want it to?”

      “Can a spawned process spawn 
      more processes?”

                                                                
    foss.in/2009                                                                                        http://developers.hover.in
“So though erlang gives a library 
      called OTP & a db called mnesia for 
      making life easier ­ you can parse 
      or create binaries easily, make 
      client­server programs, distributed 
      rpc calls, tail­recursive servers, 
      message/priority queue's for 
      flowcontrol, talk to ports and other 
      lang's, or create any data structure 
      explicitly (a) in­memory (b)on­disk 
      of any connected node!
                                                                
    foss.in/2009                                                                                        http://developers.hover.in
“show me the demo's”
●   Process related
        –   Message queue's , Client – server
        –   RPC , Timeouts
●   Binary
        –   Binary pattern matching, Parse swf/mp3 for metadata
        –   Networking, comm. with C, Tokyocabinet client eg.
●   Process + Binary!
        –   Building a production ready in­memory CDN 
            consistently faster than Am4z0n cl0udfr0nt, in stages
            open & gzip < concat js's < inmemory < streaming?
                                       
        foss.in/2009                                                                                        http://developers.hover.in
“Binary pattern matching ?”
    <<Value:Size/Type­Signedness­Endianism­
    unit:Unit>>

    <<1:32>>                 = <<0,0,0,1>.
    <<1:32/unsigned-little>> = <<1,0,0,0>.
    <<_:8,“mnesia”/binary>> = <<”Amnesia”>>.


    So <<Bin>> could be unicode characters 
    ( English, hindi, tamil ) or JPG's or http headers 
    or basically segments of binaries

    NewBinary=<<Segment1,Segment2>>.
                                                                
    foss.in/2009                                                                                        http://developers.hover.in
summary of tech at hover.in
●       LYME stack since ~dec 07 , 4 (­1) nodes (64bit 4GB)
●       python crawler + associated NLP parsers, index's now 
        in tokyo cabinet, inverted index's in erlang 's mnesia db 
        with binaries of 5 diff indian languages + multiple 
        content­types, cpu time­splicing algo's, priority queue's 
        for heat­seeking algo, flowcontrol, caching engines, 
        cyclic queues, map­reduces with non­blocking gathers, 
        headless­firefox for thumbnails, patches to 
        tokyocabinet client 'medici'
●       Beta in Jan 09, 1 million hovers/month in May'09
●
     
        2­4 developers + several interns across ~2 years 
                                   
        foss.in/2009                                                                                        http://developers.hover.in

More Related Content

What's hot

SD, a P2P bug tracking system
SD, a P2P bug tracking systemSD, a P2P bug tracking system
SD, a P2P bug tracking system
Jesse Vincent
 
Linux, Apache, Mysql, PHP
Linux, Apache, Mysql, PHPLinux, Apache, Mysql, PHP
Linux, Apache, Mysql, PHP
webhostingguy
 

What's hot (20)

SD, a P2P bug tracking system
SD, a P2P bug tracking systemSD, a P2P bug tracking system
SD, a P2P bug tracking system
 
Combining the strength of erlang and Ruby
Combining the strength of erlang and RubyCombining the strength of erlang and Ruby
Combining the strength of erlang and Ruby
 
Chat bot-automation-hubot
Chat bot-automation-hubotChat bot-automation-hubot
Chat bot-automation-hubot
 
At Scale With Style
At Scale With StyleAt Scale With Style
At Scale With Style
 
Devignition 2011
Devignition 2011Devignition 2011
Devignition 2011
 
JUDCon 2010 Boston : BoxGrinder
JUDCon 2010 Boston : BoxGrinderJUDCon 2010 Boston : BoxGrinder
JUDCon 2010 Boston : BoxGrinder
 
TorqueBox for Rubyists
TorqueBox for RubyistsTorqueBox for Rubyists
TorqueBox for Rubyists
 
JUDCon 2010 Boston : TorqueBox
JUDCon 2010 Boston : TorqueBoxJUDCon 2010 Boston : TorqueBox
JUDCon 2010 Boston : TorqueBox
 
TorqueBox at DC:JBUG - November 2011
TorqueBox at DC:JBUG - November 2011TorqueBox at DC:JBUG - November 2011
TorqueBox at DC:JBUG - November 2011
 
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
 
Python in Action (Part 2)
Python in Action (Part 2)Python in Action (Part 2)
Python in Action (Part 2)
 
Go for SysAdmins - LISA 2015
Go for SysAdmins - LISA 2015Go for SysAdmins - LISA 2015
Go for SysAdmins - LISA 2015
 
Expert JavaScript Programming
Expert JavaScript ProgrammingExpert JavaScript Programming
Expert JavaScript Programming
 
Jruby a Pi and a database
Jruby a Pi and a databaseJruby a Pi and a database
Jruby a Pi and a database
 
Toplog candy elves - HOCM Talk
Toplog candy elves - HOCM TalkToplog candy elves - HOCM Talk
Toplog candy elves - HOCM Talk
 
Spacebrew: The Overview
Spacebrew: The OverviewSpacebrew: The Overview
Spacebrew: The Overview
 
Complex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBoxComplex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBox
 
Intro to-ansible-sep7-meetup
Intro to-ansible-sep7-meetupIntro to-ansible-sep7-meetup
Intro to-ansible-sep7-meetup
 
Ice Age melting down: Intel features considered usefull!
Ice Age melting down: Intel features considered usefull!Ice Age melting down: Intel features considered usefull!
Ice Age melting down: Intel features considered usefull!
 
Linux, Apache, Mysql, PHP
Linux, Apache, Mysql, PHPLinux, Apache, Mysql, PHP
Linux, Apache, Mysql, PHP
 

Viewers also liked

Viewers also liked (20)

end user programming & yahoo pipes
end user programming & yahoo pipesend user programming & yahoo pipes
end user programming & yahoo pipes
 
Recursion & Erlang, FunctionalConf 14, Bangalore
Recursion & Erlang, FunctionalConf 14, BangaloreRecursion & Erlang, FunctionalConf 14, Bangalore
Recursion & Erlang, FunctionalConf 14, Bangalore
 
Functional Programing
Functional ProgramingFunctional Programing
Functional Programing
 
Beam me up, Scotty
Beam me up, ScottyBeam me up, Scotty
Beam me up, Scotty
 
QCON SP 2016 - Elixir: Tolerância a Falhas para Adultos
QCON SP 2016 - Elixir: Tolerância a Falhas para AdultosQCON SP 2016 - Elixir: Tolerância a Falhas para Adultos
QCON SP 2016 - Elixir: Tolerância a Falhas para Adultos
 
There Are Literally Thousands of Erlang Projects
There Are Literally Thousands of Erlang ProjectsThere Are Literally Thousands of Erlang Projects
There Are Literally Thousands of Erlang Projects
 
High Performance Erlang - Pitfalls and Solutions
High Performance Erlang - Pitfalls and SolutionsHigh Performance Erlang - Pitfalls and Solutions
High Performance Erlang - Pitfalls and Solutions
 
The Erlang Programming Language
The Erlang Programming LanguageThe Erlang Programming Language
The Erlang Programming Language
 
Elixir - Easy fun for busy developers @ Devoxx 2016
Elixir - Easy fun for busy developers @ Devoxx 2016Elixir - Easy fun for busy developers @ Devoxx 2016
Elixir - Easy fun for busy developers @ Devoxx 2016
 
Erlang Supervision Trees
Erlang Supervision TreesErlang Supervision Trees
Erlang Supervision Trees
 
Erlang containers
Erlang containersErlang containers
Erlang containers
 
FunctionalConf '16 Robert Virding Erlang Ecosystem
FunctionalConf '16 Robert Virding Erlang EcosystemFunctionalConf '16 Robert Virding Erlang Ecosystem
FunctionalConf '16 Robert Virding Erlang Ecosystem
 
Elixir intro
Elixir introElixir intro
Elixir intro
 
Repeating History...On Purpose...with Elixir
Repeating History...On Purpose...with ElixirRepeating History...On Purpose...with Elixir
Repeating History...On Purpose...with Elixir
 
Erlang и n2o. Web-разработка без JavaScript
Erlang и n2o. Web-разработка без JavaScriptErlang и n2o. Web-разработка без JavaScript
Erlang и n2o. Web-разработка без JavaScript
 
RabbitMQ: Message queuing that works
RabbitMQ: Message queuing that worksRabbitMQ: Message queuing that works
RabbitMQ: Message queuing that works
 
Rethink programming: a functional approach
Rethink programming: a functional approachRethink programming: a functional approach
Rethink programming: a functional approach
 
SE2016 Exotic Valerii Vasylkov "Erlang. Measurements and benefits"
SE2016 Exotic Valerii Vasylkov "Erlang. Measurements and benefits"SE2016 Exotic Valerii Vasylkov "Erlang. Measurements and benefits"
SE2016 Exotic Valerii Vasylkov "Erlang. Measurements and benefits"
 
Erlang and Elixir
Erlang and ElixirErlang and Elixir
Erlang and Elixir
 
Erlang sem enrolação
Erlang sem enrolaçãoErlang sem enrolação
Erlang sem enrolação
 

Similar to Parsing binaries and protocols with erlang

Midwest php 2013 deploying php on paas- why & how
Midwest php 2013   deploying php on paas- why & howMidwest php 2013   deploying php on paas- why & how
Midwest php 2013 deploying php on paas- why & how
dotCloud
 
Deploying PHP on PaaS: Why and How?
Deploying PHP on PaaS: Why and How?Deploying PHP on PaaS: Why and How?
Deploying PHP on PaaS: Why and How?
Docker, Inc.
 
Intro To Linux
Intro To LinuxIntro To Linux
Intro To Linux
techlug
 
Follow your nose: history frames the future
Follow your nose: history frames the futureFollow your nose: history frames the future
Follow your nose: history frames the future
Alan Dix
 

Similar to Parsing binaries and protocols with erlang (20)

Guidance, Code and Education: ScalaCenter and the Scala Community, Heather Mi...
Guidance, Code and Education: ScalaCenter and the Scala Community, Heather Mi...Guidance, Code and Education: ScalaCenter and the Scala Community, Heather Mi...
Guidance, Code and Education: ScalaCenter and the Scala Community, Heather Mi...
 
Make ruby talk to your users - literally
Make ruby talk to your users - literallyMake ruby talk to your users - literally
Make ruby talk to your users - literally
 
Transforming WebSockets
Transforming WebSocketsTransforming WebSockets
Transforming WebSockets
 
Perl Myths 200909
Perl Myths 200909Perl Myths 200909
Perl Myths 200909
 
Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...
Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...
Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...
 
Midwest php 2013 deploying php on paas- why & how
Midwest php 2013   deploying php on paas- why & howMidwest php 2013   deploying php on paas- why & how
Midwest php 2013 deploying php on paas- why & how
 
F/LOSS in Norwegian libraries
F/LOSS in Norwegian librariesF/LOSS in Norwegian libraries
F/LOSS in Norwegian libraries
 
IMCSummit 2015 - Day 1 Developer Track - Open-Source In-Memory Platforms: Ben...
IMCSummit 2015 - Day 1 Developer Track - Open-Source In-Memory Platforms: Ben...IMCSummit 2015 - Day 1 Developer Track - Open-Source In-Memory Platforms: Ben...
IMCSummit 2015 - Day 1 Developer Track - Open-Source In-Memory Platforms: Ben...
 
2014 feb 24_big_datacongress_hadoopsession1_hadoop101
2014 feb 24_big_datacongress_hadoopsession1_hadoop1012014 feb 24_big_datacongress_hadoopsession1_hadoop101
2014 feb 24_big_datacongress_hadoopsession1_hadoop101
 
Deploying PHP on PaaS: Why and How?
Deploying PHP on PaaS: Why and How?Deploying PHP on PaaS: Why and How?
Deploying PHP on PaaS: Why and How?
 
Intro To Linux
Intro To LinuxIntro To Linux
Intro To Linux
 
Webtech 17.11.2009
Webtech 17.11.2009Webtech 17.11.2009
Webtech 17.11.2009
 
Perl Myths 200802 with notes (OUTDATED, see 200909)
Perl Myths 200802 with notes (OUTDATED, see 200909)Perl Myths 200802 with notes (OUTDATED, see 200909)
Perl Myths 200802 with notes (OUTDATED, see 200909)
 
What happens when firefox crashes?
What happens when firefox crashes?What happens when firefox crashes?
What happens when firefox crashes?
 
Snakes on the Web; Developing web applications in python
Snakes on the Web; Developing web applications in pythonSnakes on the Web; Developing web applications in python
Snakes on the Web; Developing web applications in python
 
Introduction to linux
Introduction to linuxIntroduction to linux
Introduction to linux
 
DEF CON 27 - workshop - RYAN CHAPMAN - understanding and analyzing weaponized...
DEF CON 27 - workshop - RYAN CHAPMAN - understanding and analyzing weaponized...DEF CON 27 - workshop - RYAN CHAPMAN - understanding and analyzing weaponized...
DEF CON 27 - workshop - RYAN CHAPMAN - understanding and analyzing weaponized...
 
How we dockerized a startup
How we dockerized a startupHow we dockerized a startup
How we dockerized a startup
 
Follow your nose: history frames the future
Follow your nose: history frames the futureFollow your nose: history frames the future
Follow your nose: history frames the future
 
The KNOT DNS Server
The KNOT DNS ServerThe KNOT DNS Server
The KNOT DNS Server
 

Recently uploaded

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 

Parsing binaries and protocols with erlang

  • 1. “Parsing binaries and protocols  with erlang ?!” Bhasker V Kode co­founder  & CTO at hover.in at foss.in December 4th, 2009     http://developers.hover.in
  • 2. “WHY ... ?!”     foss.in/2009                                                                                        http://developers.hover.in
  • 3. “BUT I'm BUILDING webapps !?!”     foss.in/2009                                                                                        http://developers.hover.in
  • 4. “Everything's quick enough :D”     foss.in/2009                                                                                        http://developers.hover.in
  • 5. “doh!”     foss.in/2009                                                                                        http://developers.hover.in
  • 6. “ha! ofcourse i knew that... err.... but people scale... that's what they do .....  that's our way out !!!  scaling out ... scaling up ... auto scaling even...!!!   : O ”   foss.in/2009                                                                                        http://developers.hover.in
  • 7. “scale UP ...! more RAM seems to stop those  stall those silly CPU­unit warnings  my hosting provider gives... bring on those infinite loops &  polling crons. RealTimeWeb FTW!”     foss.in/2009                                                                                        http://developers.hover.in
  • 8. “scaling OUT , maybe with a  distributed filesystem and figure out a way for nodes to  talk, and... Replication... and  location transparency during  weekends... and  commodity  hardware which i can't pay for ”     foss.in/2009                                                                                        http://developers.hover.in
  • 9. More data becoming archival  NOT by choice, but forced to.  Not pushed to handling streams of  data well ( even hadoop!) #bigdata  If you're not compromising, you're  not pushing enough. Disk's loss  must be some else's gain.    fixed­length eg's at fb, twitter, google   foss.in/2009                                                                                        http://developers.hover.in
  • 10. Erlang for RAM on the web is the new Embedded C     foss.in/2009                                                                                        http://developers.hover.in
  • 11. “THE NEWS TODAY. Once popular  retro format 'binary' continues to  go unnoticed after brief sightings  on wallpapers during the matrix  trilogy ....” pssst! in files of any mime/content type in db's that accept binary in RAM, via caching engines compact for n/w transfer & storage   the answer to unicode   foss.in/2009                                                                                        http://developers.hover.in
  • 12. “fine! Binaries are everywhere,  disk's are not keeping up, and i've  got more cores on my nodes every  year.”     foss.in/2009                                                                                        http://developers.hover.in
  • 13. “But i'm not still not going near a   strict, dynamically typed functional  programming language with  support for concurrency,  communication, and distribution,  automatic memory management &  supports multiple platforms !!!”     foss.in/2009                                                                                        http://developers.hover.in
  • 14. Erlang!!! over­rated ?                      OR under­appreciated ? “ [ 87, 84, 70]  :O !”     foss.in/2009                                                                                        http://developers.hover.in
  • 15. What happens when you start a erlang shell  . SMP did'nt exist before erlang build R11 ('06)     foss.in/2009                                                                                        http://developers.hover.in
  • 16. “ahh... so processes are pseudo  threads in the erlang VM that are  light weight & the base of erlang  programs having their own heap or  message inbox & are meant for  message passing erlang  primitaves. Also the developer can  configure how many cores are  used based on # of schedulers,  which run process's.     foss.in/2009                                                                                        http://developers.hover.in
  • 17. Max of 1024 schedulers can be set =>  your erlang src today should utilize box's upto 1024 cores     foss.in/2009                                                                                        http://developers.hover.in
  • 18. Let M=  msgs to random users Let N= 100,000 users Route M msgs to right N users ! typical one­node approach :  for i to M   for j to N      if match, add_update actor approach:  N concurrent processes listening to all msgs  As new msg arrives, msg pass to all N pids in each concurrent process: if match, add_update     foss.in/2009                                                                                        http://developers.hover.in
  • 19. 3 papers to rule them all & 1 garbage collection method to free them!     foss.in/2009                                                                                        http://developers.hover.in
  • 20. 3 papers to rule them all & 1 garbage collection method to free them!     foss.in/2009                                                                                        http://developers.hover.in
  • 21. 3 papers to rule them all & 1 garbage collection method to free them!     foss.in/2009                                                                                        http://developers.hover.in
  • 22. EUREKA!!! we have a winner      foss.in/2009                                                                                        http://developers.hover.in
  • 23. “ahh... so this is what the no  shared memory in erlang, or light  weight process's being garbage  collected easily since they dont  have references to data in each  other's process heap, & messages   copied or shared based on it's  size, likelihood of reuse and also  optimized for binary. tellmemore!!”     foss.in/2009                                                                                        http://developers.hover.in
  • 24. “How do you spawn a process?”     foss.in/2009                                                                                        http://developers.hover.in
  • 25. “Where can you spawn a  process?”     foss.in/2009                                                                                        http://developers.hover.in
  • 26. “Can a spawned process talk back  to the callee?”     foss.in/2009                                                                                        http://developers.hover.in
  • 27. “Can a spawned process listen as  long as i want it to?” “Can a spawned process stop  listening when I want it to?” “Can a spawned process spawn  more processes?”     foss.in/2009                                                                                        http://developers.hover.in
  • 28. “So though erlang gives a library  called OTP & a db called mnesia for  making life easier ­ you can parse  or create binaries easily, make  client­server programs, distributed  rpc calls, tail­recursive servers,  message/priority queue's for  flowcontrol, talk to ports and other  lang's, or create any data structure  explicitly (a) in­memory (b)on­disk  of any connected node!     foss.in/2009                                                                                        http://developers.hover.in
  • 29. “show me the demo's” ● Process related – Message queue's , Client – server – RPC , Timeouts ● Binary – Binary pattern matching, Parse swf/mp3 for metadata – Networking, comm. with C, Tokyocabinet client eg. ● Process + Binary! – Building a production ready in­memory CDN  consistently faster than Am4z0n cl0udfr0nt, in stages   open & gzip < concat js's < inmemory < streaming?   foss.in/2009                                                                                        http://developers.hover.in
  • 30. “Binary pattern matching ?” <<Value:Size/Type­Signedness­Endianism­ unit:Unit>> <<1:32>> = <<0,0,0,1>. <<1:32/unsigned-little>> = <<1,0,0,0>. <<_:8,“mnesia”/binary>> = <<”Amnesia”>>. So <<Bin>> could be unicode characters  ( English, hindi, tamil ) or JPG's or http headers  or basically segments of binaries NewBinary=<<Segment1,Segment2>>.     foss.in/2009                                                                                        http://developers.hover.in
  • 31. summary of tech at hover.in ● LYME stack since ~dec 07 , 4 (­1) nodes (64bit 4GB) ● python crawler + associated NLP parsers, index's now  in tokyo cabinet, inverted index's in erlang 's mnesia db  with binaries of 5 diff indian languages + multiple  content­types, cpu time­splicing algo's, priority queue's  for heat­seeking algo, flowcontrol, caching engines,  cyclic queues, map­reduces with non­blocking gathers,  headless­firefox for thumbnails, patches to  tokyocabinet client 'medici' ● Beta in Jan 09, 1 million hovers/month in May'09 ●   2­4 developers + several interns across ~2 years    foss.in/2009                                                                                        http://developers.hover.in