Share
Embed
Python und Big-Data-Frameworks (Data2Day 2014)
Vortrag (DE) "Python und Big-Data-Frameworks" von Frank Kaufer und Christoph Böhm, bakdata (http://www.bakdata.com), auf der Data2Day (http://www.data2day.de/) 2014, Karlsruhe, 26.11.2014.
Buzzwords: Python, PyData, Big Data, Scale out, Distributed Systems, Hadoop, Impala, Spark
Code & Links: https://github.com/bakdata/data2day-2014
Frank Kaufer
November 26, 2014
Transcript
30 slides
-
B E S P O K E D A T
A E N G I N E E R I N G Python und Big-Data-Frameworks Frank Kaufer Dr. Christoph Böhm 26.11.14 Data2Day 2014, Karlsruhe -
26.11.14 Data2Day 2014, Karlsruhe bakdata - Bespoke Data Engineering ▪
Data Systems ¤ DevOps ¤ Data Management Systems ¤ Cluster Computing ▪ Data Processing ¤ Extract Transform Load ¤ Polyglot data-oriented algorithms ▪ Data Analytics ¤ Data profiling/cleansing ¤ Data Mining, Machine Learning, Statistics ¤ Data Warehousing ¤ Data Visualization ¤ Geospatial Data -
26.11.14 Data2Day 2014, Karlsruhe Warum Python? ▪ Alternativen ¤ Klassische
Universalsprachen: Java/JVM, C/C++ ¤ Scientific Computing, Statistik: Matlab, R, SAS, SPSS, Stata, Mathematica ¤ Concurrent Computing: Fortran, Erlang, Clojure ¤ “Next Generation”: Scala, Julia ▪ Elegante Syntax, Lesbarkeit, “excecutable pseudocode” ▪ Multi-paradigm ▪ “batteries included”-Philosophie ▪ Community ▪ Operator overloading, DSLs ▪ Fließender Übergang Rapid Prototyping zu Produktivbetrieb ▪ Optimierung in C/C++ (Cython) ▪ REPL, IPython ▪ “glue language” -
26.11.14 Data2Day 2014, Karlsruhe PyData ▪ PyData Stack ¤ NumPy,
SciPy ¤ matplotlib ¤ pandas ¤ scikit-learn (“sklearn”), statsmodels ¤ SQLAlchemy ▪ IPython, Jupyter ▪ Community, Markt ¤ Enthought ¤ Continuum Analytics (Anaconda, Numba, blaze, Bokeh) ¤ Cloudera/DataPad ¤ DARPA XDATA ¤ PyData conference ¤ PyData Berlin (http://pydata.berlin, @pydataberlin) 1 -
26.11.14 Data2Day 2014, Karlsruhe “Big Data” unter Ockhams Rasiermesser ▪
3, 5, 7, ... Vs ▪ Big Data ¤ Datengröße zentraler Teil der Herausforderung ¤ Skalierbarkeit zentrale Anforderung an die Lösung ▪ Datengröße relativ zu Resourcen ¤ Kapazität: Größe Datenspeicher (Disk, RAM) ¤ Zeit: Streaming/Sensor Data, Interaktive Analyse ¤ IT: Maschinerie, Programmiersprachen ¤ Personal, Know-How ¤ Budget, fachliche Anforderungen, SLAs, Prozesse ▪ Skalierbarkeit -
26.11.14 Data2Day 2014, Karlsruhe Big Data / Scale Out -
Themen ▪ DevOps ▪ Storage, Distributed File Systems, Data Stores ▪ DAG runtimes, Distributed Processing Operators ¤ Map, Reduce ¤ Beyond Map Reduce ▪ Resource Management, Meta-Data Management, Scheduling, Optimizer ▪ Workflow management/programming, ETL, Compilers ▪ Data /Job/Message Dispatching, Distributed Queues ▪ Stream Processing ▪ Connectors, File Formats, Loaders ▪ Query Engines ▪ Monitoring, Tracking ▪ Higher-Level Layers, Applications: Batch, Stream, Analytics/Statistics/ML, SQL, Data Warehousing, Graphs, Search -
26.11.14 Data2Day 2014, Karlsruhe Big Data - Technologie ▪ Technologie
¤ Hadoop ¤ Impala ¤ Spark ¤ ... ▪ RDBMS? ▪ Markt, Community ¤ Spezialisten: Cloudera, Hortonworks, MapR ¤ Google, Yahoo, Amazon, Microsoft, SAP, Oracle, IBM, TeraData, ... ¤ “Benchmarketing” ¤ Forschung: ▶ UC Berkeley AMPLab ▶ in Deutschland u.a. Berlin Big Data Center (Stratosphere / Apache Flink) ¤ Strata ▪ Programmiersprachen: JVM (Java/Scala), C/C++ ▪ Python? -
26.11.14 Data2Day 2014, Karlsruhe Nebenthema: Virtualisierung, DevOps ▪ Virtualisierung: Verwandt
mit Big Data (Cluster) und gleichzeitig gegenläufig ¤ Datencluster besser auf physischen Maschinen, kein Overhead ¤ oft nicht einmal Storage-Virtualisierung (JBOD) ▪ Aber: physische Cluster sind teuer, zusätzliche Komplexität -> DevOps ▪ Virtualisierung wichtig für Big Data ¤ Einstieg für kleinere Firmen ¤ Developer ¤ (DevOps-) Tools/Pakete für vorkonfektionierte Umgebungen ¤ (vermeintlich) nahtloser Übergang von Entwicklung in virtueller Umgebung zu Rollout in Produktivbetrieb auf physischen Maschinen ¤ Auch sinnvoll produktiv: Feingranularere Virtualisierung - Container ▪ Amazon (AWS) & Co: EC2, EMR, Google Cloud Platform, MS Azure, IBM SoftLayer ▪ vSphere, VirtualBox, LXC (Linux-Container) ▪ Ansible, Chef, Puppet, Salt ▪ Vagrant, Veewee, Docker, Ferry ▪ virtualenv -
Scale out mit Python Python & Big Data 26.11.14 Data2Day
2014, Karlsruhe -
26.11.14 Data2Day 2014, Karlsruhe Big Data Analytics Workflow ▪ Datenakquise,
Extraktion ▪ Sample ¤ Data Profiling, Datenreinigung ¤ Datenintegration ¤ Datenanalyse ▪ Scale out ¤ DevOps ¤ Parallelisierung, Verteilung ¤ Produktivbetrieb ▶ Tests ▶ Optimierung ▶ Änderungen ¤ Realtime-Analysen -
26.11.14 Data2Day 2014, Karlsruhe Scale out in Python ▪ Parallelisierung
- Einzelrechner, Multicore ¤ Global Interpreter Lock (GIL) ¤ threading ¤ multiprocessing ¤ memmapping ¤ joblib ¤ shared memory via Cython/OpenMP ¤ Koroutinen, Micro-Threads: gevent, greenlet, Eventlet, celery, Stackless Python ▪ Parallel und verteilt, low-level ¤ Distributed shared-memory ¤ MPI: OpenMPI, mpi4py ▪ Parallel und verteilt, higher-level (“shared nothing”) ¤ Twisted ¤ RPyC ¤ Queues: ZeroMQ, RabbitMQ (pika, py-amqplib) ¤ IPython.parallel (basiert auf ZeroMQ) ¤ Disco (Erlang, only MapReduce) ▪ Project Blaze -
▪ File, Data storage systems ¤ “Plain files” (CSV, Excel,
Stata DTA, ...) ¤ HDF5 ¤ Datenbanken (relational/strukturiert, semi-/unstruktriert, Key-Value, ...) ¤ Storage-Dienste wie S3 ▪ Serialization ¤ XML ¤ JSON ¤ MessagePack ¤ Avro ¤ Protocol buffers ¤ Apache Thrift ▪ Compression ¤ Zlib, LZ4/LZ4HC, Snappy ¤ Blosc ▪ Low-level IPC ¤ Shared Memory (nur theoretisch) ¤ Memory-Mapped files ¤ Pipes ▪ Messaging ¤ Socket ¤ RPC/Web Services ¤ Message/Job/Event queues/broker: ▶ ZeroMQ, RabbitMQ, Apache Kafka, Apache Qpid, ActiveMQ ▶ Übersicht: http://queues.io/ ▪ Bridges, gateways, compilers, intermediate representation (IR) ¤ Py4J (Java) ¤ PyCall (Julia) ¤ LLVM, Numba ¤ Cython (C extensions) ▪ IPython/Jupyter: IJulia, IPython-SQL, IScala, R: IRKernel, rmagic 26.11.14 Data2Day 2014, Karlsruhe Schnittstellentechnologien -
26.11.14 Data2Day 2014, Karlsruhe Python DevOps ▪ boto (AWS, "Cloud")
▪ pyvsphere (VSphere/ESX, "Private Cloud") ▪ fabric ▪ Ansible ¤ Ansible Python API ¤ Developing Ansible modules in Python ▪ Cloudera Manager Python API ▪ Supervisor ▪ CI: python-jenkins, jenkinsAPI, TravisPy, buildbot 2 -
26.11.14 Data2Day 2014, Karlsruhe Hadoop ▪ HDFS ▪ Resource Manager
(YARN) ▪ MapReduce ▪ Hadoop ecosystem ¤ Data store: HBase, Accumulo ¤ Strukturierte DB: Cassandra ¤ SQL, DWH: Hive, Tajo ¤ Machine Learning: Mahout ¤ Management: Oozie, Zookeeper, Ambari, Azkaban ¤ Data Serialization, Loader: Sqoop, Avro, Flume ¤ Stream: Storm ¤ Programmierung, ETL: Apache Pig, Cascading -
26.11.14 Data2Day 2014, Karlsruhe Hadoop & Python ▪ HDFS: snakebite
▪ Hadoop Streaming ▪ MapReduce: mrjob ▪ pywebhdfs ▪ yarn-api-client ▪ dumbo, hadoopy, pydoop, ... ▪ Python & Hadoop ecosystem: ¤ streamparse (Storm) ¤ PyCascading ¤ ... 5 4 3 -
▪ Cloudera ▪ Skalierbare interaktive Datenanalyse ▪ Distributed query procressing
engine ▪ Einordnung ¤ SQL on Hadoop – HDFS vs. MapReduce ¤ Apache Hive – MapReduce ¤ Apache Tajo ¤ Pivotal HAWQ, Facebook Presto, Amazon Redshift 26.11.14 Data2Day 2014, Karlsruhe Impala Quelle: Cloudera -
26.11.14 Data2Day 2014, Karlsruhe Impala & Python ▪ impyla ▪
DB-API, inkl. Support für HiveServer2, Beeswax, Kerberos ▪ Pandas DataFrame ▪ performante Python UDFs mittels Numba/LLVM ▪ BigDataFrame – Pandas+Spark RDD in Impala ▪ Integration mit Blaze, SQL Alchemy ▪ sklearn-orientierter wrapper für MADlib 6 -
26.11.14 Data2Day 2014, Karlsruhe Spark ▪ AMPLab, Databricks ▪ DAG
engine ▪ Resilient Distributed Datasets ¤ distributed collections ¤ memory with options to persist/spill-over to disk ▪ Mehr Operatoren: ¤ Transformation: map, join, cogroup, groupByKey, filter, union, intersection, ... ¤ Aktionen: reduce, foreach, reduceByKey, take, ... ▪ Hadoop-”kompatibel” ¤ Daten: HDFS, HBase, Cassandra, ... ¤ Cluster management: YARN (alternativ auch Mesos) ▪ Higher-level tools ¤ Spark SQL (Nachfolger von Shark) ¤ Spark Streaming ¤ MLlib ¤ GraphX -
▪ PySpark ▪ API ¤ Client API - Wrapper ¤
Executer auf Knoten - Python Workers ▶ Py4J ▶ Python-Funktionen (inkl. lambda-Ausdrücke) ¤ Python Yarn Client ▪ Spark SQL External Script Query ▪ MLlib 26.11.14 Data2Day 2014, Karlsruhe Spark & Python 7 Quelle: Apache