Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Future of Apache Storm

Future of Apache Storm

Avatar for Satish Duggana

Satish Duggana

September 01, 2016

Other Decks in Technology

Transcript

  1. 2 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    About us Arun Iyer, Hortonworks Apache Storm CommiFer/PMC [email protected] SaJsh Duggana, Hortonworks Apache Storm CommiFer/PMC [email protected]
  2. 4 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Apache Storm 1.0 Maturity and Improved Performance Release Date: April 12, 2016
  3. 6 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Distributed Cache API Ã  Topology resources –  DicJonaries, ML Models, GeolocaJon Data, etc. Ã  Typically packaged in topology jar –  Fine for small files –  Large files negaJvely impact topology startup Jme –  Immutable: Changes require repackaging and deployment
  4. 7 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Distributed Cache API Ã  Allows sharing of files (BLOBs) among topologies Ã  Files can be updated from the command line Ã  Allows for files from several KB to several GB in size Ã  Files can change over the lifeJme of the topology Ã  Allows for compression (e.g. zip, tar, gzip)
  5. 8 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Distributed Cache API Ã  Two implementaJons: LocalFsBlobStore and HdfsBlobStore Ã  Local implementaJon supports ReplicaJon Factor (not needed for HDFS-backed implementaJon) Ã  Both support ACLs
  6. 9 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Distributed Cache API CreaJng a blob: –  storm blobstore create --file dict.txt --acl o::rwa --repl-fctr 2 key1 Making it available to a topology: –  storm jar topo.jar my.topo.Class test_topo -c topology.blobstore.map=‘{"key1":{"localname":"dict.txt", "uncompress":"false"}}'
  7. 11 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Nimbus Nimbus HA ZooKeeper Supervisor Worker* Supervisor Worker* Supervisor Worker*
  8. 12 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Nimbus Leader Nimbus Nimbus Nimbus HA ZooKeeper Supervisor Worker* Supervisor Worker* Supervisor Worker*
  9. 13 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Nimbus Leader Nimbus Nimbus Nimbus HA ZooKeeper Supervisor Worker* Supervisor Worker* Supervisor Worker* Leader elecJon
  10. 14 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Nimbus Nimbus Leader Nimbus Nimbus HA ZooKeeper Supervisor Worker* Supervisor Worker* Supervisor Worker*
  11. 15 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Nimbus Nimbus Leader Nimbus Nimbus HA ZooKeeper Supervisor Worker* Supervisor Worker* Supervisor Worker*
  12. 16 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Nimbus HA Ã  Increase overall availability of Nimbus Ã  Nimbus hosts can join/leave at any Jme Ã  Leverages Distributed Cache API Ã  Topology JAR, Config, and Serialized Topology uploaded to Distributed Cache Ã  ReplicaJon guarantees availability of all files
  13. 18 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Pacemaker Ã  Replaces Zookeeper for Heartbeats Ã  In-Memory key-value store Ã  Allows Scaling to 2k-3k+ Nodes Ã  Secure: Kerberos/Digest AuthenJcaJon
  14. 19 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Pacemaker Ã  Compared to Zookeeper –  Less Memory/CPU –  No Disk –  No overhead of maintaining consistency
  15. 21 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    AutomaBc Back Pressure Ã  In previous Storm versions, the only way to throFle topologies was to enable ACKing and set topology.spout.max.pending. Ã  If you don’t require at-least-once guarantees, this imposed a significant performance penalty.
  16. 22 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    AutomaBc Back Pressure Ã  High/Low Watermarks (expressed as % of task’s buffer size) Ã  Back Pressure thread monitors task’s buffers Ã  If High Watermark reached, slow down Spouts Ã  If Low Watermark reached, stop throFling Ã  All Spouts Supported
  17. 24 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Up to 16x faster throughput RealisJcally 3x -- Highly dependent on use case and fault tolerance selngs
  18. 27 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Resource Aware Scheduler Ã  Specify the resource requirements (Memory/CPU) for individual topology components (Spouts/Bolts) Ã  Memory: On-Heap / Off-Heap (if off-heap is used) Ã  CPU: Point system based on number of cores Ã  Resource requirements are per component instance (parallelism maFers)
  19. 28 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Resource Aware Scheduler Ã  CPU and Memory availability described in storm.yaml on each supervisor node. E.g.: supervisor.memory.capacity.mb: 3072.0
 supervisor.cpu.capacity: 400.0 Ã  ConvenJon for CPU capacity is to use 100 for each CPU core
  20. 29 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Resource Aware Scheduler SpoutDeclarer spout = builder.setSpout("sp1", new TestSpout(), 10); //set cpu requirement spout.setCPULoad(20); //set onheap and o2eap memory requirement spout.setMemoryLoad(64, 16); BoltDeclarer bolt1 = builder.setBolt("b1", new MyBolt(), 3).shuffleGrouping("sp1"); //sets cpu requirement. Not neccessary to set both CPU and memory. //For requirements not set, a default value will be used bolt1.setCPULoad(15); BoltDeclarer bolt2 = builder.setBolt("b2", new MyBolt(), 2).shuffleGrouping("b1"); bolt2.setMemoryLoad(100);
  21. 31 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    NaBve windowing support Ã  Fundamental abstracJon for processing conJnuous streams of events Ã  Breaks the stream of events into sub-sets Ã  The sub-sets can then be aggregated, joined or analyzed. Why is it important?
  22. 32 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    NaBve windowing support Ã  Trending items –  The top trending search queries in the last day –  Top tweets in the last 1 hour Ã  Complex event processing –  Windowing is fundamental to gain meaningful insights from a stream of events –  E.g. If same credit card is used from geographically distributed locaJons within the last one hour, it could be a fraud. Some use cases
  23. 33 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    NaBve windowing support Sliding Window Jme 0 5 10 15 Jme 0 5 10 15 Tumbling Window Windows do not overlap Windows can overlap
  24. 34 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    NaBve windowing support public class WindowMaxBolt extends BaseWindowedBolt { private OutputCollector collector; public void prepare(Map conf, TopologyContext context, OutputCollector collector) { this.collector = collector; } public void execute(TupleWindow inputWindow) { int max = Integer.MIN_VALUE; for (Tuple tuple: inputWindow.get()) { max = Math.Max(max, tuple.getIntegerByField(”val")); } collector.emit(new Values(max)); } public staBc void main(String[] args) { // ... builder.setBolt("slidingMax", new WindowMaxBolt().withWindow(DuraJon.minutes(10), DuraJon.minutes(2))); // submit topology StormSubmiFer.submitTopologyWithProgressBar(args[0], conf, builder.createTopology()); } }
  25. 35 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    NaBve windowing support public class WindowMaxBolt extends BaseWindowedBolt { private OutputCollector collector; public void prepare(Map conf, TopologyContext context, OutputCollector collector) { this.collector = collector; } public void execute(TupleWindow inputWindow) { int max = Integer.MIN_VALUE; for (Tuple tuple: inputWindow.get()) { max = Math.Max(max, tuple.getIntegerByField(”val")); } collector.emit(new Values(max)); } public staBc void main(String[] args) { // ... builder.setBolt("slidingMax", new WindowMaxBolt().withWindow(DuraJon.minutes(10), DuraJon.minutes(2))); // submit topology StormSubmiFer.submitTopologyWithProgressBar(args[0], conf, builder.createTopology()); } } triggered when the window ac.vates based on the window configura.on
  26. 36 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    NaBve windowing support public class WindowMaxBolt extends BaseWindowedBolt { private OutputCollector collector; public void prepare(Map conf, TopologyContext context, OutputCollector collector) { this.collector = collector; } public void execute(TupleWindow inputWindow) { int max = Integer.MIN_VALUE; for (Tuple tuple: inputWindow.get()) { max = Math.Max(max, tuple.getIntegerByField(”val")); } collector.emit(new Values(max)); } public staBc void main(String[] args) { // ... builder.setBolt("slidingMax", new WindowMaxBolt().withWindow(DuraJon.minutes(10), DuraJon.minutes(2))); // submit topology StormSubmiFer.submitTopologyWithProgressBar(args[0], conf, builder.createTopology()); } } the window configura.on
  27. 37 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    NaBve windowing support Trident topology.newStream("spout", spout) .window( SlidingDuraJonWindow.of(DuraJon.minutes(10), DuraJon.minutes(2)), // window configuraDon new InMemoryWindowsStoreFactory(), // window store factory new Fields("val"), // input field new Min("val"), // aggregate funcDon new Fields("max") // output field );
  28. 38 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    NaBve windowing support Ã  Processing Jme Ã  Event Jme –  e.g. Processing events out of a log file based on when the event actually happened –  Implemented based on watermarks Ã  Out of order and late events –  e.g. Mobile gaming data where the user goes offline and data arrives awer someJme Windowing consideraBons 6:02 6:01 6:05 6:08 7:01 7:00 6:10 6:12 7:02 6:15 Processing Jme 6:09 6:12 6:08 watermark watermark 6:10 late event
  29. 39 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    State Management Stateful Bolts with AutomaJc CheckpoinJng
  30. 40 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    State Management Ã  Allows storm bolts to store and retrieve the state of its computaJon Ã  The framework automaJcally and periodically snapshots the state of the bolts Ã  In-memory and Redis based state stores Ã  ImplementaJon based on –  Asynchronous Barrier Snapsholng (ABS) algorithm [1] –  Chandy-Lamport Algorithm [2] 1.  hFp://arxiv.org/abs/1506.08603 2.  hFp://research.microsow.com/en-us/um/people/lamport/pubs/chandy.pdf
  31. 41 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    State Management public class WordCountBolt extends BaseStatefulBolt<KeyValueState> { private KeyValueState wordCounts; private OutputCollector collector; public void prepare(Map conf, TopologyContext context, OutputCollector collector) { this.collector = collector; } public void initState(KeyValueState state) { this.wordCounts = state; } public void execute(Tuple tuple) { String word = tuple.getString(0); Integer count = (Integer) wordCounts.get(word, 0); count++; wordCounts.put(word, count); collector.emit(new Values(word, count)); } }
  32. 42 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    State Management public class WordCountBolt extends BaseStatefulBolt<KeyValueState> { private KeyValueState wordCounts; private OutputCollector collector; public void prepare(Map conf, TopologyContext context, OutputCollector collector) { this.collector = collector; } public void initState(KeyValueState state) { this.wordCounts = state; } public void execute(Tuple tuple) { String word = tuple.getString(0); Integer count = (Integer) wordCounts.get(word, 0); count++; wordCounts.put(word, count); collector.emit(new Values(word, count)); } } IniBalize state
  33. 43 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    State Management public class WordCountBolt extends BaseStatefulBolt<KeyValueState> { private KeyValueState wordCounts; private OutputCollector collector; public void prepare(Map conf, TopologyContext context, OutputCollector collector) { this.collector = collector; } public void initState(KeyValueState state) { this.wordCounts = state; } public void execute(Tuple tuple) { String word = tuple.getString(0); Integer count = (Integer) wordCounts.get(word, 0); count++; wordCounts.put(word, count); collector.emit(new Values(word, count)); } } Update state
  34. 44 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    State Management Ã  CheckpoinJng/Snapsholng: What you see Spout Stateful Bolt1 Stateful Bolt2 Bolt1 execute/update state execute/update state execute
  35. 45 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    State Management Ã  CheckpoinJng/Snapsholng: What you get Spout Checkpoint Spout Stateful Bolt1 Stateful Bolt2 Bolt1 State Store ACKER ACK ACK ACK chkpt chkpt chkpt
  36. 47 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Streaming SQL Ã  SQL is a well adopted standard –  available in several projects like Drill, Hive, Phoenix, Spark Ã  Faster development cycle Ã  Opportunity to unify batch and stream data analyJcs Benefits SELECT word, COUNT(*) AS total FROM words GROUP BY word
  37. 48 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Streaming SQL Ã  Leverages Apache calcite Ã  Compiles SQL statements into Trident topologies Ã  Usage: –  $ bin/storm sql <sql-file> <topo-name> Storm implementaBon
  38. 49 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Streaming SQL Ã  Example CREATE EXTERNAL TABLE ORDERS (ID INT PRIMARY KEY, UNIT_PRICE INT, QUANTITY INT) LOCATION 'kafka://localhost:2181/brokers?topic=orders’ CREATE EXTERNAL TABLE LARGE_ORDERS (ID INT PRIMARY KEY, TOTAL INT) LOCATION 'kafka://localhost:2181/brokers?topic=large_orders’ INSERT INTO LARGE_ORDERS SELECT ID, UNIT_PRICE * QUANTITY AS TOTAL FROM ORDERS WHERE UNIT_PRICE * QUANTITY > 50
  39. 50 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Streaming SQL Ã  Storm SQL workflow
  40. 51 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Streaming SQL Ã  Storm SQL workflow
  41. 52 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Storm Usability Improvements Enhanced Debugging and Monitoring of Topologies
  42. 53 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Storm usability improvements ./bin/storm set_log_level [topology name]-l [logger name]=[LEVEL]:[TIMEOUT] Dynamic Log Levels Storm CLI: Storm UI:
  43. 54 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Storm usability improvements Ã  No more debug bolts or Trident funcJons Ã  Click on the “Events” link to view the sample log. Tuple Sampling
  44. 55 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Storm usability improvements Ã  Distributed Log search – Search across all topology logs, even archived (ZIP) logs. Ã  Dynamic worker profiling – Heap dumps, JStack output, Profiler recordings Ã  Restart workers from UI Ã  Supervisor health checks
  45. 56 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    IntegraBons New Ã  Cassandra Ã  Solr Ã  ElasJc Search Ã  MQTT Improvements Ã  Ka•a Ã  HDFS spout Ã  Hbase Ã  Hive
  46. 57 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    What’s next for Storm? 2.0 and Beyond
  47. 58 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Clojure to Java Broadening the contributor base Alibaba JStorm ContribuJon
  48. 59 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Apache Beam (incubaBng) IntegraBon Ã  Unified API for dealing with bounded/ unbounded data sources (i.e. batch/ streaming) Ã  One API. MulJple implementaJons (execuJon engines). Called “Runners” in Beamspeak.
  49. 60 © Hortonworks Inc. 2011 – 2016. All Rights Reserved

    Apache Storm 2.0 and beyond Ã  Windowing enhancements Ã  Unified Stream API Ã  Revamped UI Ã  Metrics improvements and many more…