6. • The leading candidate for “successor to
MapReduce” today is Apache Spark
• No vendor — no new project — is likely to catch
up. Chasing Spark would be a waste of time,
and would delay availability of real-time analytic
and processing services for no good reason. !
• From Cloudera CTO http://0rz.tw/y3OfM
What is Spark?
10. HDFS is 100x slower than memory
Input
(HDFS)
Iter 1
Tmp
(HDFS)
Iter 2
Tmp
(HDFS)
Iter N
Input
(HDFS)
Iter 1
Tmp
(Mem)
Iter 2
Tmp
(Mem)
Iter N
MapReduce
Spark
11. First iteration(HDFS)!
take 200 sec
3rd iteration(mem)!
take 7.7 sec
Page Rank algorithm in 1 billion record url
2nd iteration(mem)!
take 7.4 sec
14. PySpark
• Process via Python
• CPython
• Python lib (NumPy, Scipy…)
• Storage and transfer data in Spark
• HDFS access/Networking/Fault-recovery
• scheduling/broadcast/checkpointing/
22. Python Word Count
• file = spark.textFile("hdfs://...")
• counts = file.flatMap(lambda line: line.split(" "))
• .map(lambda word: (word, 1))
• .reduceByKey(lambda a, b: a + b)
• counts.saveAsTextFile("hdfs://...")
Access data via
Spark API
Process via Python
23. Python Word Count
• counts = file.flatMap(lambda line: line.split(" "))
You can find the
latest Spark
documentation,
including the
guide
Original text List
['You', 'can', 'find', 'the',
'latest', 'Spark',
'documentation,',
'including', 'the', ‘guide’]
27. PySpark + scikit-learn
• sgd = lm.SGDClassifier(loss=‘log')
• for ii in range(ITERATIONS):
• sgd = sc.parallelize(…)
• .mapPartitions(lambda x:…)
• .reduce(lambda x, y: merge(x, y))
Use scikit-learn in
Single mode(master)
Cluster operation
Use scikit-learn
function in cluster mode ,
deal with partial data
!
Source Code is From : http://0rz.tw/o2CHT
!
!
28. PySpark support MLlib
• MLlib is spark version machine learning lib
• Example: KMeans.train(parsedData, 2,
maxIter=10, runs=30, "random")
• Check it out on http://0rz.tw/M35Rz
32. Join Us
• Our team’s work is highlight by world top conf
• Hadoop Summit San Jose 2013
• Hadoop Summit Amsterdam 2014
• MSTR World Las Vegas 2014
• SparkSummit San Francisco 2014
• Jenkins Conf Palo Alto 2013