In-memory query execution in Google BigQuery
빅쿼리의 In-memory query 실행
최유석
원글 주소 : https://cloud.google.com/blog/big-data/2016/08/in-memory-query-execution-in-google-bigquery
원글 작성자 : Hossein Ahmadi, BigQuery Technical Lead
개요
구글의 빅데이터 분석
빅쿼리의 성능과 인프라
빅쿼리의 쿼리 실행의 대한 내용을 알아보기에 앞서, 먼저 예제를 통해 빅쿼리의 성능과 인프라에 관련한 부분을 알아보도록 하자.
예제로 보는 빅쿼리의 성능
빅쿼리의 쿼리 실행속도, 즉 성능을 보기 위한 사례로 다음의 예제가 많이 사용된다.
(출처: https://cloud.google.com/blog/big-data/2016/01/anatomy-of-a-bigquery-query )
예제로 보는 빅쿼리의 인프라
빅쿼리의 심플한 사용
빅쿼리 실행엔진(기본 아키텍쳐)
(출처 : https://cloud.google.com/blog/big-data/2016/01/bigquery-under-the-hood )
Dremel
빅쿼리에서 요청이 들어오면 분산 스토리지인 Colossus에서 데이터를 읽고
Colossus
Borg
Jupiter
빅쿼리 셔플(Shuffle)의 변화
빅쿼리 셔플의 차이점
빅쿼리 셔플의 구성요소
셔플에서 Producer, Consumer, Controller는 다음과 같이 구현되어 있다.
Producer (producer_id) { void SendRow(row, consumer_id) : Called to send a row to a given consumer on behalf of this producer. } Consumer (consumer_id) { string ReceiveRow() : Called to receive one row for this consumer. } Controller { StartShuffle() : Called before any producers or consumers start sending or receiving rows. EndShuffle() : Called after all producers and consumers have successfully sent and received all rows. } |
위의 API들은 공유 메모리의 개념을 제공하도록 설계되었기 때문에, 데이타 프로세싱 파이프라인상에서, 데이타를 파티셔닝하는데 범용적으로 사용될 수 있다.
빅쿼리 셔플(shuffle)의 개념
빅쿼리 셔플의 기본 동작은 다음의 그림과 같이 설명될 수 있다.
(출처 : https://cloud.google.com/blog/big-data/2016/08/in-memory-query-execution-in-google-bigquery )
이 색인(index)은 Consumer가 해당 행을 효율적으로 검색하고 읽을 수 있도록 해준다
빅쿼리 셔플의 복합적인 동작
(출처 : https://cloud.google.com/blog/big-data/2016/08/in-memory-query-execution-in-google-bigquery )
빅쿼리의 데이터 분할(partitioning)
데이터의 파티셔닝(partitioning)은 BigQuery의 쿼리의 성능에 상당한 영향을 미친다.
제대로 된 결과를 얻기 위해서는 Consumer와, Provider를 적절한 숫자로 맞추는 것이 중요하다. (빅쿼리가 자동으로 수행)
최적화 되지 않은 데이터의 분할로 쿼리가 매우 느리게 실행되거나, 심지어는 자원의 제약으로 실패할 수 도 있다.
빅쿼리에서 콜로서스를 활용한 이점
디스크의 경우 메모리에 비해서 많이 느리기 때문에, 빅쿼리에서는 디스크 억세스를 최소화하는 방법으로 성능 문제를 최소화한다.
빅쿼리는 multi-tenant service 이다.
결론
참고자료
https://cloud.google.com/blog/big-data/2016/08/in-memory-query-execution-in-google-bigquery
https://cloud.google.com/blog/big-data/2016/01/anatomy-of-a-bigquery-query
https://cloud.google.com/blog/big-data/2016/01/bigquery-under-the-hood
'Google Cloud Platform > Bigquery' 카테고리의 다른 글
빅쿼리 Streaming Insert golang 샘플 (0) | 2017.04.24 |
---|---|
웹로그 데이터를 빅쿼리를 이용하여 리포팅 하기 (0) | 2017.01.09 |
빅쿼리 Query Plan을 이용한 쿼리 실행 분석 (0) | 2016.09.19 |
빅쿼리 스트리밍 데이터 로딩하기 (4) | 2016.08.05 |
빅쿼리 데이터 로딩하기 (2) | 2016.07.25 |