¿por que cambiar de apache hadoop a apache spark?
TRANSCRIPT
![Page 1: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/1.jpg)
¿Por qué cambiar de Hadoop a Spark? Teoria y ejemplos de nuestra experiencia
Gustavo Arjones [email protected] @arjones
![Page 2: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/2.jpg)
Co-founder & CTO Lic. Ciencias Computación MBA Marketing Servicios @arjones [email protected] linkedIn.com/in/arjones Brasileño, en ARG desde 2008
Gustavo Arjones
![Page 3: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/3.jpg)
![Page 4: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/4.jpg)
![Page 5: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/5.jpg)
#1 Interacción
![Page 6: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/6.jpg)
Razones para elección
• Reducir las incertimdubres del proyecto
• HiveQL à SQL menor ramp-up
• Hadoop/Hive tenía soporte en AWS
• Proof of Concept funcionó correctamente
• Pruebas con DynamoDB demonstraron ser muy costosas
![Page 7: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/7.jpg)
Empiezan los problemas
![Page 8: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/8.jpg)
HQL complejas son para escribir una vez y nunca más entenderlas!
![Page 9: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/9.jpg)
![Page 10: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/10.jpg)
Hive es difícil de testear
• Frameworks de tests para Hive no están maduros y son dificiles de implementar.
• Gastamos mucho tiempo y recursos escribiendo validadores de procesos y métricas
![Page 11: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/11.jpg)
No están las últimas versiones de Hive en AWS
• Se había lanzado Hive 0.13 hacias 4+ meses y nosotros todavía teníamos Hive 0.12 en AWS
• Perdíamos la dinámica de un proyecto con muchas features nuevas y mejoras de performance
![Page 12: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/12.jpg)
MySQL retrasaba los jobs
• Cuando los MapReduce jobs terminanban y había que enviar los datos a MySQL, estaba tomando 2x más tiempo que el MR de cálculo.
• Problemas típicos de MySQL, pérdida de performance en grande volúmenes de datos
• Limite de escalabilidad
![Page 13: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/13.jpg)
Y como resultado …
• Bugs aumentando
• Tiempo de proyecto dilatandose
• Baja reutilización de codigo
• Problemas que atraparías en COMPILE-TIME terminan en RUNTIME – porque es SQL!
![Page 14: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/14.jpg)
¿Qué hacemos?
![Page 15: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/15.jpg)
Seguimos por el mismo camino?
• Probar Pig
• Probar Cascading (o Scalding)
• Probar Hbase
Pero seguíamos preocupados con el tiempo de ejecución!
![Page 16: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/16.jpg)
¿Probamos el framework que la gente viene hablando?
![Page 17: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/17.jpg)
Qué es Spark? Apache Spark™ is a fast and general engine for large-scale data processing. • Procesamiento In-memory (preferencialmente)
• Framework de Procesamiento Unificado
• Para Ingenieros & Data Scientists
![Page 18: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/18.jpg)
Principales Pilares Task Scheduler • Prepara los jobs a traves de DAG (Directed acyclic
graph) • Enganchan funciones para ejecutar los stages • Cache-aware; considera data utilización &
localización (data locality) • Partitioning-aware para reducir shuffles por la red
RDD (Resilient Distributed Datasets) • Estructura de datos Immutable (In-memory) • Tolerante a fallas (Se reama en caso de falla) • Estructura de datos que puede ser operada en
paralelo • Rica interfaz de Transformations & Actions
![Page 19: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/19.jpg)
DEMO – Word Count (el hello world de BigData)
![Page 20: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/20.jpg)
¿Por qué nos gusta?
![Page 21: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/21.jpg)
Viene de buen “origen” BDAS, the Berkeley Data Analytics Stack (AMPLAB)
![Page 22: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/22.jpg)
Plataforma Unificada
![Page 23: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/23.jpg)
Plataforma Unificada (lines of code)
0 20000 40000 60000 80000
100000 120000 140000
Hadoop MapReduce
Storm (Streaming)
Impala (SQL) Giraph (Graph)
Spark
non-test, non-example source lines (2014 numbers)
GraphX
Streaming SparkSQL
![Page 24: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/24.jpg)
Proyecto muy activo (y ganando tracción) ’13-’14
![Page 25: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/25.jpg)
Proyecto muy activo 2015
![Page 26: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/26.jpg)
![Page 27: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/27.jpg)
h;ps://twi;er.com
/bigdata/status/610482424741367809
![Page 28: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/28.jpg)
Y más … • Esfuerzo para estandarización de la plataforma
• Certificación para Distros & Apps gratis
• Material de training gratis
• Databricks levantó $47M
• Databricks Cloud (?)
![Page 29: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/29.jpg)
Ventajas de la Plataforma Unificada
• No es necesario copiar datos/ETL entre sistemas
• Varios procesamientos en el mismo código (claridad)
• Reutilización de código (Batch & Realtime)
• Un único sistema para aprender ß Happy Devs
• Ops: Un único sistema para mantener ß Happy Ops
Big Deal para Arquitectura Lambda
![Page 30: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/30.jpg)
Compacto y poderoso • Escrito en Scala, con wrappers para Python, Java* y R
![Page 31: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/31.jpg)
API muy expresiva
Ver: https://spark.apache.org/docs/latest/api/scala/#org.apache.spark.rdd.RDD
+ SQL +
Data Frames
![Page 32: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/32.jpg)
• Aprender, prototipado rápido • Análisis interactivo sobre los datos
Consola interactiva (REPL)
![Page 33: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/33.jpg)
Version Web de Spark-Shell – similar a Python Notebooks
![Page 34: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/34.jpg)
Spark UI
h;ps://databricks.com
/blog/2015/06/22/und
erstanding-‐
your-‐spark-‐app
licaM
on-‐throu
gh-‐visu
aliza
Mon.html
![Page 35: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/35.jpg)
Soporte Datasources
h;p://spark-‐packages.org
![Page 36: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/36.jpg)
Spark SQL Demo
![Page 37: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/37.jpg)
Código Testeable! • El contexto puede crear RDD
![Page 38: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/38.jpg)
Easy Deployment
• Local-mode (development)
• Standalone (bare metal)
• Standalone + Amazon AWS
• Mesos
• Yarn
![Page 39: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/39.jpg)
Components for distributed execution in Spark
![Page 40: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/40.jpg)
Y Hadoop? Spark Or Hadoop -- Which Is The Best Big Data Framework? http://www.forbes.com/sites/bernardmarr/2015/06/22/spark-or-hadoop-which-is-the-best-big-data-framework/
![Page 41: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/41.jpg)
Modelo Map-Reduce
iter. 1 iter. 2 . . .
Input
HDFS read
HDFS write
HDFS read
HDFS write
Input
query 1
query 2
query 3
result 1
result 2
result 3
. . .
HDFS read
Lento porque necesita replicación, serialización y I/O
![Page 42: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/42.jpg)
iter. 1 iter. 2 . . .
Input
Distributed memory
Input
query 1
query 2
query 3
. . .
one-time processing
10-100× más rápido
Spark (in-memory + DAG execution engine)
![Page 43: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/43.jpg)
Spark y Hadoop pueden ser amigos • No hay HDFS en Spark – ver Tachyon • Acceso HDFS / S3 • YARN • Usando Input/Output formats de Hadoop
![Page 44: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/44.jpg)
Log Analyzer https://www.gitbook.com/book/databricks/databricks-spark-reference-applications/details
![Page 45: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/45.jpg)
Entonces todo es perfecto? Nop … • Long Jobs • Serialization Issues • OOM • Data Locallity
http://blog.cloudera.com/blog/2015/05/working-with-apache-spark-or-how-i-learned-to-stop-worrying-and-love-the-shuffle/
![Page 46: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/46.jpg)
Donde aprender más?
![Page 47: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/47.jpg)
Mucha documentación disponible Official Documentation https://spark.apache.org/ Spark Summit 2015 - Slides and Video https://spark-summit.org/2015/ Blog Official Databricks https://databricks.com/blog Personal notes about Apache Spark http://arjon.es/tag/spark/
![Page 48: ¿Por que cambiar de Apache Hadoop a Apache Spark?](https://reader033.vdocuments.pub/reader033/viewer/2022042509/55c08981bb61ebe85a8b45f2/html5/thumbnails/48.jpg)
No te gustó Spark? Apache Flink http://flink.apache.org