SlideShare una empresa de Scribd logo
1 de 50
Descargar para leer sin conexión
Distributed Stream Processing
    in the real [Perl] world.




                      YAPC::Asia 2012 Day 1 (2012/09/28)

                        TAGOMORI Satoshi (@tagomoris)

                                             NHN Japan

12年9月29日土曜日
tagomoris




    • TAGOMORI Satoshi ( @tagomoris )


    • Working at NHN Japan




12年9月29日土曜日
What this talk contains

    • What "Stream Processing" is


    • Why we want "Stream Processing"


    • What features we should write for "Stream Processing"


    • Frameworks and tools for "Distributed Stream Processing"


    • Implementations in the Perl world




12年9月29日土曜日
What "Stream Processing" is




12年9月29日土曜日
Stream




12年9月29日土曜日
Stream ?

    •Continuously increasing data

       •access logs, trace logs, sales checks, ...

       •typically written in file line-by-line


                     tail -f

12年9月29日土曜日
Stream Processing

    •Convert, select, aggregate passed data

       •NOT wait EOF (in many cases)


   tail -f|grep ^hit|sed -es/hit/miss/g




12年9月29日土曜日
Stream Processing over network

    •Data are collected from many nodes

       •to seach/query/store

    •Separate heavy processes from edge
     nodes
                 edge: tail -f|nc
          backend: nc -l|grep|sed|tee|...

12年9月29日土曜日
Why we want "Stream Processing"




12年9月29日土曜日
Batch file copy & convert

     access.0928.16.log
       16:00 ...............................
       16:00 ........................................
       ..                                                      60min.
       16:59 .................
       16:59 ...........................
                                                                      latency for 16:00 log
                          flush wait                             3min.     62+ minutes
        ?min.                                     Copy over network



        ?min.                              Convert into query friendly
                                                   structure




12年9月29日土曜日
Stream data copy & convert

     access.0928.16.log                                 Copy over network
       16:00 ...............................                                Convert next-to-next
       16:00 ........................................
                                                           in real time
       ..
       16:59 .................
       16:59 ...........................




                              Very low latency for each log lines
                             (if traffic is not larger than capacity)




12年9月29日土曜日
Case of data size explosion (batch)


   serviceA              Casual batch over multi node/service
                                 may be blocked by
  serviceB                      unbalanced data size

                needs long tranfer
  serviceC             time


  serviceD

              Asynchronous batch is very good problem...

12年9月29日土曜日
Case of data size explosion (stream)


   serviceA
                             Streams are mixed
                       and not blocked by heavy traffics
  serviceB
              heavy
                       (if traffic is not larger than capacity)
  serviceC    traffic

  serviceD




12年9月29日土曜日
What features we should write for
              "Stream Processing"




12年9月29日土曜日
One-by-one input/process/output




12年9月29日土曜日
One-by-one input/process/output


                              convert
              one record      format         one record (or none)

                               select

    •Basic feature

    •I/O call overhead is relatively heavy




12年9月29日土曜日
Burst transfer/read/write and process




12年9月29日土曜日
Burst transfer/read/write and process


    read and                                                read and
      store                    convert                         store
     records                              many records       records
    temprally   many records   format    (or few or none)   temprally
       from                                                      to
       input                    select                        output




    •less input/output calls

    •more performance with async I/O and multi process



12年9月29日土曜日
Control buffer flush intervals




12年9月29日土曜日
Control buffer flush intervals

                       buffer                                   buffer

                       read and                                 read and
                         store                                     store
               read     records     many      many records       records      write
              inputs   temprally   records   (or few or none)   temprally   records
                          from                                       to
                          input                                   output


    0.5sec? 1sec? 3sec? 30sec?
    •Control flushing about buffer size and latency

       •(Semi-)real-time control flow arguments

       •Max size of lost data when process crushed

12年9月29日土曜日
Buffering/Queueing




12年9月29日土曜日
Buffering/Queueing

               output
                        buffer
                                  send to
                                             next node   STOP
              records            next node


                        buffer
               output             send to
                        buffer               next node
              records            next node
                        buffer

                        buffer
               output             send to                recover
                        buffer               next node
              records            next node
                        buffer


               output             send to                streaming
                        buffer               next node
              records            next node



12年9月29日土曜日
Connection keepalive
                Connection pooling




12年9月29日土曜日
Connection keepalive / connection pooling

                                            node B
              node A
                                            node C


                                            node D


    •Keep connections and select one to use

       •TCP connection establishment needs large cost

       •manage node status (alive/down) at same time

       •not only inter-nodes, but also inter-process
        connections

12年9月29日土曜日
Distribution


12年9月29日土曜日
Distribution: Load balancing (cpu/node)

                                    send to
                                               processor
                                   next node


                          load      send to
              records                          processor
                        balancer   next node


                                    send to
                                               processor
                                   next node

    •Distribute large scale data to many nodes
       •nodes: servers, or processor processes
       •to make total performance high

12年9月29日土曜日
Distribution: High availability (process/node)

                                    send to
                                                processor
                                   next node


                          load      send to
              records                           processor
                        balancer   next node


                                    send to
                                                processor
                                   next node


    •Distribute large scale data to N+1 (or 2 or more) nodes
       •to make system tolerant of node trouble
       •without any failover (and takeback) operations

12年9月29日土曜日
Routing


                        records for
                                                           output A
                         service A


                                      process A


                        records for
     records   router                             router   output B
                         service B




                        records for
                                      process B            output C
                         service C




12年9月29日土曜日
TOO MANY FEATURES TO
                     IMPLEMENT !!!!!




12年9月29日土曜日
Frameworks and tools for
    "Distributed Stream Processing"
12年9月29日土曜日
Frameworks and tools

    •Apache Kafka

       •written in Scala (... with JVM!)

    •Twitter Storm

       •written in Clojure (...with JVM!)

    •Fluentd

12年9月29日土曜日
Fluentd




12年9月29日土曜日
Fluentd

    •Mainly written by @frsyuki in TreasureData

       •APLv2 software on github

    •Log read/transfer/write daemon based on
     MessagePack

       •structured data (Hash: key:value pairs)

    •Plugin mechanism for input/output/buffer features

       •now many plugins are published
12年9月29日土曜日
Fluentd features: input/output

    •File tailing, network, and other input plugins

       •tail and parse line-by-line

       •receive records from app logger or other fluentd

       •in_syslog, in_exec, in_dstat, .....

    •Output to many many storage/systems

       •other fluentd, file, S3, mongodb, mysql, HDFS, .....

12年9月29日土曜日
Fluentd features: buffers

    •Pluggable buffers

       •output plugin buffers are swappable (by configuration)

       •In memory buffers: fast, but lost at fluentd down

       •file buffers: slow, but always saved

       •Buffer plugins are also added by users

              •No one public plugin exists now....

12年9月29日土曜日
Fluentd features: routing

    •Tag based routing

       •all records have tag and time

       •Fluentd use tags which plugin the record sended next

              •configurartions are:

              •tag matcher pattern + plugin configuration




12年9月29日土曜日
Fluentd features: exec_filter

    •Output records to specified (and forked) command

       •And get records from command's STDOUT

       •We can specify our stream processor as command




12年9月29日土曜日
I'm very sorry that....

12年9月29日土曜日
Fluentd is written in Ruby
Fluentd plugins released as rubygems




12年9月29日土曜日
Problems about Fluentd (for stream processing)

    •Eager buffering

       •Eager default buffering config, not to flush under 8MB

    •Performance

       •Many many features for data protection injures
        performance

    •Doesn't work on Windows



12年9月29日土曜日
Implementations in the Perl world




12年9月29日土曜日
fluent-agent-lite (Fluent::AgentLite)

    •Log collection agent tools (in perl) by tagomoris

       •fast and low load

       •gets logs from file/STDIN, and sends to other nodes

    •minimal features for log collector agent

       •doesn't parse log lines (send 1 attribute with whole
        log line)

       •supports load balancing and failover of destination
12年9月29日土曜日
fluent-agent (Fluent::Agent)

    •Fluentd feature subset tools by tagomoris

       •written in Perl

       •libuv and UV module for async I/O lib (for Windows)

       •Goal: simple, fast and easy deployment

       •UNDER CONSTRUCTION

              •60% features and many bugs, not in CPAN now

12年9月29日土曜日
Features of Fluent::Agent

    •1 input, 1 output and 0/1 filter

       •Network I/O: protocol compatible with Fluentd
              •and simple load balancing/failover feature

       •File input/output: superset features of Fluentd (in plan)

       •Filter with any command: compatible with Fluentd's
        exec_filter
                                     filter
       data/records    input                     output   data/records
                                  any program
                                   you want
12年9月29日土曜日
Pros of Fluent::Agent (in plan)

    •Simple and fast software for stream processing

       •Stateless nodes

              •fluent-agent works without any configuration files

              •fluent-agent works with only commandline options

       •Simple buffering and load balance

       •less memory usage

12年9月29日土曜日
Cons of Fluent::Agent (in fact)

    •Poor input/output methods

       •fluent-agent doesn't have plugin architecture (currently)

       •in future, CPAN based plugin system?

    •Lack of data protection for death of process

       •fluent-agent have only memory buffer




12年9月29日土曜日
Fluentd and fluent-agent




12年9月29日土曜日
Fluentd and fluent-agent and fluent-agent-lite
   service
    node fluent-agent-lite


   service
                                          fluent-agent
    node fluent-agent-lite


   service                  fluent-agent   fluent-agent     fluentd
    node fluent-agent-lite


   service                                fluent-agent
    node fluent-agent-lite
                            fluent-agent
   service
                                          fluent-agent
    node fluent-agent-lite


   service                  fluent-agent                   fluentd
    node fluent-agent-lite                 fluent-agent

   service                                               writer for
    node fluent-agent-lite                 fluent-agent    storages
                                                             /
                              deliver     processor     aggregator

12年9月29日土曜日
Conclusion

    •Distributed Stream Processing is:

       •to provides more power to our application

       •very hard (and interesting) problem

       •that we have some supporting frameworks/tools like
        Fluentd and/or fluent-agent




12年9月29日土曜日
Let's try to improve your application

                                        with stream processing

                              instead of many many batches




                                                    Thanks!




        CAST: crouton & luke & chacha
            Thanks to @kbysmnr
12年9月29日土曜日

Más contenido relacionado

La actualidad más candente

Hic 2011 realtime_analytics_at_facebook
Hic 2011 realtime_analytics_at_facebookHic 2011 realtime_analytics_at_facebook
Hic 2011 realtime_analytics_at_facebookbaggioss
 
Memory Bandwidth QoS
Memory Bandwidth QoSMemory Bandwidth QoS
Memory Bandwidth QoSRohit Jnagal
 
Q2.12: Research Update on big.LITTLE MP Scheduling
Q2.12: Research Update on big.LITTLE MP SchedulingQ2.12: Research Update on big.LITTLE MP Scheduling
Q2.12: Research Update on big.LITTLE MP SchedulingLinaro
 
Instrumenting the real-time web
Instrumenting the real-time webInstrumenting the real-time web
Instrumenting the real-time webbcantrill
 
Como obter o melhor do Z por Gustavo Fernandes Araujo (Itau Unibanco)
Como obter o melhor do Z por Gustavo Fernandes Araujo (Itau Unibanco)Como obter o melhor do Z por Gustavo Fernandes Araujo (Itau Unibanco)
Como obter o melhor do Z por Gustavo Fernandes Araujo (Itau Unibanco)Joao Galdino Mello de Souza
 
LCA14: LCA14-506: Comparative analysis of preemption vs preempt-rt
LCA14: LCA14-506: Comparative analysis of preemption vs preempt-rtLCA14: LCA14-506: Comparative analysis of preemption vs preempt-rt
LCA14: LCA14-506: Comparative analysis of preemption vs preempt-rtLinaro
 
Kernel Recipes 2019 - XDP closer integration with network stack
Kernel Recipes 2019 -  XDP closer integration with network stackKernel Recipes 2019 -  XDP closer integration with network stack
Kernel Recipes 2019 - XDP closer integration with network stackAnne Nicolas
 
DPDK Summit - 08 Sept 2014 - 6WIND - High Perf Networking Leveraging the DPDK...
DPDK Summit - 08 Sept 2014 - 6WIND - High Perf Networking Leveraging the DPDK...DPDK Summit - 08 Sept 2014 - 6WIND - High Perf Networking Leveraging the DPDK...
DPDK Summit - 08 Sept 2014 - 6WIND - High Perf Networking Leveraging the DPDK...Jim St. Leger
 

La actualidad más candente (14)

Hic 2011 realtime_analytics_at_facebook
Hic 2011 realtime_analytics_at_facebookHic 2011 realtime_analytics_at_facebook
Hic 2011 realtime_analytics_at_facebook
 
Ltsp Slide
Ltsp SlideLtsp Slide
Ltsp Slide
 
Shignled disk
Shignled diskShignled disk
Shignled disk
 
Memory Bandwidth QoS
Memory Bandwidth QoSMemory Bandwidth QoS
Memory Bandwidth QoS
 
Q2.12: Research Update on big.LITTLE MP Scheduling
Q2.12: Research Update on big.LITTLE MP SchedulingQ2.12: Research Update on big.LITTLE MP Scheduling
Q2.12: Research Update on big.LITTLE MP Scheduling
 
Ltsp
LtspLtsp
Ltsp
 
Cat @ scale
Cat @ scaleCat @ scale
Cat @ scale
 
Instrumenting the real-time web
Instrumenting the real-time webInstrumenting the real-time web
Instrumenting the real-time web
 
Como obter o melhor do Z por Gustavo Fernandes Araujo (Itau Unibanco)
Como obter o melhor do Z por Gustavo Fernandes Araujo (Itau Unibanco)Como obter o melhor do Z por Gustavo Fernandes Araujo (Itau Unibanco)
Como obter o melhor do Z por Gustavo Fernandes Araujo (Itau Unibanco)
 
LCA14: LCA14-506: Comparative analysis of preemption vs preempt-rt
LCA14: LCA14-506: Comparative analysis of preemption vs preempt-rtLCA14: LCA14-506: Comparative analysis of preemption vs preempt-rt
LCA14: LCA14-506: Comparative analysis of preemption vs preempt-rt
 
Kernel Recipes 2019 - XDP closer integration with network stack
Kernel Recipes 2019 -  XDP closer integration with network stackKernel Recipes 2019 -  XDP closer integration with network stack
Kernel Recipes 2019 - XDP closer integration with network stack
 
How swift is your Swift - SD.pptx
How swift is your Swift - SD.pptxHow swift is your Swift - SD.pptx
How swift is your Swift - SD.pptx
 
DPDK Summit - 08 Sept 2014 - 6WIND - High Perf Networking Leveraging the DPDK...
DPDK Summit - 08 Sept 2014 - 6WIND - High Perf Networking Leveraging the DPDK...DPDK Summit - 08 Sept 2014 - 6WIND - High Perf Networking Leveraging the DPDK...
DPDK Summit - 08 Sept 2014 - 6WIND - High Perf Networking Leveraging the DPDK...
 
Virtual net performance
Virtual net performanceVirtual net performance
Virtual net performance
 

Similar a Distributed Stream Processing in the real [Perl] world

Passive DNS Collection -- the 'dnstap' approach, by Paul Vixie [APNIC 38 / AP...
Passive DNS Collection -- the 'dnstap' approach, by Paul Vixie [APNIC 38 / AP...Passive DNS Collection -- the 'dnstap' approach, by Paul Vixie [APNIC 38 / AP...
Passive DNS Collection -- the 'dnstap' approach, by Paul Vixie [APNIC 38 / AP...APNIC
 
Live Transcript Delivery
Live Transcript DeliveryLive Transcript Delivery
Live Transcript DeliveryGrzegorz Kolpuc
 
DoS and DDoS mitigations with eBPF, XDP and DPDK
DoS and DDoS mitigations with eBPF, XDP and DPDKDoS and DDoS mitigations with eBPF, XDP and DPDK
DoS and DDoS mitigations with eBPF, XDP and DPDKMarian Marinov
 
Shoot the Bird: Linear Broadcast Distribution on AWS by Usman Shakeel of Amaz...
Shoot the Bird: Linear Broadcast Distribution on AWS by Usman Shakeel of Amaz...Shoot the Bird: Linear Broadcast Distribution on AWS by Usman Shakeel of Amaz...
Shoot the Bird: Linear Broadcast Distribution on AWS by Usman Shakeel of Amaz...ETCenter
 
Making the Most Out of ScyllaDB's Awesome Concurrency at Optimizely
Making the Most Out of ScyllaDB's Awesome Concurrency at OptimizelyMaking the Most Out of ScyllaDB's Awesome Concurrency at Optimizely
Making the Most Out of ScyllaDB's Awesome Concurrency at OptimizelyScyllaDB
 
Cacheconcurrencyconsistency cassandra svcc
Cacheconcurrencyconsistency cassandra svccCacheconcurrencyconsistency cassandra svcc
Cacheconcurrencyconsistency cassandra svccsrisatish ambati
 
Data Grids with Oracle Coherence
Data Grids with Oracle CoherenceData Grids with Oracle Coherence
Data Grids with Oracle CoherenceBen Stopford
 
Netflix Open Source Meetup Season 4 Episode 2
Netflix Open Source Meetup Season 4 Episode 2Netflix Open Source Meetup Season 4 Episode 2
Netflix Open Source Meetup Season 4 Episode 2aspyker
 
Apache Samza Past, Present and Future
Apache Samza  Past, Present and FutureApache Samza  Past, Present and Future
Apache Samza Past, Present and FutureKartik Paramasivam
 
Traitement temps réel chez Streamroot - Golang Paris Juin 2016
Traitement temps réel chez Streamroot - Golang Paris Juin 2016Traitement temps réel chez Streamroot - Golang Paris Juin 2016
Traitement temps réel chez Streamroot - Golang Paris Juin 2016Simon Caplette
 
Deep Dive on the Amazon Aurora MySQL-compatible Edition - DAT301 - re:Invent ...
Deep Dive on the Amazon Aurora MySQL-compatible Edition - DAT301 - re:Invent ...Deep Dive on the Amazon Aurora MySQL-compatible Edition - DAT301 - re:Invent ...
Deep Dive on the Amazon Aurora MySQL-compatible Edition - DAT301 - re:Invent ...Amazon Web Services
 
Xldb2011 tue 0940_facebook_realtimeanalytics
Xldb2011 tue 0940_facebook_realtimeanalyticsXldb2011 tue 0940_facebook_realtimeanalytics
Xldb2011 tue 0940_facebook_realtimeanalyticsliqiang xu
 
OpenStack and OpenFlow Demos
OpenStack and OpenFlow DemosOpenStack and OpenFlow Demos
OpenStack and OpenFlow DemosBrent Salisbury
 
Boyan Ivanov - latency, the #1 metric of your cloud
Boyan Ivanov - latency, the #1 metric of your cloudBoyan Ivanov - latency, the #1 metric of your cloud
Boyan Ivanov - latency, the #1 metric of your cloudShapeBlue
 
SAM SIG: Hadoop architecture, MapReduce patterns, and best practices with Cas...
SAM SIG: Hadoop architecture, MapReduce patterns, and best practices with Cas...SAM SIG: Hadoop architecture, MapReduce patterns, and best practices with Cas...
SAM SIG: Hadoop architecture, MapReduce patterns, and best practices with Cas...cwensel
 
Технологии работы с дисковыми хранилищами и файловыми системами Windows Serve...
Технологии работы с дисковыми хранилищами и файловыми системами Windows Serve...Технологии работы с дисковыми хранилищами и файловыми системами Windows Serve...
Технологии работы с дисковыми хранилищами и файловыми системами Windows Serve...Виталий Стародубцев
 
Multi-tiered Node Architectures - JSConf 2011
Multi-tiered Node Architectures - JSConf 2011Multi-tiered Node Architectures - JSConf 2011
Multi-tiered Node Architectures - JSConf 2011Tom Croucher
 
Peyton jones-2011-parallel haskell-the_future
Peyton jones-2011-parallel haskell-the_futurePeyton jones-2011-parallel haskell-the_future
Peyton jones-2011-parallel haskell-the_futureTakayuki Muranushi
 
Simon Peyton Jones: Managing parallelism
Simon Peyton Jones: Managing parallelismSimon Peyton Jones: Managing parallelism
Simon Peyton Jones: Managing parallelismSkills Matter
 
Fundamentals of Stream Processing with Apache Beam, Tyler Akidau, Frances Perry
Fundamentals of Stream Processing with Apache Beam, Tyler Akidau, Frances Perry Fundamentals of Stream Processing with Apache Beam, Tyler Akidau, Frances Perry
Fundamentals of Stream Processing with Apache Beam, Tyler Akidau, Frances Perry confluent
 

Similar a Distributed Stream Processing in the real [Perl] world (20)

Passive DNS Collection -- the 'dnstap' approach, by Paul Vixie [APNIC 38 / AP...
Passive DNS Collection -- the 'dnstap' approach, by Paul Vixie [APNIC 38 / AP...Passive DNS Collection -- the 'dnstap' approach, by Paul Vixie [APNIC 38 / AP...
Passive DNS Collection -- the 'dnstap' approach, by Paul Vixie [APNIC 38 / AP...
 
Live Transcript Delivery
Live Transcript DeliveryLive Transcript Delivery
Live Transcript Delivery
 
DoS and DDoS mitigations with eBPF, XDP and DPDK
DoS and DDoS mitigations with eBPF, XDP and DPDKDoS and DDoS mitigations with eBPF, XDP and DPDK
DoS and DDoS mitigations with eBPF, XDP and DPDK
 
Shoot the Bird: Linear Broadcast Distribution on AWS by Usman Shakeel of Amaz...
Shoot the Bird: Linear Broadcast Distribution on AWS by Usman Shakeel of Amaz...Shoot the Bird: Linear Broadcast Distribution on AWS by Usman Shakeel of Amaz...
Shoot the Bird: Linear Broadcast Distribution on AWS by Usman Shakeel of Amaz...
 
Making the Most Out of ScyllaDB's Awesome Concurrency at Optimizely
Making the Most Out of ScyllaDB's Awesome Concurrency at OptimizelyMaking the Most Out of ScyllaDB's Awesome Concurrency at Optimizely
Making the Most Out of ScyllaDB's Awesome Concurrency at Optimizely
 
Cacheconcurrencyconsistency cassandra svcc
Cacheconcurrencyconsistency cassandra svccCacheconcurrencyconsistency cassandra svcc
Cacheconcurrencyconsistency cassandra svcc
 
Data Grids with Oracle Coherence
Data Grids with Oracle CoherenceData Grids with Oracle Coherence
Data Grids with Oracle Coherence
 
Netflix Open Source Meetup Season 4 Episode 2
Netflix Open Source Meetup Season 4 Episode 2Netflix Open Source Meetup Season 4 Episode 2
Netflix Open Source Meetup Season 4 Episode 2
 
Apache Samza Past, Present and Future
Apache Samza  Past, Present and FutureApache Samza  Past, Present and Future
Apache Samza Past, Present and Future
 
Traitement temps réel chez Streamroot - Golang Paris Juin 2016
Traitement temps réel chez Streamroot - Golang Paris Juin 2016Traitement temps réel chez Streamroot - Golang Paris Juin 2016
Traitement temps réel chez Streamroot - Golang Paris Juin 2016
 
Deep Dive on the Amazon Aurora MySQL-compatible Edition - DAT301 - re:Invent ...
Deep Dive on the Amazon Aurora MySQL-compatible Edition - DAT301 - re:Invent ...Deep Dive on the Amazon Aurora MySQL-compatible Edition - DAT301 - re:Invent ...
Deep Dive on the Amazon Aurora MySQL-compatible Edition - DAT301 - re:Invent ...
 
Xldb2011 tue 0940_facebook_realtimeanalytics
Xldb2011 tue 0940_facebook_realtimeanalyticsXldb2011 tue 0940_facebook_realtimeanalytics
Xldb2011 tue 0940_facebook_realtimeanalytics
 
OpenStack and OpenFlow Demos
OpenStack and OpenFlow DemosOpenStack and OpenFlow Demos
OpenStack and OpenFlow Demos
 
Boyan Ivanov - latency, the #1 metric of your cloud
Boyan Ivanov - latency, the #1 metric of your cloudBoyan Ivanov - latency, the #1 metric of your cloud
Boyan Ivanov - latency, the #1 metric of your cloud
 
SAM SIG: Hadoop architecture, MapReduce patterns, and best practices with Cas...
SAM SIG: Hadoop architecture, MapReduce patterns, and best practices with Cas...SAM SIG: Hadoop architecture, MapReduce patterns, and best practices with Cas...
SAM SIG: Hadoop architecture, MapReduce patterns, and best practices with Cas...
 
Технологии работы с дисковыми хранилищами и файловыми системами Windows Serve...
Технологии работы с дисковыми хранилищами и файловыми системами Windows Serve...Технологии работы с дисковыми хранилищами и файловыми системами Windows Serve...
Технологии работы с дисковыми хранилищами и файловыми системами Windows Serve...
 
Multi-tiered Node Architectures - JSConf 2011
Multi-tiered Node Architectures - JSConf 2011Multi-tiered Node Architectures - JSConf 2011
Multi-tiered Node Architectures - JSConf 2011
 
Peyton jones-2011-parallel haskell-the_future
Peyton jones-2011-parallel haskell-the_futurePeyton jones-2011-parallel haskell-the_future
Peyton jones-2011-parallel haskell-the_future
 
Simon Peyton Jones: Managing parallelism
Simon Peyton Jones: Managing parallelismSimon Peyton Jones: Managing parallelism
Simon Peyton Jones: Managing parallelism
 
Fundamentals of Stream Processing with Apache Beam, Tyler Akidau, Frances Perry
Fundamentals of Stream Processing with Apache Beam, Tyler Akidau, Frances Perry Fundamentals of Stream Processing with Apache Beam, Tyler Akidau, Frances Perry
Fundamentals of Stream Processing with Apache Beam, Tyler Akidau, Frances Perry
 

Más de SATOSHI TAGOMORI

Ractor's speed is not light-speed
Ractor's speed is not light-speedRactor's speed is not light-speed
Ractor's speed is not light-speedSATOSHI TAGOMORI
 
Good Things and Hard Things of SaaS Development/Operations
Good Things and Hard Things of SaaS Development/OperationsGood Things and Hard Things of SaaS Development/Operations
Good Things and Hard Things of SaaS Development/OperationsSATOSHI TAGOMORI
 
Invitation to the dark side of Ruby
Invitation to the dark side of RubyInvitation to the dark side of Ruby
Invitation to the dark side of RubySATOSHI TAGOMORI
 
Hijacking Ruby Syntax in Ruby (RubyConf 2018)
Hijacking Ruby Syntax in Ruby (RubyConf 2018)Hijacking Ruby Syntax in Ruby (RubyConf 2018)
Hijacking Ruby Syntax in Ruby (RubyConf 2018)SATOSHI TAGOMORI
 
Make Your Ruby Script Confusing
Make Your Ruby Script ConfusingMake Your Ruby Script Confusing
Make Your Ruby Script ConfusingSATOSHI TAGOMORI
 
Hijacking Ruby Syntax in Ruby
Hijacking Ruby Syntax in RubyHijacking Ruby Syntax in Ruby
Hijacking Ruby Syntax in RubySATOSHI TAGOMORI
 
Lock, Concurrency and Throughput of Exclusive Operations
Lock, Concurrency and Throughput of Exclusive OperationsLock, Concurrency and Throughput of Exclusive Operations
Lock, Concurrency and Throughput of Exclusive OperationsSATOSHI TAGOMORI
 
Data Processing and Ruby in the World
Data Processing and Ruby in the WorldData Processing and Ruby in the World
Data Processing and Ruby in the WorldSATOSHI TAGOMORI
 
Planet-scale Data Ingestion Pipeline: Bigdam
Planet-scale Data Ingestion Pipeline: BigdamPlanet-scale Data Ingestion Pipeline: Bigdam
Planet-scale Data Ingestion Pipeline: BigdamSATOSHI TAGOMORI
 
Technologies, Data Analytics Service and Enterprise Business
Technologies, Data Analytics Service and Enterprise BusinessTechnologies, Data Analytics Service and Enterprise Business
Technologies, Data Analytics Service and Enterprise BusinessSATOSHI TAGOMORI
 
Ruby and Distributed Storage Systems
Ruby and Distributed Storage SystemsRuby and Distributed Storage Systems
Ruby and Distributed Storage SystemsSATOSHI TAGOMORI
 
Perfect Norikra 2nd Season
Perfect Norikra 2nd SeasonPerfect Norikra 2nd Season
Perfect Norikra 2nd SeasonSATOSHI TAGOMORI
 
To Have Own Data Analytics Platform, Or NOT To
To Have Own Data Analytics Platform, Or NOT ToTo Have Own Data Analytics Platform, Or NOT To
To Have Own Data Analytics Platform, Or NOT ToSATOSHI TAGOMORI
 
The Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and ContainersThe Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and ContainersSATOSHI TAGOMORI
 
How To Write Middleware In Ruby
How To Write Middleware In RubyHow To Write Middleware In Ruby
How To Write Middleware In RubySATOSHI TAGOMORI
 
Modern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real WorldModern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real WorldSATOSHI TAGOMORI
 
Open Source Software, Distributed Systems, Database as a Cloud Service
Open Source Software, Distributed Systems, Database as a Cloud ServiceOpen Source Software, Distributed Systems, Database as a Cloud Service
Open Source Software, Distributed Systems, Database as a Cloud ServiceSATOSHI TAGOMORI
 
Fluentd Overview, Now and Then
Fluentd Overview, Now and ThenFluentd Overview, Now and Then
Fluentd Overview, Now and ThenSATOSHI TAGOMORI
 

Más de SATOSHI TAGOMORI (20)

Ractor's speed is not light-speed
Ractor's speed is not light-speedRactor's speed is not light-speed
Ractor's speed is not light-speed
 
Good Things and Hard Things of SaaS Development/Operations
Good Things and Hard Things of SaaS Development/OperationsGood Things and Hard Things of SaaS Development/Operations
Good Things and Hard Things of SaaS Development/Operations
 
Maccro Strikes Back
Maccro Strikes BackMaccro Strikes Back
Maccro Strikes Back
 
Invitation to the dark side of Ruby
Invitation to the dark side of RubyInvitation to the dark side of Ruby
Invitation to the dark side of Ruby
 
Hijacking Ruby Syntax in Ruby (RubyConf 2018)
Hijacking Ruby Syntax in Ruby (RubyConf 2018)Hijacking Ruby Syntax in Ruby (RubyConf 2018)
Hijacking Ruby Syntax in Ruby (RubyConf 2018)
 
Make Your Ruby Script Confusing
Make Your Ruby Script ConfusingMake Your Ruby Script Confusing
Make Your Ruby Script Confusing
 
Hijacking Ruby Syntax in Ruby
Hijacking Ruby Syntax in RubyHijacking Ruby Syntax in Ruby
Hijacking Ruby Syntax in Ruby
 
Lock, Concurrency and Throughput of Exclusive Operations
Lock, Concurrency and Throughput of Exclusive OperationsLock, Concurrency and Throughput of Exclusive Operations
Lock, Concurrency and Throughput of Exclusive Operations
 
Data Processing and Ruby in the World
Data Processing and Ruby in the WorldData Processing and Ruby in the World
Data Processing and Ruby in the World
 
Planet-scale Data Ingestion Pipeline: Bigdam
Planet-scale Data Ingestion Pipeline: BigdamPlanet-scale Data Ingestion Pipeline: Bigdam
Planet-scale Data Ingestion Pipeline: Bigdam
 
Technologies, Data Analytics Service and Enterprise Business
Technologies, Data Analytics Service and Enterprise BusinessTechnologies, Data Analytics Service and Enterprise Business
Technologies, Data Analytics Service and Enterprise Business
 
Ruby and Distributed Storage Systems
Ruby and Distributed Storage SystemsRuby and Distributed Storage Systems
Ruby and Distributed Storage Systems
 
Perfect Norikra 2nd Season
Perfect Norikra 2nd SeasonPerfect Norikra 2nd Season
Perfect Norikra 2nd Season
 
Fluentd 101
Fluentd 101Fluentd 101
Fluentd 101
 
To Have Own Data Analytics Platform, Or NOT To
To Have Own Data Analytics Platform, Or NOT ToTo Have Own Data Analytics Platform, Or NOT To
To Have Own Data Analytics Platform, Or NOT To
 
The Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and ContainersThe Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and Containers
 
How To Write Middleware In Ruby
How To Write Middleware In RubyHow To Write Middleware In Ruby
How To Write Middleware In Ruby
 
Modern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real WorldModern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real World
 
Open Source Software, Distributed Systems, Database as a Cloud Service
Open Source Software, Distributed Systems, Database as a Cloud ServiceOpen Source Software, Distributed Systems, Database as a Cloud Service
Open Source Software, Distributed Systems, Database as a Cloud Service
 
Fluentd Overview, Now and Then
Fluentd Overview, Now and ThenFluentd Overview, Now and Then
Fluentd Overview, Now and Then
 

Distributed Stream Processing in the real [Perl] world

  • 1. Distributed Stream Processing in the real [Perl] world. YAPC::Asia 2012 Day 1 (2012/09/28) TAGOMORI Satoshi (@tagomoris) NHN Japan 12年9月29日土曜日
  • 2. tagomoris • TAGOMORI Satoshi ( @tagomoris ) • Working at NHN Japan 12年9月29日土曜日
  • 3. What this talk contains • What "Stream Processing" is • Why we want "Stream Processing" • What features we should write for "Stream Processing" • Frameworks and tools for "Distributed Stream Processing" • Implementations in the Perl world 12年9月29日土曜日
  • 4. What "Stream Processing" is 12年9月29日土曜日
  • 6. Stream ? •Continuously increasing data •access logs, trace logs, sales checks, ... •typically written in file line-by-line tail -f 12年9月29日土曜日
  • 7. Stream Processing •Convert, select, aggregate passed data •NOT wait EOF (in many cases) tail -f|grep ^hit|sed -es/hit/miss/g 12年9月29日土曜日
  • 8. Stream Processing over network •Data are collected from many nodes •to seach/query/store •Separate heavy processes from edge nodes edge: tail -f|nc backend: nc -l|grep|sed|tee|... 12年9月29日土曜日
  • 9. Why we want "Stream Processing" 12年9月29日土曜日
  • 10. Batch file copy & convert access.0928.16.log 16:00 ............................... 16:00 ........................................ .. 60min. 16:59 ................. 16:59 ........................... latency for 16:00 log flush wait 3min. 62+ minutes ?min. Copy over network ?min. Convert into query friendly structure 12年9月29日土曜日
  • 11. Stream data copy & convert access.0928.16.log Copy over network 16:00 ............................... Convert next-to-next 16:00 ........................................ in real time .. 16:59 ................. 16:59 ........................... Very low latency for each log lines (if traffic is not larger than capacity) 12年9月29日土曜日
  • 12. Case of data size explosion (batch) serviceA Casual batch over multi node/service may be blocked by serviceB unbalanced data size needs long tranfer serviceC time serviceD Asynchronous batch is very good problem... 12年9月29日土曜日
  • 13. Case of data size explosion (stream) serviceA Streams are mixed and not blocked by heavy traffics serviceB heavy (if traffic is not larger than capacity) serviceC traffic serviceD 12年9月29日土曜日
  • 14. What features we should write for "Stream Processing" 12年9月29日土曜日
  • 16. One-by-one input/process/output convert one record format one record (or none) select •Basic feature •I/O call overhead is relatively heavy 12年9月29日土曜日
  • 17. Burst transfer/read/write and process 12年9月29日土曜日
  • 18. Burst transfer/read/write and process read and read and store convert store records many records records temprally many records format (or few or none) temprally from to input select output •less input/output calls •more performance with async I/O and multi process 12年9月29日土曜日
  • 19. Control buffer flush intervals 12年9月29日土曜日
  • 20. Control buffer flush intervals buffer buffer read and read and store store read records many many records records write inputs temprally records (or few or none) temprally records from to input output 0.5sec? 1sec? 3sec? 30sec? •Control flushing about buffer size and latency •(Semi-)real-time control flow arguments •Max size of lost data when process crushed 12年9月29日土曜日
  • 22. Buffering/Queueing output buffer send to next node STOP records next node buffer output send to buffer next node records next node buffer buffer output send to recover buffer next node records next node buffer output send to streaming buffer next node records next node 12年9月29日土曜日
  • 23. Connection keepalive Connection pooling 12年9月29日土曜日
  • 24. Connection keepalive / connection pooling node B node A node C node D •Keep connections and select one to use •TCP connection establishment needs large cost •manage node status (alive/down) at same time •not only inter-nodes, but also inter-process connections 12年9月29日土曜日
  • 26. Distribution: Load balancing (cpu/node) send to processor next node load send to records processor balancer next node send to processor next node •Distribute large scale data to many nodes •nodes: servers, or processor processes •to make total performance high 12年9月29日土曜日
  • 27. Distribution: High availability (process/node) send to processor next node load send to records processor balancer next node send to processor next node •Distribute large scale data to N+1 (or 2 or more) nodes •to make system tolerant of node trouble •without any failover (and takeback) operations 12年9月29日土曜日
  • 28. Routing records for output A service A process A records for records router router output B service B records for process B output C service C 12年9月29日土曜日
  • 29. TOO MANY FEATURES TO IMPLEMENT !!!!! 12年9月29日土曜日
  • 30. Frameworks and tools for "Distributed Stream Processing" 12年9月29日土曜日
  • 31. Frameworks and tools •Apache Kafka •written in Scala (... with JVM!) •Twitter Storm •written in Clojure (...with JVM!) •Fluentd 12年9月29日土曜日
  • 33. Fluentd •Mainly written by @frsyuki in TreasureData •APLv2 software on github •Log read/transfer/write daemon based on MessagePack •structured data (Hash: key:value pairs) •Plugin mechanism for input/output/buffer features •now many plugins are published 12年9月29日土曜日
  • 34. Fluentd features: input/output •File tailing, network, and other input plugins •tail and parse line-by-line •receive records from app logger or other fluentd •in_syslog, in_exec, in_dstat, ..... •Output to many many storage/systems •other fluentd, file, S3, mongodb, mysql, HDFS, ..... 12年9月29日土曜日
  • 35. Fluentd features: buffers •Pluggable buffers •output plugin buffers are swappable (by configuration) •In memory buffers: fast, but lost at fluentd down •file buffers: slow, but always saved •Buffer plugins are also added by users •No one public plugin exists now.... 12年9月29日土曜日
  • 36. Fluentd features: routing •Tag based routing •all records have tag and time •Fluentd use tags which plugin the record sended next •configurartions are: •tag matcher pattern + plugin configuration 12年9月29日土曜日
  • 37. Fluentd features: exec_filter •Output records to specified (and forked) command •And get records from command's STDOUT •We can specify our stream processor as command 12年9月29日土曜日
  • 38. I'm very sorry that.... 12年9月29日土曜日
  • 39. Fluentd is written in Ruby Fluentd plugins released as rubygems 12年9月29日土曜日
  • 40. Problems about Fluentd (for stream processing) •Eager buffering •Eager default buffering config, not to flush under 8MB •Performance •Many many features for data protection injures performance •Doesn't work on Windows 12年9月29日土曜日
  • 41. Implementations in the Perl world 12年9月29日土曜日
  • 42. fluent-agent-lite (Fluent::AgentLite) •Log collection agent tools (in perl) by tagomoris •fast and low load •gets logs from file/STDIN, and sends to other nodes •minimal features for log collector agent •doesn't parse log lines (send 1 attribute with whole log line) •supports load balancing and failover of destination 12年9月29日土曜日
  • 43. fluent-agent (Fluent::Agent) •Fluentd feature subset tools by tagomoris •written in Perl •libuv and UV module for async I/O lib (for Windows) •Goal: simple, fast and easy deployment •UNDER CONSTRUCTION •60% features and many bugs, not in CPAN now 12年9月29日土曜日
  • 44. Features of Fluent::Agent •1 input, 1 output and 0/1 filter •Network I/O: protocol compatible with Fluentd •and simple load balancing/failover feature •File input/output: superset features of Fluentd (in plan) •Filter with any command: compatible with Fluentd's exec_filter filter data/records input output data/records any program you want 12年9月29日土曜日
  • 45. Pros of Fluent::Agent (in plan) •Simple and fast software for stream processing •Stateless nodes •fluent-agent works without any configuration files •fluent-agent works with only commandline options •Simple buffering and load balance •less memory usage 12年9月29日土曜日
  • 46. Cons of Fluent::Agent (in fact) •Poor input/output methods •fluent-agent doesn't have plugin architecture (currently) •in future, CPAN based plugin system? •Lack of data protection for death of process •fluent-agent have only memory buffer 12年9月29日土曜日
  • 48. Fluentd and fluent-agent and fluent-agent-lite service node fluent-agent-lite service fluent-agent node fluent-agent-lite service fluent-agent fluent-agent fluentd node fluent-agent-lite service fluent-agent node fluent-agent-lite fluent-agent service fluent-agent node fluent-agent-lite service fluent-agent fluentd node fluent-agent-lite fluent-agent service writer for node fluent-agent-lite fluent-agent storages / deliver processor aggregator 12年9月29日土曜日
  • 49. Conclusion •Distributed Stream Processing is: •to provides more power to our application •very hard (and interesting) problem •that we have some supporting frameworks/tools like Fluentd and/or fluent-agent 12年9月29日土曜日
  • 50. Let's try to improve your application with stream processing instead of many many batches Thanks! CAST: crouton & luke & chacha Thanks to @kbysmnr 12年9月29日土曜日