simplifying big data with apache crunch
play

Simplifying Big Data with Apache Crunch Micah Whitacre @mkwhit - PowerPoint PPT Presentation

Simplifying Big Data with Apache Crunch Micah Whitacre @mkwhit Semantic Chart Search Medical Alerting System Cloud Based EMR Population Health Management Problem moves from scaling architecture ... Problem moves from not only scaling


  1. Simplifying Big Data with Apache Crunch Micah Whitacre @mkwhit

  2. Semantic Chart Search Medical Alerting System Cloud Based EMR Population Health Management

  3. Problem moves from scaling architecture ...

  4. Problem moves from not only scaling architecture ... To how to scale the knowledge

  5. Battling the 3 V’s

  6. Daily, weekly, monthly uploads Battling the 3 V’s

  7. Daily, weekly, monthly uploads 60+ different data formats Battling the 3 V’s

  8. Daily, weekly, monthly uploads 60+ different data formats Battling the 3 V’s Constant streams for near real time

  9. Daily, weekly, monthly uploads 60+ different data formats Battling the 3 V’s Constant streams for near real time 2+ TB of streaming data daily

  10. Population Health Load Data Avro Normalize Apply HBase CSV for Solr Data Algorithms Vertica Displays Vertica HBase

  11. Process CSV Reference Data Process Filter Out Group Create Raw Data Invalid Data By Person Avro using Data Person Record Reference Process Raw CSV Person Data

  12. R M e a d p u p c e e r r

  13. Struggle to fit into single MapReduce job

  14. Struggle to fit into single MapReduce job Integration done through persistence

  15. Struggle to fit into single MapReduce job Integration done through persistence Custom impls of common patterns

  16. Struggle to fit into single MapReduce job Integration done through persistence Custom impls of common patterns Evolving Requirements

  17. Prep for HBase Bulk Load Process CSV Reference Data Process Filter Out Group Create Raw Data Invalid Data By Person Avro using Data Person Record Reference Process Raw CSV Person Data Anonymize Avro Data

  18. Easy integration between teams Focus on processing steps Shallow learning curve Ability to tune for performance

  19. Apache Crunch Compose processing into pipelines Open Source FlumeJava impl Transformation through fns (not job) Utilizes POJOs (hides serialization)

  20. Process CSV Reference Data Process Filter Out Group Create Raw Data Invalid Data By Person Avro using Data Person Record Reference Process Raw CSV Person Data

  21. Processing Pipeline Process CSV Reference Data Process Filter Out Group Create Raw Data Invalid Data By Person Avro using Data Person Record Reference Process Raw CSV Person Data

  22. Pipeline Programmatic description of DAG Supports lazy execution Implementations indicate runtime MapReduce, Spark, Memory

  23. Pipeline pipeline = new MRPipeline(Driver.class, conf); Pipeline pipeline = MemPipeline.getIntance(); Pipeline pipeline = new SparkPipeline(sparkContext, “app”);

  24. Source Reads various inputs At least one required per pipeline Creates initial collections for processing Custom implementations

  25. Source Sequence Files Strings Avro AvroRecords Parquet Results HBase POJOs JDBC Protobufs HFiles Thrift Text Writables CSV

  26. pipeline.read( From.textFile(path));

  27. pipeline.read( new TextFileSource(path,ptype));

  28. PType<String> ptype = …; pipeline.read( new TextFileSource(path,ptype));

  29. PType Hides serialization Exposes data in native Java forms Supports composing complex types Avro, Thrift, and Protocol Buffers

  30. Multiple Serialization Types Serialization Type = PTypeFamily Avro & Writable available Can’t mix families in single type Can easily convert between families

  31. PType<Integer> intTypes = Writables.ints(); PType<String> stringType = Avros.strings(); PType<Person> personType = Avros.records(Person.class);

  32. PType<Pair<String, Person>> pairType = Avros.pairs(stringType, personType);

  33. PTableType<String, Person> tableType = Avros.tableOf(stringType,personType);

  34. PType<String> ptype = …; PCollection<String> strings = pipeline.read( new TextFileSource(path, ptype));

  35. PCollection Immutable Unsorted Not created only read or transformed Represents potential data

  36. Process CSV Reference Data Process Filter Out Group Create Raw Data Invalid Data By Person Avro using Data Person Record Reference Process Raw CSV Person Data

  37. Process PCollection<String> PCollection<RefData> Reference Data

  38. DoFn Simple API to implement Transforms PCollection between forms Location for custom logic Processes one element at a time

  39. For each item emits 0:M items MapFn - emits 1:1 FilterFn - returns boolean

  40. DoFn API class ExampleDoFn extends DoFn<String, RefData>{ ... } Type of Data In Type of Data Out

  41. Type of Data In Type of Data Out public void process (String s, Emitter<RefData> emitter) { RefData data = …; emitter.emit(data); }

  42. PCollection<String> refStrings PCollection<RefData> refs = refStrings.parallelDo(fn, Avros.records(RefData.class));

  43. PCollection<String> dataStrs... PCollection<RefData> refs = dataStrs.parallelDo(diffFn, Avros.records(Data.class));

  44. Process CSV Reference Data Process Filter Out Group Create Raw Data Invalid Data By Person Avro using Data Person Record Reference Process Raw CSV Person Data

  45. Hmm now I need to join... But they don’t have a common key? We need a PTable

  46. PTable<K, V> Immutable & Unsorted Multimap of Keys and Values Variation PCollection<Pair<K, V>> Joins, Cogroups, Group By Key

  47. class ExampleDoFn extends DoFn<String, RefData>{ ... }

  48. class ExampleDoFn extends DoFn<String, Pair<String, RefData>>{ ... }

  49. PCollection<String> refStrings PTable<String, RefData> refs = refStrings.parallelDo(fn, Avros.tableOf(Avros.strings(), Avros.records(RefData.class)));

  50. PTable<String, RefData> refs…; PTable<String, Data> data…;

  51. data.join(refs); (inner join)

  52. PTable<String, Pair<Data, RefData>> joinedData = data.join(refs);

  53. Joins right, left, inner, outer Eliminates custom impls Mapside, BloomFilter, Sharded

  54. Process CSV Reference Data Process Filter Out Group Create Raw Data Invalid Data By Person Avro using Data Person Record Reference Process Raw CSV Person Data

  55. Process CSV Reference Data Process Filter Out Group Create Raw Data Invalid Data By Person Avro using Data Person Record Reference Process Raw CSV Person Data

  56. FilterFn API class MyFilterFn extends FilterFn<...>{ ... } Type of Data In

  57. public boolean accept (... value){ return value > 3; }

  58. PCollection<Model> values = …; PCollection<Model> filtered = values.filter(new MyFilterFn());

  59. Process CSV Reference Data Process Filter Out Group Create Raw Data Invalid Data By Person Avro using Data Person Record Reference Process Raw CSV Person Data

  60. Keyed By PersonId PTable<String,Model> models = …;

  61. PTable<String,Model> models = …; PGroupedTable<String, Model> groupedModels = models.groupByKey();

  62. PGroupedTable<K, V> Immutable & Sorted PCollection<Pair<K, Iterable<V>>>

  63. Process CSV Reference Data Process Filter Out Group Create Raw Data Invalid Data By Person Avro using Data Person Record Reference Process Raw CSV Person Data

  64. Process CSV Reference Data Process Filter Out Group Create Raw Data Invalid Data By Person Avro using Data Person Record Reference Process Raw CSV Person Data

  65. PCollection<Person> persons = …;

  66. PCollection<Person> persons = …; pipeline.write(persons, To.avroFile(path));

  67. PCollection<Person> persons = …; pipeline.write(persons, new AvroFileTarget(path));

  68. Target Persists PCollection At least one required per pipeline Custom implementations

  69. Target Sequence Files Strings Avro AvroRecords Parquet Results HBase POJOs JDBC Protobufs HFiles Thrift Text Writables CSV

  70. Process CSV Reference Data Process Filter Out Group Create Raw Data Invalid Data By Person Avro using Data Person Record Reference Process Raw CSV Person Data

  71. Execution Pipeline pipeline = …; ... pipeline.write(...); PipelineResult result = pipeline.done();

  72. Map Reduce Reduce Process CSV Reference Data Process Filter Out Group Create Raw Data Invalid Data By Person Avro using Data Person Record Reference Process Raw CSV Person Data

  73. Tuning Tweak pipeline for performance GroupingOptions/ParallelDoOptions Scale factors

  74. Functionality first Focus on the transformations Smaller learning curve Less fragility

  75. Iterate with confidence Integration through PCollections Extend pipeline for new features

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend