SlideShare uma empresa Scribd logo
1 de 55
Baixar para ler offline
Saturday, March 23, 13
Brought to You By


             Marc Campbell                 Martin Hald




                            Thanks Fernanado!
Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                2013-­‐03-­‐20	
  15:49:06.243	
  [info]	
  <0.2780.0>@tt_account:came_online:457	
  
                    	
  	
  	
  Account	
  came	
  online:	
  c2a8c653-­‐d4c2-­‐4d3d-­‐ad2s-­‐bd488cd9ec81/
                                      	
  	
  	
  	
  	
  	
  	
  	
  e5e752ef-­‐79ae-­‐4e26-­‐9b6b-­‐654e9926c56e




Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                             Live Demo




Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                              Concepts




Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                         Whats in a Log Entry?
                         Lager
                     •   Timestamp
                     •   Severity
                     •   Log Text

                    •    Module
                    •    Function
                    •    Line Number
                    •    Process ID



Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                         Whats in a Log Entry?
                         Lager                  Popcorn
                     •   Timestamp          •   Role
                     •   Severity           •   Node
                     •   Log Text           •   Version

                    •    Module                 Coming Soon
                    •    Function           •   Caller Information
                    •    Line Number        •   App Metrics
                    •    Process ID         •   Env Metrics



Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                         Lager Log Messages

         	
  88	
  2013-­‐03-­‐16	
  08:29:46.781	
  [info]	
  
     <0.362.0>@avatar:req_handler:123	
  Starting	
  
                          avatar	
  rendering




Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                         Popcorn Log Message

         	
  88	
  2013-­‐03-­‐16	
  08:29:46.781	
  [info]	
  
     <0.362.0>@avatar:req_handler:123	
  Starting	
  
      #customer_request	
  (avatar	
  rendering)	
  for	
  
                                 @mhald




Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                         From Log Entry to Alert

                           Log
                                                           Alert
                         Message


                                   •   Error
                                   •   Warning
                                   •   Critical
                                   •   Crash
                                   •   #identified_topic


Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                    Alerts Groups Critical Log Entries



                           #login_failed for @fearing, returning #404


                               #login_failed for @ga, returning #404    Alert
                         #login_success for @bhatia, returning #200




Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                           Address Scheme

                    Role     Version        Module   Line Number

          XMPP v2.0.15 user_auth : 54




Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




      Crashes have no line number

                http_hander:404	
             http_hander:404	
  
                  Bad	
  request	
               Bad	
  request	
  
                  <<“error”>>                   <<“api/v2”>>


                                http_hander:404	
  
                                  Bad	
  request	
  
        to ive
       u at                         ********
      A ci y
        o or
      ss m
     A e 0fc4cf26168b2a4b959d914682c10bc3
        M

Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                             Data Stream
            Structured                      Unstructured
                • Role                       • Identity
                • Node                       • Topic
                • Version
                • Severity

Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                         Acme Calculators




Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                         Build Popcorn
       git	
  clone	
  git@github.com:marccampbell/
       popcorn.git
       cd	
  popcorn
       ./rebar	
  get-­‐deps
       ./rebar	
  compile

       lessc	
  apps/popcorn/priv/css/popcorn.less	
  >	
  
       	
  	
  	
  	
  apps/popcorn/priv/css/popcorn.css

       ./rebar	
  generate	
  -­‐f


Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                            Configure Popcorn
      app.config
	
  	
  	
  	
  	
  	
  	
  	
  {http_auth_users,	
  	
  	
  [{<<"admin">>,	
  <<"password">>}]},
	
  	
  	
  	
  	
  	
  	
  	
  {outbound_notifiers,	
  [
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  {new_alert,	
  outbound_mailer,
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  [{options,	
  	
  	
  	
  	
  [{retries,	
  3},	
  {relay,	
  "smtp.gmail.com"},	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  {username,	
  "acme.popcorn@gmail.com"},	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  {password,	
  "PASSWORD"}]},
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  {from,	
  	
  	
  	
  	
  	
  	
  	
  	
  "acme@logwithpopcorn.com"},
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  {recipients,	
  	
  	
  ["your.email@domain.com"]},
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  {subject,	
  	
  	
  	
  	
  	
  "New	
  Alert	
  at	
  {{product}}	
  {{version}}"}
	
  	
  	
  	
  	
  	
  	
  	
  ]},




Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                         Hook in Popcorn
           Calculator app rebar.config

          {deps,	
  [
          	
  	
  ...
          	
  	
  {lager_popcorn_backend,	
  ".*",	
  {git,	
  
                   "git@github.com:marccampbell/
                   lager_popcorn_backend.git",	
  
                   "master"	
  }}
          	
  	
  ...
          ]}.


Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                                                   Hook in Popcorn
            Calculator application sys.config
   	
  %%	
  Lager	
  config
   	
  {lager,	
  [	
  {handlers,	
  [
   	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  {lager_console_backend,	
  none},
   	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  {lager_file_backend,	
  [	
  {"log/error.log",	
  
                                            error,	
  104857600,	
  "$D0",	
  5}	
  ]},
   	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  {lager_popcorn_backend,	
  [
   	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  {level,	
  	
  	
  	
  	
  	
  	
  	
  debug},
   	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  {popcorn_host,	
  "127.0.0.1"},
   	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  {popcorn_port,	
  9125},
   	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  {node_role,	
  	
  	
  	
  "Calculator"},
   	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  {node_version,	
  "1.0.7"}
   	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ]}
   	
  	
  	
  ]}




Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                                   Demo
     Using the Calculator HTTP API
      curl -v -X POST --data-urlencode "2 4 /" 
      http://calculator.logwithpopcorn.com/api/calculator
                                 15+
                                 93/
                                 5 2 - (will cause crash)
                                 22*
      See and try Popcorn at
            http://demo.logwithpopcorn.com/

Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                                            Customers




                                            Support


Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                                            Customers




                                            Support


Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                                                 Customers


                                   •   Identify edge case bugs

                                   •   Real-time alerting

                                   •   Logs as data streams



                                                  Support


Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                         Popcorn Design



Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                                  Ingesting


                                   Storage


                                 Rendering



Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                                      UDP or TCP or ...


                     Connectionless              Out of order   Dropped packets




                                                                       No
                         Quick
                                                                acknowledgements




Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                                      Ingesting Architecture


                          Client (lager)                       node_fsm




                         Client (winston)                      node_fsm
                                              udp_listener
                                              (gen_server)

                          Client (log4j)                       node_fsm




                           Client (...)                      node_fsm (...)




Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                                     Storage Architecture



                                          storage_monitor   storage_worker
                                            (gen_server)     (gen_server)
                     popcorn_app
                     (application)
                                           storage_sup      storage_worker
                                           (supervisor)      (gen_server)



                                                            storage_worker
                                                             (gen_server)




Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                         Storage gen_server behaviour


                           init([])	
  /	
  init([worker])
                           gen_server:handle_call/3
                           gen_server:handle_cast/2




Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




          handle_call
                   {counter_value,	
  Count}
                   {is_known_node,	
  Node_Name}
                   {get_alert,	
  Key}
                   {get_alerts,	
  Severity,	
  Sort}
                   {get_alert_keys,	
  Type}
                   {get_release_module_link,	
  Role,	
  Version,	
  Module}
                   {search_messages,	
  {...}}
                   {get_alert_timestamps,	
  Severities}




Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




          handle_cast
                   {expire_logs_matching,	
  Timestamp}
                   {send_recent_log_lines_matching,	
  Pid,	
  Count,	
  Filters}
                   {new_log_message,	
  #log_message}
                   {new_release_scm,	
  Record}
                   {new_alert,	
  Key,	
  #alert}
                   {new_alert_timestamp,	
  Key,	
  Severity,	
  #alert}
                   {new_alert_key,	
  Type,	
  Key}
                   {new_release_scm_mapping,	
  Record}
                   {delete_counter,	
  Counter}
                   {increment_counter,	
  Counter,	
  Increment_By}
                   {increment_counters,	
  Counters}
                   {add_node,	
  #popcorn_node}




Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                         Server Sent Events
                                            SSE
                         Browser                         Server
                                        HTTP Post

                         alert: {key: “001A”, seen:10}
                         node: {key: “xmpp@con8”, log_msgs:324}




Saturday, March 23, 13
SSE Events in JS
           $(function() {
              var streamSource = new EventSource("/dashboard/stream/{{stream_id}}");

                streamSource.addEventListener(
                   'update_counters',
                  function(event) {
                    var counters = JSON.parse(event.data)
                    // ...
                  });

                streamSource.addEventListener(
                   'new_node',
                  function(event) {
                    var counters = JSON.parse(event.data)
                    // ...
                  });


Saturday, March 23, 13
SSE Erlang Design
      http_stream_handler.erl
      -behavior(cowboy_http_handler).

                                                              Wait in
                  New Request Process




                                         init
                                                            receive loop

                                        handle   handle
                                                  path    Re
                                                               gis
                                                                  te
                                                     Ev              r
                                                       en
                                                          ts             fsm   node

                                                      One FSM per SSE client
Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




    server	
  {
    	
   listen	
  	
  	
  80;
    	
   server_name	
  popcorn.logwithpopcorn.com;

    	
      access_log	
  /var/log/nginx/popcorn_access.log;
    	
      error_log	
  /var/log/nginx/popcorn_error.log;

    	
      location	
  /	
  {
    	
      	
   proxy_pass	
  	
  http://localhost:9125;
    	
      	
   proxy_redirect	
  off;
    	
   	
   proxy_buffering	
  off;
    	
      	
      proxy_cache	
  off;
    	
      	
      proxy_set_header	
  Host	
  $host;
    	
      	
      proxy_set_header	
  X-­‐Real-­‐IP	
  $remote_addr;
    	
      	
      proxy_set_header	
  X-­‐Forwarded-­‐For	
  $proxy_add_x_forwarded_for;
    	
      	
      proxy_read_timeout	
  420;
    	
      }
    }

Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                             Wire Protocol
                         Standards & Efficiency



Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                                  Protobuffs
	
  	
  	
  	
  erlang:iolist_to_binary([
	
  	
  	
  	
  	
  	
  	
  	
  protobuffs:encode(1,	
  1,	
  uint32),	
  	
  	
  %%	
  Packet	
  version
	
  	
  	
  	
  	
  	
  	
  	
  protobuffs:encode(2,	
  atom_to_list(Node),	
  string),
	
  	
  	
  	
  	
  	
  	
  	
  protobuffs:encode(3,	
  Node_Role,	
  string),
	
  	
  	
  	
  	
  	
  	
  	
  protobuffs:encode(4,	
  Node_Version,	
  string),
	
  	
  	
  	
  	
  	
  	
  	
  protobuffs:encode(5,	
  lager_util:level_to_num(Severity),	
  uint32),
	
  	
  	
  	
  	
  	
  	
  	
  protobuffs:encode(6,	
  Message,	
  string),
	
  	
  	
  	
  	
  	
  	
  	
  protobuffs:encode(7,	
  opt(Module,	
  <<"">>),	
  string),
	
  	
  	
  	
  	
  	
  	
  	
  protobuffs:encode(8,	
  opt(Function,	
  <<"">>),	
  string),
	
  	
  	
  	
  	
  	
  	
  	
  protobuffs:encode(9,	
  opt(Line,	
  <<"">>),	
  string),
	
  	
  	
  	
  	
  	
  	
  	
  protobuffs:encode(10,	
  opt(Pid,	
  <<"">>),	
  string)
	
  	
  	
  	
  ]).




Saturday, March 23, 13
JSON
               encode_json_packet(Node)	
  -­‐>
               	
  	
  	
  	
  jiffy:encode({[
               	
  	
  	
  	
  	
  	
  	
  {packet_version,	
  1},
               	
  	
  	
  	
  	
  	
  	
  {node,	
  list_to_binary(Node)},
               	
  	
  	
  	
  	
  	
  	
  {role,	
  <<"calculator">>},
               	
  	
  	
  	
  	
  	
  	
  {version,	
  <<"0.0.1">>},
               	
  	
  	
  	
  	
  	
  	
  {severity,	
  128},
               	
  	
  	
  	
  	
  	
  	
  {message,	
  <<"Calculator	
  request	
  5	
  *	
  4">>},
               	
  	
  	
  	
  	
  	
  	
  {module,	
  <<"http_calculator">>},
               	
  	
  	
  	
  	
  	
  	
  {function,	
  <<"rpn">>},
               	
  	
  	
  	
  	
  	
  	
  {line,	
  <<"58">>},
               	
  	
  	
  	
  	
  	
  	
  {pid,	
  <<"">>}
               	
  	
  	
  	
  ]}).



Saturday, March 23, 13
Bits and Bytes

    ^H^A^Ropcorn@anduin.tigertext.me^Z
    calculator"^E0.0.1(^A2^XCalculator	
  request	
  5	
  *	
  
    4:^Ohttp_calculatorB^CrpnJ^B58R^@


   {"packet_version":1,	
  
   "node":"popcorn@anduin.tigertext.me",	
  
   "role":"calculator",	
  "version":"0.0.1",	
  "severity":128,	
  
   "message":"Calculator	
  request	
  5	
  *	
  4",	
  
   "module":"http_calculator",	
  
   "function":"rpn","line":"58","pid":""}

Saturday, March 23, 13
Processing Time
                                 Over 1,000,000 Requests on Apple Air with R16B


                                        JSON                     Protobuffs

                         12 us


                          9 us


                          6 us


                          3 us


                          0 us
                                      Encoding                        Decoding



Saturday, March 23, 13
Memory
                                                       3x
                                                     Me Le
                            JSON            Protobuffs m     ss
                                                         or
                                                            y
              400 bytes


              300 bytes


              200 bytes


              100 bytes


                  0 bytes
                                   Memory



Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                              Rendering Architecture


                                                    Plain Old
                Crossfilter             D3
                                                   Javascript




               Used only for
                 grouping
                                                  Store the grouped
              streaming data,         Rendering
                                                      data from
              destroyed every
               few seconds




Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                                                                          countsByPeriod




                         severitiesByPeriod   rolesByPeriod   nodesByPeriod




Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                         Scaling Popcorn



Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                                Scalability Goal

                         Handle n log messages per second



            10                 50           500       5000



Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                         Let’s Get Some Tools




Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                                            statsd &
                         rps (mhald)
                                            graphite




Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                                                             Chrome
                         dtop   redbug   statsd   graphite   Activity
                                                             Monitor




Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                                    Mnesia


                             UDP Receiving


                           Client (Browser)



Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                              Issue: Mnesia




Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




Saturday, March 23, 13
#POPCORN ERLANG_FACTORY @SF_BAY - 2013




                                 Issue: The Browser




                   Executing on the server        Executing in the browser
                                             vs
                          (Erlang)                      (Javascript)




Saturday, March 23, 13

Mais conteúdo relacionado

Último

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 

Último (20)

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 

Destaque

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Destaque (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

#Popcorn Erlang Factory @SF_Bay 2013

  • 2. Brought to You By Marc Campbell Martin Hald Thanks Fernanado! Saturday, March 23, 13
  • 3. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 2013-­‐03-­‐20  15:49:06.243  [info]  <0.2780.0>@tt_account:came_online:457        Account  came  online:  c2a8c653-­‐d4c2-­‐4d3d-­‐ad2s-­‐bd488cd9ec81/                e5e752ef-­‐79ae-­‐4e26-­‐9b6b-­‐654e9926c56e Saturday, March 23, 13
  • 4. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Live Demo Saturday, March 23, 13
  • 5. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Concepts Saturday, March 23, 13
  • 6. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Whats in a Log Entry? Lager • Timestamp • Severity • Log Text • Module • Function • Line Number • Process ID Saturday, March 23, 13
  • 7. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Whats in a Log Entry? Lager Popcorn • Timestamp • Role • Severity • Node • Log Text • Version • Module Coming Soon • Function • Caller Information • Line Number • App Metrics • Process ID • Env Metrics Saturday, March 23, 13
  • 8. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Lager Log Messages  88  2013-­‐03-­‐16  08:29:46.781  [info]   <0.362.0>@avatar:req_handler:123  Starting   avatar  rendering Saturday, March 23, 13
  • 9. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Popcorn Log Message  88  2013-­‐03-­‐16  08:29:46.781  [info]   <0.362.0>@avatar:req_handler:123  Starting   #customer_request  (avatar  rendering)  for   @mhald Saturday, March 23, 13
  • 10. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 From Log Entry to Alert Log Alert Message • Error • Warning • Critical • Crash • #identified_topic Saturday, March 23, 13
  • 11. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Alerts Groups Critical Log Entries #login_failed for @fearing, returning #404 #login_failed for @ga, returning #404 Alert #login_success for @bhatia, returning #200 Saturday, March 23, 13
  • 12. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Address Scheme Role Version Module Line Number XMPP v2.0.15 user_auth : 54 Saturday, March 23, 13
  • 13. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Crashes have no line number http_hander:404   http_hander:404   Bad  request   Bad  request   <<“error”>> <<“api/v2”>> http_hander:404   Bad  request   to ive u at ******** A ci y o or ss m A e 0fc4cf26168b2a4b959d914682c10bc3 M Saturday, March 23, 13
  • 14. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Data Stream Structured Unstructured • Role • Identity • Node • Topic • Version • Severity Saturday, March 23, 13
  • 15. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Acme Calculators Saturday, March 23, 13
  • 16. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Build Popcorn git  clone  git@github.com:marccampbell/ popcorn.git cd  popcorn ./rebar  get-­‐deps ./rebar  compile lessc  apps/popcorn/priv/css/popcorn.less  >          apps/popcorn/priv/css/popcorn.css ./rebar  generate  -­‐f Saturday, March 23, 13
  • 17. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Configure Popcorn app.config                {http_auth_users,      [{<<"admin">>,  <<"password">>}]},                {outbound_notifiers,  [                    {new_alert,  outbound_mailer,                        [{options,          [{retries,  3},  {relay,  "smtp.gmail.com"},                            {username,  "acme.popcorn@gmail.com"},                            {password,  "PASSWORD"}]},                        {from,                  "acme@logwithpopcorn.com"},                        {recipients,      ["your.email@domain.com"]},                        {subject,            "New  Alert  at  {{product}}  {{version}}"}                ]}, Saturday, March 23, 13
  • 18. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Hook in Popcorn Calculator app rebar.config {deps,  [    ...    {lager_popcorn_backend,  ".*",  {git,   "git@github.com:marccampbell/ lager_popcorn_backend.git",   "master"  }}    ... ]}. Saturday, March 23, 13
  • 19. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Hook in Popcorn Calculator application sys.config  %%  Lager  config  {lager,  [  {handlers,  [                        {lager_console_backend,  none},                        {lager_file_backend,  [  {"log/error.log",   error,  104857600,  "$D0",  5}  ]},                        {lager_popcorn_backend,  [                                                                          {level,                debug},                                                                          {popcorn_host,  "127.0.0.1"},                                                                          {popcorn_port,  9125},                                                                          {node_role,        "Calculator"},                                                                          {node_version,  "1.0.7"}                                                                        ]}      ]} Saturday, March 23, 13
  • 20. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Demo Using the Calculator HTTP API curl -v -X POST --data-urlencode "2 4 /" http://calculator.logwithpopcorn.com/api/calculator 15+ 93/ 5 2 - (will cause crash) 22* See and try Popcorn at http://demo.logwithpopcorn.com/ Saturday, March 23, 13
  • 21. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Customers Support Saturday, March 23, 13
  • 22. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Customers Support Saturday, March 23, 13
  • 23. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Customers • Identify edge case bugs • Real-time alerting • Logs as data streams Support Saturday, March 23, 13
  • 24. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Popcorn Design Saturday, March 23, 13
  • 25. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Ingesting Storage Rendering Saturday, March 23, 13
  • 26. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 UDP or TCP or ... Connectionless Out of order Dropped packets No Quick acknowledgements Saturday, March 23, 13
  • 27. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Ingesting Architecture Client (lager) node_fsm Client (winston) node_fsm udp_listener (gen_server) Client (log4j) node_fsm Client (...) node_fsm (...) Saturday, March 23, 13
  • 28. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Storage Architecture storage_monitor storage_worker (gen_server) (gen_server) popcorn_app (application) storage_sup storage_worker (supervisor) (gen_server) storage_worker (gen_server) Saturday, March 23, 13
  • 29. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Storage gen_server behaviour init([])  /  init([worker]) gen_server:handle_call/3 gen_server:handle_cast/2 Saturday, March 23, 13
  • 30. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 handle_call {counter_value,  Count} {is_known_node,  Node_Name} {get_alert,  Key} {get_alerts,  Severity,  Sort} {get_alert_keys,  Type} {get_release_module_link,  Role,  Version,  Module} {search_messages,  {...}} {get_alert_timestamps,  Severities} Saturday, March 23, 13
  • 31. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 handle_cast {expire_logs_matching,  Timestamp} {send_recent_log_lines_matching,  Pid,  Count,  Filters} {new_log_message,  #log_message} {new_release_scm,  Record} {new_alert,  Key,  #alert} {new_alert_timestamp,  Key,  Severity,  #alert} {new_alert_key,  Type,  Key} {new_release_scm_mapping,  Record} {delete_counter,  Counter} {increment_counter,  Counter,  Increment_By} {increment_counters,  Counters} {add_node,  #popcorn_node} Saturday, March 23, 13
  • 32. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Server Sent Events SSE Browser Server HTTP Post alert: {key: “001A”, seen:10} node: {key: “xmpp@con8”, log_msgs:324} Saturday, March 23, 13
  • 33. SSE Events in JS $(function() { var streamSource = new EventSource("/dashboard/stream/{{stream_id}}"); streamSource.addEventListener( 'update_counters', function(event) { var counters = JSON.parse(event.data) // ... }); streamSource.addEventListener( 'new_node', function(event) { var counters = JSON.parse(event.data) // ... }); Saturday, March 23, 13
  • 34. SSE Erlang Design http_stream_handler.erl -behavior(cowboy_http_handler). Wait in New Request Process init receive loop handle handle path Re gis te Ev r en ts fsm node One FSM per SSE client Saturday, March 23, 13
  • 35. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 server  {   listen      80;   server_name  popcorn.logwithpopcorn.com;   access_log  /var/log/nginx/popcorn_access.log;   error_log  /var/log/nginx/popcorn_error.log;   location  /  {     proxy_pass    http://localhost:9125;     proxy_redirect  off;     proxy_buffering  off;     proxy_cache  off;     proxy_set_header  Host  $host;     proxy_set_header  X-­‐Real-­‐IP  $remote_addr;     proxy_set_header  X-­‐Forwarded-­‐For  $proxy_add_x_forwarded_for;     proxy_read_timeout  420;   } } Saturday, March 23, 13
  • 36. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Wire Protocol Standards & Efficiency Saturday, March 23, 13
  • 37. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Protobuffs        erlang:iolist_to_binary([                protobuffs:encode(1,  1,  uint32),      %%  Packet  version                protobuffs:encode(2,  atom_to_list(Node),  string),                protobuffs:encode(3,  Node_Role,  string),                protobuffs:encode(4,  Node_Version,  string),                protobuffs:encode(5,  lager_util:level_to_num(Severity),  uint32),                protobuffs:encode(6,  Message,  string),                protobuffs:encode(7,  opt(Module,  <<"">>),  string),                protobuffs:encode(8,  opt(Function,  <<"">>),  string),                protobuffs:encode(9,  opt(Line,  <<"">>),  string),                protobuffs:encode(10,  opt(Pid,  <<"">>),  string)        ]). Saturday, March 23, 13
  • 38. JSON encode_json_packet(Node)  -­‐>        jiffy:encode({[              {packet_version,  1},              {node,  list_to_binary(Node)},              {role,  <<"calculator">>},              {version,  <<"0.0.1">>},              {severity,  128},              {message,  <<"Calculator  request  5  *  4">>},              {module,  <<"http_calculator">>},              {function,  <<"rpn">>},              {line,  <<"58">>},              {pid,  <<"">>}        ]}). Saturday, March 23, 13
  • 39. Bits and Bytes ^H^A^Ropcorn@anduin.tigertext.me^Z calculator"^E0.0.1(^A2^XCalculator  request  5  *   4:^Ohttp_calculatorB^CrpnJ^B58R^@ {"packet_version":1,   "node":"popcorn@anduin.tigertext.me",   "role":"calculator",  "version":"0.0.1",  "severity":128,   "message":"Calculator  request  5  *  4",   "module":"http_calculator",   "function":"rpn","line":"58","pid":""} Saturday, March 23, 13
  • 40. Processing Time Over 1,000,000 Requests on Apple Air with R16B JSON Protobuffs 12 us 9 us 6 us 3 us 0 us Encoding Decoding Saturday, March 23, 13
  • 41. Memory 3x Me Le JSON Protobuffs m ss or y 400 bytes 300 bytes 200 bytes 100 bytes 0 bytes Memory Saturday, March 23, 13
  • 42. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Rendering Architecture Plain Old Crossfilter D3 Javascript Used only for grouping Store the grouped streaming data, Rendering data from destroyed every few seconds Saturday, March 23, 13
  • 43. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 countsByPeriod severitiesByPeriod rolesByPeriod nodesByPeriod Saturday, March 23, 13
  • 44. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Scaling Popcorn Saturday, March 23, 13
  • 45. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Scalability Goal Handle n log messages per second 10 50 500 5000 Saturday, March 23, 13
  • 46. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Let’s Get Some Tools Saturday, March 23, 13
  • 47. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 statsd & rps (mhald) graphite Saturday, March 23, 13
  • 48. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Chrome dtop redbug statsd graphite Activity Monitor Saturday, March 23, 13
  • 49. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Mnesia UDP Receiving Client (Browser) Saturday, March 23, 13
  • 50. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Issue: Mnesia Saturday, March 23, 13
  • 51. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Saturday, March 23, 13
  • 52. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Saturday, March 23, 13
  • 53. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Saturday, March 23, 13
  • 54. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Saturday, March 23, 13
  • 55. #POPCORN ERLANG_FACTORY @SF_BAY - 2013 Issue: The Browser Executing on the server Executing in the browser vs (Erlang) (Javascript) Saturday, March 23, 13