SlideShare uma empresa Scribd logo
1 de 18
Baixar para ler offline
Spark은 왜 이렇게
유명해지고 있을까?
2015-04-23 KSLUG 세미나
김상우, VCNC(비트윈)
kevin@between.us
Spark 알아보기
빅데이터분석의 시초
• GFS(Google File System) 논문 (2003)
• 여러 컴퓨터를 연결하여 저장용량과 I/O성능을 scale
• 이를 구현한 오픈소스 프로젝트인 Hadoop HDFS
• MapReduce논문 (2004)
• Map과 Reduce연산을 조합하여 클러스터에서 실행, 큰 데이터를 처리
• 이를 구현한 오픈소스 프로젝트인 Hadoop MapReduce
public class WordCount {
public static class Map extends MapReduceBase implements Mapper<LongWritable, Text, Text, IntWritable> {
private final static IntWritable one = new IntWritable(1);
private Text word = new Text();
public void map(LongWritable key, Text value, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException {
String line = value.toString();
StringTokenizer tokenizer = new StringTokenizer(line);
while (tokenizer.hasMoreTokens()) {
word.set(tokenizer.nextToken());
output.collect(word, one);
}
}
}
public static class Reduce extends MapReduceBase implements Reducer<Text, IntWritable, Text, IntWritable> {
public void reduce(Text key, Iterator<IntWritable> values, OutputCollector<Text, IntWritable> output, Reporter reporter) throws
IOException {
int sum = 0;
while (values.hasNext()) {
sum += values.next().get();
}
output.collect(key, new IntWritable(sum));
}
}
public static void main(String[] args) throws Exception {
JobConf conf = new JobConf(WordCount.class);
conf.setJobName("wordcount");
conf.setOutputKeyClass(Text.class);
conf.setOutputValueClass(IntWritable.class);
conf.setMapperClass(Map.class);
conf.setCombinerClass(Reduce.class);
conf.setReducerClass(Reduce.class);
conf.setInputFormat(TextInputFormat.class);
conf.setOutputFormat(TextOutputFormat.class);
FileInputFormat.setInputPaths(conf, new Path(args[0]));
FileOutputFormat.setOutputPath(conf, new Path(args[1]));
JobClient.runJob(conf);
}
}
Word count in MapReduce (Java)
빅데이터 분석의 시초 (2)
• Hive
• MapReduce 코드를 짜는건 괴롭다
• 쿼리로 MapReduce의 거의 모든 기능을 표현할 수 있다!
• HDFS등에 있는 파일을 읽어들여 쿼리로 분석 수행
• HiveQL 을 작성하면 MapReduce 코드로 변환되어 실행
그렇게 10년이 지나고,
지금까지도 MapReduce와 Hive는 많이 사용되고 있는 빅데이터
기술입니다
MR, Hive에 도전하는 기술들
Impala, Pheonix, Pig, Tez 등등등등… 엄청 많다
MapReduce / Hive 장단점
• 장점
• 빅데이터 시대를 열어준 선구적인 기술
• 거대한 데이터를 안정적으로 처리
• 많은 사람들이 사용 중
• 단점
• 오래된 기술이다보니,
• 발전이 느리다
• 불편한점이 많다
MapReduce의 문제점
• MapReduce는 Map의 입출력 및 Reduce의 입출력을 매번
HDFS에 쓰고, 읽는다 - 느리다
• MapReduce코드는 작성하기 불편하다 - 좀더 좋은 인터페이스가
있으면 좋겠다
Spark
• 핵심 개념: RDD (Resilient Distributed Dataset)
• 인터페이스: Scala
MapReduce에서의 Workflow
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
Spark에서의 Workflow
iter. 1 iter. 2 . . .
Input
Input
query 1
query 2
query 3
. . .
one-time

processing
RDD
• Resilient Distributed Dataset - 탄력적으로 분산된
데이터셋
• 클러스터에 분산된 메모리를 활용하여 계산되는 List
• 데이터를 어떻게 구해낼지를 표현하는 Transformation
을 기술한 Lineage(계보)를 interactive하게 만들어
낸 후, Action을 통해 lazy하게 값을 구해냄
• 클러스터 중 일부의 고장 등으로 작업이 중간에 실패하
더라도, Lineage를 통해 데이터를 복구
성능Iterationtime(s)
0
62.5
125
187.5
250
Number of machines
25 50 100
36
15
61.9636
80.1012
116.3153
76
111
184
Hadoop
HadoopBinMem
Spark
Iterationtime(s)
0
75
150
225
300
Number of machines
25 50 100
33
61
143
87
121
197
106
157
274
Hadoop
HadoopBinMem
Spark
Logistic Regression K-Means
Interface - Scala
• 매우 간결한 표현이 가능한 언어
• REPL(aka Shell) 제공, interactive하게 데이터를 다루는것이 가
능
• Functional Programming이 가능하므로 MapReduce와 같은
functional한 개념을 표현하기에 적합함
public class WordCount {
public static class Map extends MapReduceBase implements Mapper<LongWritable, Text, Text, IntWritable> {
private final static IntWritable one = new IntWritable(1);
private Text word = new Text();
public void map(LongWritable key, Text value, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException {
String line = value.toString();
StringTokenizer tokenizer = new StringTokenizer(line);
while (tokenizer.hasMoreTokens()) {
word.set(tokenizer.nextToken());
output.collect(word, one);
}
}
}
public static class Reduce extends MapReduceBase implements Reducer<Text, IntWritable, Text, IntWritable> {
public void reduce(Text key, Iterator<IntWritable> values, OutputCollector<Text, IntWritable> output, Reporter reporter) throws
IOException {
int sum = 0;
while (values.hasNext()) {
sum += values.next().get();
}
output.collect(key, new IntWritable(sum));
}
}
public static void main(String[] args) throws Exception {
JobConf conf = new JobConf(WordCount.class);
conf.setJobName("wordcount");
conf.setOutputKeyClass(Text.class);
conf.setOutputValueClass(IntWritable.class);
conf.setMapperClass(Map.class);
conf.setCombinerClass(Reduce.class);
conf.setReducerClass(Reduce.class);
conf.setInputFormat(TextInputFormat.class);
conf.setOutputFormat(TextOutputFormat.class);
FileInputFormat.setInputPaths(conf, new Path(args[0]));
FileOutputFormat.setOutputPath(conf, new Path(args[1]));
JobClient.runJob(conf);
}
}
val file = spark.textFile("hdfs://...")
val counts = file.flatMap(line => line.split(" "))
.map(word => (word, 1))
.reduceByKey(_ + _)
counts.saveAsTextFile("hdfs://...")
Word count in Spark(Scala)
확장 프로젝트들
• Spark SQL
• Spark Streaming
• MLLib
• GraphX
• SparkR
• Zeppelin
• 등등등…
장점들
• 시간과 비용을 아껴준다
• 수십대의 Hadoop Cluster를 10대 이하의 Cluster로 대체할 수 있다
• 수십분 기다려야 하던 작업이 1분만에 완료된다
• 작업 능률 향상
• MR 작업 코드 만들고, 패키징하고, submit하고 하던 복잡한 과정이,
shell에서 코드 한줄 치는것으로 대체된다
• 처음 접하는 사람도 배우기 쉽다
• 다양한 제품을 조합해야 했던 작업이 Spark으로 다 가능하다
감사합니다

Mais conteúdo relacionado

Mais procurados

Spark 소개 1부
Spark 소개 1부Spark 소개 1부
Spark 소개 1부Jinho Yoo
 
Spark Day 2017@Seoul(Spark Bootcamp)
Spark Day 2017@Seoul(Spark Bootcamp)Spark Day 2017@Seoul(Spark Bootcamp)
Spark Day 2017@Seoul(Spark Bootcamp)Sang-bae Lim
 
스사모 테크톡 - Apache Flink 둘러보기
스사모 테크톡 - Apache Flink 둘러보기스사모 테크톡 - Apache Flink 둘러보기
스사모 테크톡 - Apache Flink 둘러보기SangWoo Kim
 
Cloudera session seoul - Spark bootcamp
Cloudera session seoul - Spark bootcampCloudera session seoul - Spark bootcamp
Cloudera session seoul - Spark bootcampSang-bae Lim
 
Spark + S3 + R3를 이용한 데이터 분석 시스템 만들기
Spark + S3 + R3를 이용한 데이터 분석 시스템 만들기Spark + S3 + R3를 이용한 데이터 분석 시스템 만들기
Spark + S3 + R3를 이용한 데이터 분석 시스템 만들기AWSKRUG - AWS한국사용자모임
 
Apache spark 소개 및 실습
Apache spark 소개 및 실습Apache spark 소개 및 실습
Apache spark 소개 및 실습동현 강
 
Data pipeline and data lake
Data pipeline and data lakeData pipeline and data lake
Data pipeline and data lakeDaeMyung Kang
 
[NDC 2018] Spark, Flintrock, Airflow 로 구현하는 탄력적이고 유연한 데이터 분산처리 자동화 인프라 구축
[NDC 2018] Spark, Flintrock, Airflow 로 구현하는 탄력적이고 유연한 데이터 분산처리 자동화 인프라 구축[NDC 2018] Spark, Flintrock, Airflow 로 구현하는 탄력적이고 유연한 데이터 분산처리 자동화 인프라 구축
[NDC 2018] Spark, Flintrock, Airflow 로 구현하는 탄력적이고 유연한 데이터 분산처리 자동화 인프라 구축Juhong Park
 
[D2 COMMUNITY] Spark User Group - 스파크를 통한 딥러닝 이론과 실제
[D2 COMMUNITY] Spark User Group - 스파크를 통한 딥러닝 이론과 실제[D2 COMMUNITY] Spark User Group - 스파크를 통한 딥러닝 이론과 실제
[D2 COMMUNITY] Spark User Group - 스파크를 통한 딥러닝 이론과 실제NAVER D2
 
Spark machine learning & deep learning
Spark machine learning & deep learningSpark machine learning & deep learning
Spark machine learning & deep learninghoondong kim
 
하둡 좋은약이지만 만병통치약은 아니다
하둡 좋은약이지만 만병통치약은 아니다하둡 좋은약이지만 만병통치약은 아니다
하둡 좋은약이지만 만병통치약은 아니다민철 정민철
 
2.apache spark 실습
2.apache spark 실습2.apache spark 실습
2.apache spark 실습동현 강
 
빅데이터 분석을 위한 스파크 2 프로그래밍 : 대용량 데이터 처리부터 머신러닝까지
빅데이터 분석을 위한 스파크 2 프로그래밍 : 대용량 데이터 처리부터 머신러닝까지빅데이터 분석을 위한 스파크 2 프로그래밍 : 대용량 데이터 처리부터 머신러닝까지
빅데이터 분석을 위한 스파크 2 프로그래밍 : 대용량 데이터 처리부터 머신러닝까지위키북스
 
Spark와 Hadoop, 완벽한 조합 (한국어)
Spark와 Hadoop, 완벽한 조합 (한국어)Spark와 Hadoop, 완벽한 조합 (한국어)
Spark와 Hadoop, 완벽한 조합 (한국어)Teddy Choi
 
Spark Day 2017 Machine Learning & Deep Learning With Spark
Spark Day 2017 Machine Learning & Deep Learning With SparkSpark Day 2017 Machine Learning & Deep Learning With Spark
Spark Day 2017 Machine Learning & Deep Learning With SparkSangHoon Lee
 
Spark & Zeppelin을 활용한 머신러닝 실전 적용기
Spark & Zeppelin을 활용한 머신러닝 실전 적용기Spark & Zeppelin을 활용한 머신러닝 실전 적용기
Spark & Zeppelin을 활용한 머신러닝 실전 적용기Taejun Kim
 
Hadoop cluster os_tuning_v1.0_20170106_mobile
Hadoop cluster os_tuning_v1.0_20170106_mobileHadoop cluster os_tuning_v1.0_20170106_mobile
Hadoop cluster os_tuning_v1.0_20170106_mobile상연 최
 
Chapter3 - learning spark
Chapter3 - learning sparkChapter3 - learning spark
Chapter3 - learning sparkMungyu Choi
 

Mais procurados (20)

Spark 소개 1부
Spark 소개 1부Spark 소개 1부
Spark 소개 1부
 
Spark Day 2017@Seoul(Spark Bootcamp)
Spark Day 2017@Seoul(Spark Bootcamp)Spark Day 2017@Seoul(Spark Bootcamp)
Spark Day 2017@Seoul(Spark Bootcamp)
 
스사모 테크톡 - Apache Flink 둘러보기
스사모 테크톡 - Apache Flink 둘러보기스사모 테크톡 - Apache Flink 둘러보기
스사모 테크톡 - Apache Flink 둘러보기
 
Cloudera session seoul - Spark bootcamp
Cloudera session seoul - Spark bootcampCloudera session seoul - Spark bootcamp
Cloudera session seoul - Spark bootcamp
 
Spark sql
Spark sqlSpark sql
Spark sql
 
Spark + S3 + R3를 이용한 데이터 분석 시스템 만들기
Spark + S3 + R3를 이용한 데이터 분석 시스템 만들기Spark + S3 + R3를 이용한 데이터 분석 시스템 만들기
Spark + S3 + R3를 이용한 데이터 분석 시스템 만들기
 
Apache spark 소개 및 실습
Apache spark 소개 및 실습Apache spark 소개 및 실습
Apache spark 소개 및 실습
 
Data pipeline and data lake
Data pipeline and data lakeData pipeline and data lake
Data pipeline and data lake
 
[NDC 2018] Spark, Flintrock, Airflow 로 구현하는 탄력적이고 유연한 데이터 분산처리 자동화 인프라 구축
[NDC 2018] Spark, Flintrock, Airflow 로 구현하는 탄력적이고 유연한 데이터 분산처리 자동화 인프라 구축[NDC 2018] Spark, Flintrock, Airflow 로 구현하는 탄력적이고 유연한 데이터 분산처리 자동화 인프라 구축
[NDC 2018] Spark, Flintrock, Airflow 로 구현하는 탄력적이고 유연한 데이터 분산처리 자동화 인프라 구축
 
[D2 COMMUNITY] Spark User Group - 스파크를 통한 딥러닝 이론과 실제
[D2 COMMUNITY] Spark User Group - 스파크를 통한 딥러닝 이론과 실제[D2 COMMUNITY] Spark User Group - 스파크를 통한 딥러닝 이론과 실제
[D2 COMMUNITY] Spark User Group - 스파크를 통한 딥러닝 이론과 실제
 
Spark machine learning & deep learning
Spark machine learning & deep learningSpark machine learning & deep learning
Spark machine learning & deep learning
 
하둡 좋은약이지만 만병통치약은 아니다
하둡 좋은약이지만 만병통치약은 아니다하둡 좋은약이지만 만병통치약은 아니다
하둡 좋은약이지만 만병통치약은 아니다
 
2.apache spark 실습
2.apache spark 실습2.apache spark 실습
2.apache spark 실습
 
빅데이터 분석을 위한 스파크 2 프로그래밍 : 대용량 데이터 처리부터 머신러닝까지
빅데이터 분석을 위한 스파크 2 프로그래밍 : 대용량 데이터 처리부터 머신러닝까지빅데이터 분석을 위한 스파크 2 프로그래밍 : 대용량 데이터 처리부터 머신러닝까지
빅데이터 분석을 위한 스파크 2 프로그래밍 : 대용량 데이터 처리부터 머신러닝까지
 
Spark와 Hadoop, 완벽한 조합 (한국어)
Spark와 Hadoop, 완벽한 조합 (한국어)Spark와 Hadoop, 완벽한 조합 (한국어)
Spark와 Hadoop, 완벽한 조합 (한국어)
 
Spark Day 2017 Machine Learning & Deep Learning With Spark
Spark Day 2017 Machine Learning & Deep Learning With SparkSpark Day 2017 Machine Learning & Deep Learning With Spark
Spark Day 2017 Machine Learning & Deep Learning With Spark
 
Spark & Zeppelin을 활용한 머신러닝 실전 적용기
Spark & Zeppelin을 활용한 머신러닝 실전 적용기Spark & Zeppelin을 활용한 머신러닝 실전 적용기
Spark & Zeppelin을 활용한 머신러닝 실전 적용기
 
Hadoop cluster os_tuning_v1.0_20170106_mobile
Hadoop cluster os_tuning_v1.0_20170106_mobileHadoop cluster os_tuning_v1.0_20170106_mobile
Hadoop cluster os_tuning_v1.0_20170106_mobile
 
Cluster - spark
Cluster - sparkCluster - spark
Cluster - spark
 
Chapter3 - learning spark
Chapter3 - learning sparkChapter3 - learning spark
Chapter3 - learning spark
 

Destaque

Zeppelin(제플린) 서울시립대학교 데이터 마이닝연구실 활용사례
Zeppelin(제플린) 서울시립대학교 데이터 마이닝연구실 활용사례Zeppelin(제플린) 서울시립대학교 데이터 마이닝연구실 활용사례
Zeppelin(제플린) 서울시립대학교 데이터 마이닝연구실 활용사례Taejun Kim
 
Apache Spark 입문에서 머신러닝까지
Apache Spark 입문에서 머신러닝까지Apache Spark 입문에서 머신러닝까지
Apache Spark 입문에서 머신러닝까지Donam Kim
 
하둡 HDFS 훑어보기
하둡 HDFS 훑어보기하둡 HDFS 훑어보기
하둡 HDFS 훑어보기beom kyun choi
 
지금 핫한 Real-time In-memory Stream Processing 이야기
지금 핫한 Real-time In-memory Stream Processing 이야기지금 핫한 Real-time In-memory Stream Processing 이야기
지금 핫한 Real-time In-memory Stream Processing 이야기Ted Won
 
빅데이터 기술 현황과 시장 전망(2014)
빅데이터 기술 현황과 시장 전망(2014)빅데이터 기술 현황과 시장 전망(2014)
빅데이터 기술 현황과 시장 전망(2014)Channy Yun
 
Apache storm vs. Spark Streaming
Apache storm vs. Spark StreamingApache storm vs. Spark Streaming
Apache storm vs. Spark StreamingP. Taylor Goetz
 

Destaque (7)

Zeppelin(제플린) 서울시립대학교 데이터 마이닝연구실 활용사례
Zeppelin(제플린) 서울시립대학교 데이터 마이닝연구실 활용사례Zeppelin(제플린) 서울시립대학교 데이터 마이닝연구실 활용사례
Zeppelin(제플린) 서울시립대학교 데이터 마이닝연구실 활용사례
 
Apache Spark 입문에서 머신러닝까지
Apache Spark 입문에서 머신러닝까지Apache Spark 입문에서 머신러닝까지
Apache Spark 입문에서 머신러닝까지
 
하둡 HDFS 훑어보기
하둡 HDFS 훑어보기하둡 HDFS 훑어보기
하둡 HDFS 훑어보기
 
지금 핫한 Real-time In-memory Stream Processing 이야기
지금 핫한 Real-time In-memory Stream Processing 이야기지금 핫한 Real-time In-memory Stream Processing 이야기
지금 핫한 Real-time In-memory Stream Processing 이야기
 
빅데이터 기술 현황과 시장 전망(2014)
빅데이터 기술 현황과 시장 전망(2014)빅데이터 기술 현황과 시장 전망(2014)
빅데이터 기술 현황과 시장 전망(2014)
 
MapReduce in Simple Terms
MapReduce in Simple TermsMapReduce in Simple Terms
MapReduce in Simple Terms
 
Apache storm vs. Spark Streaming
Apache storm vs. Spark StreamingApache storm vs. Spark Streaming
Apache storm vs. Spark Streaming
 

Semelhante a Spark은 왜 이렇게 유명해지고 있을까?

Hadoop 제주대
Hadoop 제주대Hadoop 제주대
Hadoop 제주대DaeHeon Oh
 
빅데이터, big data
빅데이터, big data빅데이터, big data
빅데이터, big dataH K Yoon
 
Tajo and SQL-on-Hadoop in Tech Planet 2013
Tajo and SQL-on-Hadoop in Tech Planet 2013Tajo and SQL-on-Hadoop in Tech Planet 2013
Tajo and SQL-on-Hadoop in Tech Planet 2013Gruter
 
SQL-on-Hadoop with Apache Tajo, and application case of SK Telecom
SQL-on-Hadoop with Apache Tajo,  and application case of SK TelecomSQL-on-Hadoop with Apache Tajo,  and application case of SK Telecom
SQL-on-Hadoop with Apache Tajo, and application case of SK TelecomGruter
 
[246] foursquare데이터라이프사이클 설현준
[246] foursquare데이터라이프사이클 설현준[246] foursquare데이터라이프사이클 설현준
[246] foursquare데이터라이프사이클 설현준NAVER D2
 
OLAP for Big Data (Druid vs Apache Kylin vs Apache Lens)
OLAP for Big Data (Druid vs Apache Kylin vs Apache Lens)OLAP for Big Data (Druid vs Apache Kylin vs Apache Lens)
OLAP for Big Data (Druid vs Apache Kylin vs Apache Lens)SANG WON PARK
 
Expanding Your Data Warehouse with Tajo
Expanding Your Data Warehouse with TajoExpanding Your Data Warehouse with Tajo
Expanding Your Data Warehouse with TajoGruter
 
Expanding Your Data Warehouse with Tajo
Expanding Your Data Warehouse with TajoExpanding Your Data Warehouse with Tajo
Expanding Your Data Warehouse with TajoMatthew (정재화)
 
Distributed Programming Framework, hadoop
Distributed Programming Framework, hadoopDistributed Programming Framework, hadoop
Distributed Programming Framework, hadoopLGU+
 
Web Analytics at Scale with Elasticsearch @ naver.com - Part 1
Web Analytics at Scale with Elasticsearch @ naver.com - Part 1Web Analytics at Scale with Elasticsearch @ naver.com - Part 1
Web Analytics at Scale with Elasticsearch @ naver.com - Part 1Jungsu Heo
 
Hadoop Introduction (1.0)
Hadoop Introduction (1.0)Hadoop Introduction (1.0)
Hadoop Introduction (1.0)Keeyong Han
 
Python & Spark
Python & SparkPython & Spark
Python & Sparkitproman35
 
Apache Htrace overview (20160520)
Apache Htrace overview (20160520)Apache Htrace overview (20160520)
Apache Htrace overview (20160520)Steve Min
 
GRUTER가 들려주는 Big Data Platform 구축 전략과 적용 사례: Tajo와 SQL-on-Hadoop
GRUTER가 들려주는 Big Data Platform 구축 전략과 적용 사례: Tajo와 SQL-on-HadoopGRUTER가 들려주는 Big Data Platform 구축 전략과 적용 사례: Tajo와 SQL-on-Hadoop
GRUTER가 들려주는 Big Data Platform 구축 전략과 적용 사례: Tajo와 SQL-on-HadoopGruter
 
Introduction to Apache Tajo
Introduction to Apache TajoIntroduction to Apache Tajo
Introduction to Apache TajoGruter
 
Dragon flow and tricircle
Dragon flow and tricircleDragon flow and tricircle
Dragon flow and tricircleYongyoon Shin
 
KCSE 2015 Tutorial 빅데이터 분석 기술의 소프트웨어 공학 분야 활용 (...
KCSE 2015 Tutorial 빅데이터 분석 기술의  소프트웨어 공학 분야 활용 (...KCSE 2015 Tutorial 빅데이터 분석 기술의  소프트웨어 공학 분야 활용 (...
KCSE 2015 Tutorial 빅데이터 분석 기술의 소프트웨어 공학 분야 활용 (...Chanjin Park
 
Visual C++10을 활용한 병렬 프로그래밍
Visual C++10을 활용한 병렬 프로그래밍Visual C++10을 활용한 병렬 프로그래밍
Visual C++10을 활용한 병렬 프로그래밍흥배 최
 

Semelhante a Spark은 왜 이렇게 유명해지고 있을까? (20)

Hadoop 제주대
Hadoop 제주대Hadoop 제주대
Hadoop 제주대
 
빅데이터, big data
빅데이터, big data빅데이터, big data
빅데이터, big data
 
Tajo and SQL-on-Hadoop in Tech Planet 2013
Tajo and SQL-on-Hadoop in Tech Planet 2013Tajo and SQL-on-Hadoop in Tech Planet 2013
Tajo and SQL-on-Hadoop in Tech Planet 2013
 
SQL-on-Hadoop with Apache Tajo, and application case of SK Telecom
SQL-on-Hadoop with Apache Tajo,  and application case of SK TelecomSQL-on-Hadoop with Apache Tajo,  and application case of SK Telecom
SQL-on-Hadoop with Apache Tajo, and application case of SK Telecom
 
[246] foursquare데이터라이프사이클 설현준
[246] foursquare데이터라이프사이클 설현준[246] foursquare데이터라이프사이클 설현준
[246] foursquare데이터라이프사이클 설현준
 
OLAP for Big Data (Druid vs Apache Kylin vs Apache Lens)
OLAP for Big Data (Druid vs Apache Kylin vs Apache Lens)OLAP for Big Data (Druid vs Apache Kylin vs Apache Lens)
OLAP for Big Data (Druid vs Apache Kylin vs Apache Lens)
 
Expanding Your Data Warehouse with Tajo
Expanding Your Data Warehouse with TajoExpanding Your Data Warehouse with Tajo
Expanding Your Data Warehouse with Tajo
 
Expanding Your Data Warehouse with Tajo
Expanding Your Data Warehouse with TajoExpanding Your Data Warehouse with Tajo
Expanding Your Data Warehouse with Tajo
 
Distributed Programming Framework, hadoop
Distributed Programming Framework, hadoopDistributed Programming Framework, hadoop
Distributed Programming Framework, hadoop
 
Web Analytics at Scale with Elasticsearch @ naver.com - Part 1
Web Analytics at Scale with Elasticsearch @ naver.com - Part 1Web Analytics at Scale with Elasticsearch @ naver.com - Part 1
Web Analytics at Scale with Elasticsearch @ naver.com - Part 1
 
Hadoop Introduction (1.0)
Hadoop Introduction (1.0)Hadoop Introduction (1.0)
Hadoop Introduction (1.0)
 
NoSQL
NoSQLNoSQL
NoSQL
 
Python & Spark
Python & SparkPython & Spark
Python & Spark
 
Apache Htrace overview (20160520)
Apache Htrace overview (20160520)Apache Htrace overview (20160520)
Apache Htrace overview (20160520)
 
GRUTER가 들려주는 Big Data Platform 구축 전략과 적용 사례: Tajo와 SQL-on-Hadoop
GRUTER가 들려주는 Big Data Platform 구축 전략과 적용 사례: Tajo와 SQL-on-HadoopGRUTER가 들려주는 Big Data Platform 구축 전략과 적용 사례: Tajo와 SQL-on-Hadoop
GRUTER가 들려주는 Big Data Platform 구축 전략과 적용 사례: Tajo와 SQL-on-Hadoop
 
Introduction to Apache Tajo
Introduction to Apache TajoIntroduction to Apache Tajo
Introduction to Apache Tajo
 
Learning spark ch1-2
Learning spark ch1-2Learning spark ch1-2
Learning spark ch1-2
 
Dragon flow and tricircle
Dragon flow and tricircleDragon flow and tricircle
Dragon flow and tricircle
 
KCSE 2015 Tutorial 빅데이터 분석 기술의 소프트웨어 공학 분야 활용 (...
KCSE 2015 Tutorial 빅데이터 분석 기술의  소프트웨어 공학 분야 활용 (...KCSE 2015 Tutorial 빅데이터 분석 기술의  소프트웨어 공학 분야 활용 (...
KCSE 2015 Tutorial 빅데이터 분석 기술의 소프트웨어 공학 분야 활용 (...
 
Visual C++10을 활용한 병렬 프로그래밍
Visual C++10을 활용한 병렬 프로그래밍Visual C++10을 활용한 병렬 프로그래밍
Visual C++10을 활용한 병렬 프로그래밍
 

Spark은 왜 이렇게 유명해지고 있을까?

  • 1. Spark은 왜 이렇게 유명해지고 있을까? 2015-04-23 KSLUG 세미나 김상우, VCNC(비트윈) kevin@between.us
  • 3. 빅데이터분석의 시초 • GFS(Google File System) 논문 (2003) • 여러 컴퓨터를 연결하여 저장용량과 I/O성능을 scale • 이를 구현한 오픈소스 프로젝트인 Hadoop HDFS • MapReduce논문 (2004) • Map과 Reduce연산을 조합하여 클러스터에서 실행, 큰 데이터를 처리 • 이를 구현한 오픈소스 프로젝트인 Hadoop MapReduce
  • 4. public class WordCount { public static class Map extends MapReduceBase implements Mapper<LongWritable, Text, Text, IntWritable> { private final static IntWritable one = new IntWritable(1); private Text word = new Text(); public void map(LongWritable key, Text value, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException { String line = value.toString(); StringTokenizer tokenizer = new StringTokenizer(line); while (tokenizer.hasMoreTokens()) { word.set(tokenizer.nextToken()); output.collect(word, one); } } } public static class Reduce extends MapReduceBase implements Reducer<Text, IntWritable, Text, IntWritable> { public void reduce(Text key, Iterator<IntWritable> values, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException { int sum = 0; while (values.hasNext()) { sum += values.next().get(); } output.collect(key, new IntWritable(sum)); } } public static void main(String[] args) throws Exception { JobConf conf = new JobConf(WordCount.class); conf.setJobName("wordcount"); conf.setOutputKeyClass(Text.class); conf.setOutputValueClass(IntWritable.class); conf.setMapperClass(Map.class); conf.setCombinerClass(Reduce.class); conf.setReducerClass(Reduce.class); conf.setInputFormat(TextInputFormat.class); conf.setOutputFormat(TextOutputFormat.class); FileInputFormat.setInputPaths(conf, new Path(args[0])); FileOutputFormat.setOutputPath(conf, new Path(args[1])); JobClient.runJob(conf); } } Word count in MapReduce (Java)
  • 5. 빅데이터 분석의 시초 (2) • Hive • MapReduce 코드를 짜는건 괴롭다 • 쿼리로 MapReduce의 거의 모든 기능을 표현할 수 있다! • HDFS등에 있는 파일을 읽어들여 쿼리로 분석 수행 • HiveQL 을 작성하면 MapReduce 코드로 변환되어 실행
  • 6. 그렇게 10년이 지나고, 지금까지도 MapReduce와 Hive는 많이 사용되고 있는 빅데이터 기술입니다 MR, Hive에 도전하는 기술들 Impala, Pheonix, Pig, Tez 등등등등… 엄청 많다
  • 7. MapReduce / Hive 장단점 • 장점 • 빅데이터 시대를 열어준 선구적인 기술 • 거대한 데이터를 안정적으로 처리 • 많은 사람들이 사용 중 • 단점 • 오래된 기술이다보니, • 발전이 느리다 • 불편한점이 많다
  • 8. MapReduce의 문제점 • MapReduce는 Map의 입출력 및 Reduce의 입출력을 매번 HDFS에 쓰고, 읽는다 - 느리다 • MapReduce코드는 작성하기 불편하다 - 좀더 좋은 인터페이스가 있으면 좋겠다
  • 9. Spark • 핵심 개념: RDD (Resilient Distributed Dataset) • 인터페이스: Scala
  • 10. MapReduce에서의 Workflow 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
  • 11. Spark에서의 Workflow iter. 1 iter. 2 . . . Input Input query 1 query 2 query 3 . . . one-time
 processing
  • 12. RDD • Resilient Distributed Dataset - 탄력적으로 분산된 데이터셋 • 클러스터에 분산된 메모리를 활용하여 계산되는 List • 데이터를 어떻게 구해낼지를 표현하는 Transformation 을 기술한 Lineage(계보)를 interactive하게 만들어 낸 후, Action을 통해 lazy하게 값을 구해냄 • 클러스터 중 일부의 고장 등으로 작업이 중간에 실패하 더라도, Lineage를 통해 데이터를 복구
  • 13. 성능Iterationtime(s) 0 62.5 125 187.5 250 Number of machines 25 50 100 36 15 61.9636 80.1012 116.3153 76 111 184 Hadoop HadoopBinMem Spark Iterationtime(s) 0 75 150 225 300 Number of machines 25 50 100 33 61 143 87 121 197 106 157 274 Hadoop HadoopBinMem Spark Logistic Regression K-Means
  • 14. Interface - Scala • 매우 간결한 표현이 가능한 언어 • REPL(aka Shell) 제공, interactive하게 데이터를 다루는것이 가 능 • Functional Programming이 가능하므로 MapReduce와 같은 functional한 개념을 표현하기에 적합함
  • 15. public class WordCount { public static class Map extends MapReduceBase implements Mapper<LongWritable, Text, Text, IntWritable> { private final static IntWritable one = new IntWritable(1); private Text word = new Text(); public void map(LongWritable key, Text value, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException { String line = value.toString(); StringTokenizer tokenizer = new StringTokenizer(line); while (tokenizer.hasMoreTokens()) { word.set(tokenizer.nextToken()); output.collect(word, one); } } } public static class Reduce extends MapReduceBase implements Reducer<Text, IntWritable, Text, IntWritable> { public void reduce(Text key, Iterator<IntWritable> values, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException { int sum = 0; while (values.hasNext()) { sum += values.next().get(); } output.collect(key, new IntWritable(sum)); } } public static void main(String[] args) throws Exception { JobConf conf = new JobConf(WordCount.class); conf.setJobName("wordcount"); conf.setOutputKeyClass(Text.class); conf.setOutputValueClass(IntWritable.class); conf.setMapperClass(Map.class); conf.setCombinerClass(Reduce.class); conf.setReducerClass(Reduce.class); conf.setInputFormat(TextInputFormat.class); conf.setOutputFormat(TextOutputFormat.class); FileInputFormat.setInputPaths(conf, new Path(args[0])); FileOutputFormat.setOutputPath(conf, new Path(args[1])); JobClient.runJob(conf); } } val file = spark.textFile("hdfs://...") val counts = file.flatMap(line => line.split(" ")) .map(word => (word, 1)) .reduceByKey(_ + _) counts.saveAsTextFile("hdfs://...") Word count in Spark(Scala)
  • 16. 확장 프로젝트들 • Spark SQL • Spark Streaming • MLLib • GraphX • SparkR • Zeppelin • 등등등…
  • 17. 장점들 • 시간과 비용을 아껴준다 • 수십대의 Hadoop Cluster를 10대 이하의 Cluster로 대체할 수 있다 • 수십분 기다려야 하던 작업이 1분만에 완료된다 • 작업 능률 향상 • MR 작업 코드 만들고, 패키징하고, submit하고 하던 복잡한 과정이, shell에서 코드 한줄 치는것으로 대체된다 • 처음 접하는 사람도 배우기 쉽다 • 다양한 제품을 조합해야 했던 작업이 Spark으로 다 가능하다