-
Notifications
You must be signed in to change notification settings - Fork 0
Home
meye edited this page Jan 9, 2018
·
15 revisions
Learning Spark
- Week 1 - 킥오프회의 (10/12) Q&A
- Week 2 - RDD 프로그래밍 (10/19) Q&A
- Week 3 - 키/값 페어로 작업하기 (10/26)
- fold, reduce 차이점은? ?
- json데이터 불러오기 테스트 ?
- 파티션별 작업하기 (mapPartition) ?
- narrow & wide dependency
Narrow dependency 형태로 코딩해야 한다.
- 책상 한자리에서 다 처리할 수 있는 일은 모아서 하는 것이 좋다는 개념
- 네트워크를 안타고 메모리의 속도로 동작해서 빠르다.
- 파티션이 부서져도 해당 노드에서 바로 복원 가능하다.
- map, filter, union, join with inputs co-partitioned
Wide dependency
- 여러 책상에 있는 자료를 훑어와야 한다는 개념
- 네트워크의 속도로 동작해서 느리다.
- 노드끼리 셔플이 일어나야 한다.
- 파티션이 부서지면 계산 비용이 비싸다.
- groupByKey, join with inputs not co-partitioned
>>>>dependency의 의미
메모리 안에서 처리 될 일들을 먼저 처리하고 네트워킹을 타거나 IO를 타는 일을 나중에 하도록 코딩을 해아한다는 의미.
네트워킹, IO시간을 메모리와 번갈아 가면서 구동하면 속도가 많이 느려지므로 최대한 메모리 내에서 할 수 있는 일을 한 후에 wide denpendency를 활용해야 한다는 의미.
출처: http://ecycle.tistory.com/13 [To Data Engineer]
- spark history Server 디버깅 ?
- spark-submit 최적화 방법 ?
http://blog.naver.com/PostView.nhn?blogId=gyrbsdl18&logNo=220880041737
- Eclipse 사용
- Intelli J IDEA 사용
http://stat-computing.org/dataexpo/2009/
우측에 Download the data 선택후 1987년부터 2008년까지 미국 내 모든 상공 항공편에 대한 항공편 도착과 출발 세부 사항에 대한 정보를 제공합니다. 이 데이터를 압축을 했을 경우 1.6기가 이고 압축을 풀면 12GB입니다. 압축은 bz2로 되어있습니다.
**미국 항공편 운항 통계 데이터의 칼럼 정보**
Name Description
1 Year 1987-2008
2 Month 1-12
3 DayofMonth 1-31
4 DayOfWeek 1 (Monday) - 7 (Sunday)
5 DepTime actual departure time (local, hhmm)
6 CRSDepTime scheduled departure time (local, hhmm)
7 ArrTime actual arrival time (local, hhmm)
8 CRSArrTime scheduled arrival time (local, hhmm)
9 UniqueCarrier unique carrier code
10 FlightNum flight number
11 TailNum plane tail number
12 ActualElapsedTime in minutes
13 CRSElapsedTime in minutes
14 AirTime in minutes
15 ArrDelay arrival delay, in minutes
16 DepDelay departure delay, in minutes
17 Origin origin IATA airport code
18 Dest destination IATA airport code
19 Distance in miles
20 TaxiIn taxi in time, in minutes
21 TaxiOut taxi out time in minutes
22 Cancelled was the flight cancelled?
23 CancellationCode reason for cancellation (A = carrier, B = weather, C = NAS, D = security)
24 Diverted 1 = yes, 0 = no
25 CarrierDelay in minutes
26 WeatherDelay in minutes
27 NASDelay in minutes
28 SecurityDelay in minutes
29 LateAircraftDelay in minutes
압축해제 쉘 스크립트 생성
download.sh
#!/bin/sh
for((i=1987; i <= 2008; i++)); do
wget http://stat-computing.org/dataexpo/2009/$i.csv.bz2
bzip2 -d $i.csv.bz2
sed -d '1d' $i.csv > $i_temp.csv
mv $i_temp.csv $i.csv
done
chmod 755 download.sh
./download.sh
1 Year 1987-2008
2 Month 1-12
15 ArrDelay arrival delay, in minutes
16 DepDelay departure delay, in minutes
- 항공 출발 지연 데이터 분석
- 다운로드받은 년도 별 데이터를 가지고 출발 지연 건수 추출해보기
- 결과값 년,월 건수
ex) 1987,10 175568
1997,11 177218
1988,1 198610
.
.
-
항공 도착 지연 데이터 분석
- 1번 문제 참고해서 만듬.
-
잡 제출시 파라미터를 받아서 1,2 번 문제를 하나의 프로그램으로 만듬
pseudocode
if(항공출발지연이면) {
} else if(도착 지연이면) {
}
해서 파라미터로 결과 값 변경
- 정렬, 조인 등 해보기..