spark spark sql
play

Spark & Spark SQL High-Speed In-Memory Analytics over - PowerPoint PPT Presentation

CSE 6242 / CX 4242 Data and Visual Analytics | Georgia Tech Spark & Spark SQL High-Speed In-Memory Analytics over Hadoop and Hive Data Instructor: Duen Horng (Polo) Chau 1 Slides adopted


  1. CSE 6242 / CX 4242 Data and Visual Analytics | Georgia Tech Spark ¡& ¡ Spark ¡SQL High-­‑Speed ¡In-­‑Memory ¡Analytics 
 over ¡Hadoop ¡and ¡Hive ¡Data Instructor: Duen Horng (Polo) Chau 1 Slides ¡adopted ¡from ¡Matei ¡Zaharia ¡(MIT) ¡and ¡Oliver ¡Vagner ¡(Manheim, ¡GT)

  2. What ¡is ¡Spark ¡ ¡ ¡? http://spark.apache.org Not ¡a ¡modified ¡version ¡of ¡Hadoop ¡ Separate , ¡fast, ¡MapReduce-­‑like ¡engine ¡ » In-­‑memory ¡ data ¡storage ¡for ¡very ¡fast ¡iterative ¡queries ¡ » General ¡execution ¡graphs ¡and ¡powerful ¡optimizations ¡ » Up ¡to ¡40x ¡faster ¡than ¡Hadoop ¡ Compatible ¡with ¡Hadoop’s ¡storage ¡APIs ¡ » Can ¡read/write ¡to ¡any ¡Hadoop-­‑supported ¡system, ¡ including ¡HDFS, ¡HBase, ¡SequenceFiles, ¡etc 2

  3. What ¡is ¡Spark ¡SQL? ¡ 
 (Formally ¡called ¡Shark) Port ¡of ¡Apache ¡Hive ¡to ¡run ¡on ¡Spark ¡ Compatible ¡with ¡existing ¡Hive ¡data, ¡metastores, ¡ and ¡queries ¡(HiveQL, ¡UDFs, ¡etc) ¡ Similar ¡speedups ¡of ¡up ¡to ¡40x 3

  4. Project ¡History ¡ [latest: ¡v1.1] Spark ¡project ¡started ¡in ¡2009 ¡at ¡UC ¡Berkeley ¡AMP ¡lab, ¡open ¡ sourced ¡2010 ¡ UC ¡BERKELEY Became ¡Apache ¡Top-­‑Level ¡Project ¡in ¡Feb ¡2014 ¡ Shark/Spark ¡SQL ¡started ¡summer ¡2011 ¡ Built ¡by ¡250+ ¡developers ¡and ¡people ¡from ¡50 ¡companies ¡ Scale ¡to ¡1000+ ¡nodes ¡in ¡production ¡ In ¡use ¡at ¡Berkeley, ¡Princeton, ¡Klout, ¡Foursquare, ¡Conviva, ¡ Quantifind, ¡Yahoo! ¡Research, ¡… 4 http://en.wikipedia.org/wiki/Apache_Spark

  5. Why ¡a ¡New ¡Programming ¡Model? MapReduce ¡greatly ¡simplified ¡big ¡data ¡analysis But ¡as ¡soon ¡as ¡it ¡got ¡popular, ¡users ¡wanted ¡more: » More ¡ complex , ¡multi-­‑stage ¡applications ¡(e.g. 
 iterative ¡graph ¡algorithms ¡and ¡machine ¡learning) » More ¡ interactive ¡ad-­‑hoc ¡queries 5

  6. Why ¡a ¡New ¡Programming ¡Model? MapReduce ¡greatly ¡simplified ¡big ¡data ¡analysis But ¡as ¡soon ¡as ¡it ¡got ¡popular, ¡users ¡wanted ¡more: » More ¡ complex , ¡multi-­‑stage ¡applications ¡(e.g. 
 iterative ¡graph ¡algorithms ¡and ¡machine ¡learning) » More ¡ interactive ¡ad-­‑hoc ¡queries Require ¡faster ¡ data ¡sharing ¡ across ¡parallel ¡jobs 5

  7. Up for debate … as of 10/7/2014 Is ¡MapReduce ¡dead? http://www.datacenterknowledge.com/archives/ 2014/06/25/google-dumps-mapreduce-favor-new- hyper-scale-analytics-system/ http://www.reddit.com/r/compsci/comments/296aqr/on_the_death_of_mapreduce_at_google/ 6

  8. Data ¡Sharing ¡in ¡MapReduce HDFS 
 HDFS 
 HDFS 
 HDFS 
 read write read write . ¡ ¡. ¡ ¡. iter. ¡1 iter. ¡2 Input result ¡1 query ¡1 HDFS 
 read result ¡2 query ¡2 query ¡3 result ¡3 Input . ¡ ¡. ¡ ¡. 7

  9. Data ¡Sharing ¡in ¡MapReduce HDFS 
 HDFS 
 HDFS 
 HDFS 
 read write read write . ¡ ¡. ¡ ¡. iter. ¡1 iter. ¡2 Input result ¡1 query ¡1 HDFS 
 read result ¡2 query ¡2 query ¡3 result ¡3 Input . ¡ ¡. ¡ ¡. Slow ¡due ¡to ¡replication, ¡serialization, ¡and ¡disk ¡IO 7

  10. Data ¡Sharing ¡in ¡Spark iter. ¡1 iter. ¡2 . ¡ ¡. ¡ ¡. Input query ¡1 one-­‑time 
 processing query ¡2 query ¡3 Input Distributed 
 . ¡ ¡. ¡ ¡. memory 8

  11. Data ¡Sharing ¡in ¡Spark iter. ¡1 iter. ¡2 . ¡ ¡. ¡ ¡. Input query ¡1 one-­‑time 
 processing query ¡2 query ¡3 Input Distributed 
 . ¡ ¡. ¡ ¡. memory 10-­‑100 × ¡ faster ¡than ¡network ¡and ¡disk 8

  12. Spark ¡Programming ¡Model Key ¡idea: ¡ resilient ¡distributed ¡datasets ¡(RDDs) ¡ » Distributed ¡collections ¡of ¡objects ¡that ¡can ¡be ¡cached ¡in ¡ memory ¡across ¡cluster ¡nodes ¡ » Manipulated ¡through ¡various ¡parallel ¡operators ¡ » Automatically ¡rebuilt ¡on ¡failure ¡ Interface ¡ » Clean ¡language-­‑integrated ¡API ¡in ¡Scala ¡ » Can ¡be ¡used ¡ interactively ¡from ¡Scala, ¡Python ¡console ¡ » Supported ¡languages: ¡Java, ¡Scala, ¡Python 9

  13. http://www.scala-lang.org/old/faq/4 Java vs Scala: http://www.toptal.com/scala/why-should-i-learn-scala 10

  14. Example: ¡Log ¡Mining Load ¡error ¡messages ¡from ¡a ¡log ¡into ¡memory, ¡then ¡ interactively ¡search ¡for ¡various ¡patterns 11

  15. Example: ¡Log ¡Mining Load ¡error ¡messages ¡from ¡a ¡log ¡into ¡memory, ¡then ¡ interactively ¡search ¡for ¡various ¡patterns Worker Driver Worker Worker 11

  16. Example: ¡Log ¡Mining Load ¡error ¡messages ¡from ¡a ¡log ¡into ¡memory, ¡then ¡ interactively ¡search ¡for ¡various ¡patterns lines = spark.textFile(“hdfs://...”) Worker errors = lines.filter(_.startsWith(“ERROR”)) messages = errors.map(_.split(‘\t’)(2)) Driver cachedMsgs = messages.cache() Worker Worker 11

  17. Example: ¡Log ¡Mining Load ¡error ¡messages ¡from ¡a ¡log ¡into ¡memory, ¡then ¡ interactively ¡search ¡for ¡various ¡patterns Base ¡RDD lines = spark.textFile(“hdfs://...”) Worker errors = lines.filter(_.startsWith(“ERROR”)) messages = errors.map(_.split(‘\t’)(2)) Driver cachedMsgs = messages.cache() Worker Worker 11

  18. Example: ¡Log ¡Mining Load ¡error ¡messages ¡from ¡a ¡log ¡into ¡memory, ¡then ¡ interactively ¡search ¡for ¡various ¡patterns lines = spark.textFile(“hdfs://...”) Worker errors = lines.filter(_.startsWith(“ERROR”)) messages = errors.map(_.split(‘\t’)(2)) Driver cachedMsgs = messages.cache() Worker Worker 11

  19. Example: ¡Log ¡Mining Load ¡error ¡messages ¡from ¡a ¡log ¡into ¡memory, ¡then ¡ interactively ¡search ¡for ¡various ¡patterns lines = spark.textFile(“hdfs://...”) Transformed ¡RDD Worker errors = lines.filter(_.startsWith(“ERROR”)) messages = errors.map(_.split(‘\t’)(2)) Driver cachedMsgs = messages.cache() Worker Worker 11

  20. Example: ¡Log ¡Mining Load ¡error ¡messages ¡from ¡a ¡log ¡into ¡memory, ¡then ¡ interactively ¡search ¡for ¡various ¡patterns lines = spark.textFile(“hdfs://...”) Worker errors = lines.filter(_.startsWith(“ERROR”)) messages = errors.map(_.split(‘\t’)(2)) Driver cachedMsgs = messages.cache() Worker Worker 11

  21. Example: ¡Log ¡Mining Load ¡error ¡messages ¡from ¡a ¡log ¡into ¡memory, ¡then ¡ interactively ¡search ¡for ¡various ¡patterns lines = spark.textFile(“hdfs://...”) Worker errors = lines.filter(_.startsWith(“ERROR”)) messages = errors.map(_.split(‘\t’)(2)) Driver cachedMsgs = messages.cache() cachedMsgs.filter(_.contains(“foo”)).count Worker Worker 11

  22. Example: ¡Log ¡Mining Load ¡error ¡messages ¡from ¡a ¡log ¡into ¡memory, ¡then ¡ interactively ¡search ¡for ¡various ¡patterns lines = spark.textFile(“hdfs://...”) Worker errors = lines.filter(_.startsWith(“ERROR”)) messages = errors.map(_.split(‘\t’)(2)) Driver cachedMsgs = messages.cache() Action cachedMsgs.filter(_.contains(“foo”)).count Worker Worker 11

  23. Example: ¡Log ¡Mining Load ¡error ¡messages ¡from ¡a ¡log ¡into ¡memory, ¡then ¡ interactively ¡search ¡for ¡various ¡patterns lines = spark.textFile(“hdfs://...”) Worker errors = lines.filter(_.startsWith(“ERROR”)) messages = errors.map(_.split(‘\t’)(2)) Driver cachedMsgs = messages.cache() cachedMsgs.filter(_.contains(“foo”)).count Worker Worker 11

  24. Example: ¡Log ¡Mining Load ¡error ¡messages ¡from ¡a ¡log ¡into ¡memory, ¡then ¡ interactively ¡search ¡for ¡various ¡patterns lines = spark.textFile(“hdfs://...”) Worker errors = lines.filter(_.startsWith(“ERROR”)) messages = errors.map(_.split(‘\t’)(2)) Block ¡1 Driver cachedMsgs = messages.cache() cachedMsgs.filter(_.contains(“foo”)).count Worker Block ¡2 Worker Block ¡3 11

  25. Example: ¡Log ¡Mining Load ¡error ¡messages ¡from ¡a ¡log ¡into ¡memory, ¡then ¡ interactively ¡search ¡for ¡various ¡patterns lines = spark.textFile(“hdfs://...”) Worker errors = lines.filter(_.startsWith(“ERROR”)) messages = errors.map(_.split(‘\t’)(2)) tasks Block ¡1 Driver cachedMsgs = messages.cache() cachedMsgs.filter(_.contains(“foo”)).count Worker Block ¡2 Worker Block ¡3 11

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