SlideShare a Scribd company logo
부제 : Glue spark, Athena spark 대체서비스/python thrift db서버 만들어보
기
정창언 Zigbang
Spark on Kubernetes
Database Server
ch1. Spark on Kubernetes
Query Service
● spark on kubernetes 의 장점 - 요청 간 resource 분리
● Batch 작업은 spark operator를 사용
● Query data set을 활용하고 싶음
● 일반적인 조회는 presto 에서 처리가능하지만
a. query 별로 간섭이 없음
b. resource 를 지정 or dynamicAllocation 사용가능
● Jupyter notebook에서 spark 사용
a. notebook server as driver
- 만들기는 쉬우나 notebook server 에 spark 실행시 driver역할을 해야하는 부하 발생
b. Notebook과 Driver를 분리하고 싶다
spark on kubernetes query service
Pyspark을 이용한 방법
local에 해당하는 Jupyter Notebook 서버에서
JVM위 Spark Driver와 Python간 Socket 채
널을 통한 데이터 송수신
- Spark Context를 python에서 직접 이용
하기 때문에 SQL 레벨에서 테스팅에
적합
- 다만 python process에서 Dataframe
및 RDD에 접근 시, socket으로 데이터
를 가져오므로 느림
☑ python code로 정의한 UDF의 경우 python process에서만 처리될 수 있으므로, number
of rows * 데이터전송 처리 부하가 걸려 큰 병목으로 작용 될 수 있음(최대한 지양)
● spark context에서 jvm 설정
a. https://spark.apache.org/docs/3.1.1/api/python/reference/api/pyspark.
SparkContext.html
b. class pyspark.SparkContext(master=None, appName=None, sparkHome=None, pyFiles=None,
environment=None, batchSize=0, serializer=PickleSerializer(), conf=None, gateway=None, jsc=None,
profiler_cls=<class 'pyspark.profiler.BasicProfiler'>)
c. gateway: py4j.java_gateway.JavaGateway, optional
i. Use an existing gateway and JVM, otherwise a new JVM will be instantiated. This is only used internally.
remote spark 구성
remote spark 구성
● spark server에서 spark driver 를 위한 statefulset 실행
○ 관련 library :
● spark image 생성시 javagateway 연결을 위한 daemon실행
○ 관련 library : https://github.com/cce199/PysparkGateway.git
○ spark docker build시 entrypoint.sh에 driver 실행 부분에
pyspark-gateway start
추가
ipynb
import
KubeflowSparkDriver
import
PysparkGateway
SparkContext(
gateway=
PysparkGateway())
spark
server
Driver
Executors
spark-shell
Spark
Context
Spark
Worker
custom
pyspark
gateway
:25000
javaGateway
remote
sparkContext
Driver와 Notebook의 분리
Notebook 서버에서 pyspark 통해 마치 local socket 통신 하듯
Driver와 연동
Custom pyspark gateway가 remote driver 노드에서 Spark
Context를 생성하고 해당 정보를 ssh tunnel통해 전달
ch2. JDBC Hive/Spark
server
spark database server 개발 이유?
● 현상 : 사용자가 팀에서 서비스하는 Presto를 안씀
○ 왜? presto 는 worker수가 지정되어있어(autoscale 지정할수 있기는 한데 오래걸림. 물론 spark
server도 pod띄우는데 오래 걸리기는 함)
○ 왜? tableau에서 조회하는 데이터가 큰 query를 실행시키면 presto실패
○ 결과 : 그래서, Tableau에서 무거운 쿼리는 Athena를 사용
● 해결방안
○ 요청에 따라 resource가 Load에 맞춰 요청되고, 요청간 Resource가 분리된 Query Service 가
DB형태(Athena connector가 있는) 로 제공되면 Athena를 안쓰고 팀에서 Heavy 한 쿼리를 서비
스하는 플랫폼 제공가능
● 해결방안을 찾는 과정
○ Spark on K8s가 resource가 서로 독립된 형태로 실행되고, resource도 요청에 따라 지정할수
있음
○ Spark Server는 서로 독립적인 실행이 아니라서 제외
○ Apache Kyuubi project 가 비슷한 컨셉인데 spark image를 서버에 설치해야해서, 생각한 개념
이랑 달라, drop
● spark on kubernetes query service는 ch1에서 개발
● db 형태의 서비스 개발
○ java 로 개발은 어려움
○ python개발이 선호
○ JDBC가 범용적이기는 하나, 이름부터가 java 로 시작하는데 python으로 만들기는 어려워 보이
기도 하고 java로 만드려고 해도 protocol 에 대하 reference 부족
○ 결론 : thrift protocol이 multi 언어를 위해 나온 protocol인데 db 형태의 reference(Hive)가 있어서
python을 이용한 Hive/Spark thrift Server 를 가져다 쓰기로
spark database server 개발 이유?
Apache thrift?
- The Apache Thrift software framework, for scalable cross-language services development, combines a software
stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java,
Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, OCaml and Delphi and other
languages.
- Writing a .thrift file
After the Thrift compiler is installed you will need to create a thrift file. This file is an interface definition made up of thrift types and Services. The
services you define in this file are implemented by the server and are called by any clients. The Thrift compiler is used to generate your Thrift File into
source code which is used by the different client libraries and the server you write. To generate the source from a thrift file run
thrift --gen <language> <Thrift filename>
https://thrift.apache.org/docs/concepts.html
+-------------------------------------------+
| Server | -> 구현
| (single-threaded, event-driven etc) |
+-------------------------------------------+
| Processor | -> Hive에서 thrift 제공.
ex) JDBC spec
| (compiler generated) |
+-------------------------------------------+
| Protocol | -> thrift 내에서 구현
| (JSON, compact etc) |
+-------------------------------------------+
| Transport | -> thrift 내에서 구현
| (raw TCP, HTTP etc) |
+-------------------------------------------+
Apache thrift?
- Hive github
- thrift 에서 JDBC 통신/함수에 대한 정의. spark 과 동일하게 사용가능
- https://github.com/cce199/hive.git
- service-rpc/src/gen/thrift/gen-py/TCLIService/TCLIService.py
- thrift 도 hive thrift에 적용하려면 수정필요
- 실제 hiveserver2 와 packet 전송format이 약간 다름
- https://github.com/cce199/thrift.git
- ForkServer
- default 로 설정된 multi thread 방식에서는 multi spark context 가 불가능하기 때문에 ForkServer로
multi process 방식으로 서비스
- 접속
- query tool - DBeaber Hadoop / Apache Spark)
- python library - PyHive
JDBC Hive server using thrift
spark database server
● spark on k8s 를 database server형태로 제공 시 장점/차이점
a. athena spark, glue spark 대체 가능
i. 비용/성능은 비교해보지 않음
ii. 비용/성능을 떠나서 대안은 될수 있음
b. batch에서 활용되는 spark operator 대체 가능
● Database를 만들었을때 할수 있는것들
a. presto on request
b. ML model serving
i. tableau 등 BI tool에서 db 형태로 ML데이터 제공
ii. ex) from model where parameter1 = ? and parameter2 = ?
spark database server
spark driver/executor 실행 방안
1. connection에서
a. 설정마다 resource 정하면 resource 종류별로 별도의 connection name 을 사용해야함. ex)
dbeaver같은 db tool에서 connection설정에 resource정보를 넣는다면 resource별로 다른
connection이름이 필요
2. query 마다
a. query마다 설정을 추가해야하기도 해야하고 spark resource 가 뜨는데 걸리는 시간이 있는데
기존에 생성된 resource를 안쓰는건 비효율적일듯? 필요한 경우도 있겠지만. tableau 같은경우
대부분 쿼리 1개니까 별 차이는 없음
3. 첫번째 쿼리
a. 첫번째 쿼리 = resource(서버) 요청과 같은 개념으로 생각
b. dynamic allocation사용하면 driver 설정만 해주면 됨
spark db server 실행 demo
- dbeaver
- dbeaver에서 thrift hive/spark server connection으로 테스트함
- query example)
- 처음실행시에 spark option 설정 기능추가
/* { "spark_driver_cores":"5", "spark_driver_memory":"40G"
, "memoryOverheadFactor" : "0.1"
, "spark_executor_instances": "5" }
*/
select base_date, count(*) from common.tbl where base_date = '2023-08-20'
group by 1 order by 1
spark db server 실행 demo
driver start
executor start
● multiple spark db server
● 대량 데이터 조회 ex) over 1M rows
spark database server - 기능개선

More Related Content

Similar to spark database Service

Cloudera session seoul - Spark bootcamp
Cloudera session seoul - Spark bootcampCloudera session seoul - Spark bootcamp
Cloudera session seoul - Spark bootcamp
Sang-bae Lim
 
[236] 카카오의데이터파이프라인 윤도영
[236] 카카오의데이터파이프라인 윤도영[236] 카카오의데이터파이프라인 윤도영
[236] 카카오의데이터파이프라인 윤도영
NAVER D2
 
Backend.AI: 오픈소스 머신러닝 인프라 프레임워크
Backend.AI: 오픈소스 머신러닝 인프라 프레임워크Backend.AI: 오픈소스 머신러닝 인프라 프레임워크
Backend.AI: 오픈소스 머신러닝 인프라 프레임워크
Jeongkyu Shin
 
Theano 와 Caffe 실습
Theano 와 Caffe 실습 Theano 와 Caffe 실습
Theano 와 Caffe 실습
정주 김
 
docker on GCE ( JIRA & Confluence ) - GDG Korea Cloud
docker on GCE ( JIRA & Confluence ) - GDG Korea Clouddocker on GCE ( JIRA & Confluence ) - GDG Korea Cloud
docker on GCE ( JIRA & Confluence ) - GDG Korea Cloud
Jude Kim
 
[KR] Building modern data pipeline with Snowflake + DBT + Airflow.pdf
[KR] Building modern data pipeline with Snowflake + DBT + Airflow.pdf[KR] Building modern data pipeline with Snowflake + DBT + Airflow.pdf
[KR] Building modern data pipeline with Snowflake + DBT + Airflow.pdf
Chris Hoyean Song
 
2015 oce garuda
2015 oce garuda2015 oce garuda
2015 oce garuda
uEngine Solutions
 
Auto Scalable 한 Deep Learning Production 을 위한 AI Serving Infra 구성 및 AI DevOps...
Auto Scalable 한 Deep Learning Production 을 위한 AI Serving Infra 구성 및 AI DevOps...Auto Scalable 한 Deep Learning Production 을 위한 AI Serving Infra 구성 및 AI DevOps...
Auto Scalable 한 Deep Learning Production 을 위한 AI Serving Infra 구성 및 AI DevOps...
hoondong kim
 
Akka.NET 으로 만드는 온라인 게임 서버 (NDC2016)
Akka.NET 으로 만드는 온라인 게임 서버 (NDC2016)Akka.NET 으로 만드는 온라인 게임 서버 (NDC2016)
Akka.NET 으로 만드는 온라인 게임 서버 (NDC2016)
Esun Kim
 
Data platform data pipeline(Airflow, Kubernetes)
Data platform data pipeline(Airflow, Kubernetes)Data platform data pipeline(Airflow, Kubernetes)
Data platform data pipeline(Airflow, Kubernetes)
창언 정
 
AWS의 하둡 관련 서비스 - EMR/S3
AWS의 하둡 관련 서비스 - EMR/S3AWS의 하둡 관련 서비스 - EMR/S3
AWS의 하둡 관련 서비스 - EMR/S3
Keeyong Han
 
Apache kafka 확장과 응용
Apache kafka 확장과 응용Apache kafka 확장과 응용
Apache kafka 확장과 응용
JANGWONSEO4
 
Rhea_MMO_SNG_Convergence_Server_Architecture
Rhea_MMO_SNG_Convergence_Server_ArchitectureRhea_MMO_SNG_Convergence_Server_Architecture
Rhea_MMO_SNG_Convergence_Server_Architecture
Rhea Strike
 
Apache Spark
Apache SparkApache Spark
Apache Spark
ssuser09ca0c1
 
Machine Learning Model Serving with Backend.AI
Machine Learning Model Serving with Backend.AIMachine Learning Model Serving with Backend.AI
Machine Learning Model Serving with Backend.AI
Jeongkyu Shin
 
Introduction to Apache Tajo
Introduction to Apache TajoIntroduction to Apache Tajo
Introduction to Apache Tajo
Gruter
 
[부스트캠퍼세미나]권혁우_REST는 바이바이_ GraphQL과 함께하는 칼퇴시대
[부스트캠퍼세미나]권혁우_REST는 바이바이_ GraphQL과 함께하는 칼퇴시대[부스트캠퍼세미나]권혁우_REST는 바이바이_ GraphQL과 함께하는 칼퇴시대
[부스트캠퍼세미나]권혁우_REST는 바이바이_ GraphQL과 함께하는 칼퇴시대
CONNECT FOUNDATION
 
KAFKA 3.1.0.pdf
KAFKA 3.1.0.pdfKAFKA 3.1.0.pdf
KAFKA 3.1.0.pdf
wonyong hwang
 
[225]빅데이터를 위한 분산 딥러닝 플랫폼 만들기
[225]빅데이터를 위한 분산 딥러닝 플랫폼 만들기[225]빅데이터를 위한 분산 딥러닝 플랫폼 만들기
[225]빅데이터를 위한 분산 딥러닝 플랫폼 만들기
NAVER D2
 
DPDK (Data Plane Development Kit)
DPDK (Data Plane Development Kit) DPDK (Data Plane Development Kit)
DPDK (Data Plane Development Kit) ymtech
 

Similar to spark database Service (20)

Cloudera session seoul - Spark bootcamp
Cloudera session seoul - Spark bootcampCloudera session seoul - Spark bootcamp
Cloudera session seoul - Spark bootcamp
 
[236] 카카오의데이터파이프라인 윤도영
[236] 카카오의데이터파이프라인 윤도영[236] 카카오의데이터파이프라인 윤도영
[236] 카카오의데이터파이프라인 윤도영
 
Backend.AI: 오픈소스 머신러닝 인프라 프레임워크
Backend.AI: 오픈소스 머신러닝 인프라 프레임워크Backend.AI: 오픈소스 머신러닝 인프라 프레임워크
Backend.AI: 오픈소스 머신러닝 인프라 프레임워크
 
Theano 와 Caffe 실습
Theano 와 Caffe 실습 Theano 와 Caffe 실습
Theano 와 Caffe 실습
 
docker on GCE ( JIRA & Confluence ) - GDG Korea Cloud
docker on GCE ( JIRA & Confluence ) - GDG Korea Clouddocker on GCE ( JIRA & Confluence ) - GDG Korea Cloud
docker on GCE ( JIRA & Confluence ) - GDG Korea Cloud
 
[KR] Building modern data pipeline with Snowflake + DBT + Airflow.pdf
[KR] Building modern data pipeline with Snowflake + DBT + Airflow.pdf[KR] Building modern data pipeline with Snowflake + DBT + Airflow.pdf
[KR] Building modern data pipeline with Snowflake + DBT + Airflow.pdf
 
2015 oce garuda
2015 oce garuda2015 oce garuda
2015 oce garuda
 
Auto Scalable 한 Deep Learning Production 을 위한 AI Serving Infra 구성 및 AI DevOps...
Auto Scalable 한 Deep Learning Production 을 위한 AI Serving Infra 구성 및 AI DevOps...Auto Scalable 한 Deep Learning Production 을 위한 AI Serving Infra 구성 및 AI DevOps...
Auto Scalable 한 Deep Learning Production 을 위한 AI Serving Infra 구성 및 AI DevOps...
 
Akka.NET 으로 만드는 온라인 게임 서버 (NDC2016)
Akka.NET 으로 만드는 온라인 게임 서버 (NDC2016)Akka.NET 으로 만드는 온라인 게임 서버 (NDC2016)
Akka.NET 으로 만드는 온라인 게임 서버 (NDC2016)
 
Data platform data pipeline(Airflow, Kubernetes)
Data platform data pipeline(Airflow, Kubernetes)Data platform data pipeline(Airflow, Kubernetes)
Data platform data pipeline(Airflow, Kubernetes)
 
AWS의 하둡 관련 서비스 - EMR/S3
AWS의 하둡 관련 서비스 - EMR/S3AWS의 하둡 관련 서비스 - EMR/S3
AWS의 하둡 관련 서비스 - EMR/S3
 
Apache kafka 확장과 응용
Apache kafka 확장과 응용Apache kafka 확장과 응용
Apache kafka 확장과 응용
 
Rhea_MMO_SNG_Convergence_Server_Architecture
Rhea_MMO_SNG_Convergence_Server_ArchitectureRhea_MMO_SNG_Convergence_Server_Architecture
Rhea_MMO_SNG_Convergence_Server_Architecture
 
Apache Spark
Apache SparkApache Spark
Apache Spark
 
Machine Learning Model Serving with Backend.AI
Machine Learning Model Serving with Backend.AIMachine Learning Model Serving with Backend.AI
Machine Learning Model Serving with Backend.AI
 
Introduction to Apache Tajo
Introduction to Apache TajoIntroduction to Apache Tajo
Introduction to Apache Tajo
 
[부스트캠퍼세미나]권혁우_REST는 바이바이_ GraphQL과 함께하는 칼퇴시대
[부스트캠퍼세미나]권혁우_REST는 바이바이_ GraphQL과 함께하는 칼퇴시대[부스트캠퍼세미나]권혁우_REST는 바이바이_ GraphQL과 함께하는 칼퇴시대
[부스트캠퍼세미나]권혁우_REST는 바이바이_ GraphQL과 함께하는 칼퇴시대
 
KAFKA 3.1.0.pdf
KAFKA 3.1.0.pdfKAFKA 3.1.0.pdf
KAFKA 3.1.0.pdf
 
[225]빅데이터를 위한 분산 딥러닝 플랫폼 만들기
[225]빅데이터를 위한 분산 딥러닝 플랫폼 만들기[225]빅데이터를 위한 분산 딥러닝 플랫폼 만들기
[225]빅데이터를 위한 분산 딥러닝 플랫폼 만들기
 
DPDK (Data Plane Development Kit)
DPDK (Data Plane Development Kit) DPDK (Data Plane Development Kit)
DPDK (Data Plane Development Kit)
 

spark database Service

  • 1. 부제 : Glue spark, Athena spark 대체서비스/python thrift db서버 만들어보 기 정창언 Zigbang Spark on Kubernetes Database Server
  • 2. ch1. Spark on Kubernetes Query Service
  • 3. ● spark on kubernetes 의 장점 - 요청 간 resource 분리 ● Batch 작업은 spark operator를 사용 ● Query data set을 활용하고 싶음 ● 일반적인 조회는 presto 에서 처리가능하지만 a. query 별로 간섭이 없음 b. resource 를 지정 or dynamicAllocation 사용가능 ● Jupyter notebook에서 spark 사용 a. notebook server as driver - 만들기는 쉬우나 notebook server 에 spark 실행시 driver역할을 해야하는 부하 발생 b. Notebook과 Driver를 분리하고 싶다 spark on kubernetes query service
  • 4. Pyspark을 이용한 방법 local에 해당하는 Jupyter Notebook 서버에서 JVM위 Spark Driver와 Python간 Socket 채 널을 통한 데이터 송수신 - Spark Context를 python에서 직접 이용 하기 때문에 SQL 레벨에서 테스팅에 적합 - 다만 python process에서 Dataframe 및 RDD에 접근 시, socket으로 데이터 를 가져오므로 느림 ☑ python code로 정의한 UDF의 경우 python process에서만 처리될 수 있으므로, number of rows * 데이터전송 처리 부하가 걸려 큰 병목으로 작용 될 수 있음(최대한 지양)
  • 5. ● spark context에서 jvm 설정 a. https://spark.apache.org/docs/3.1.1/api/python/reference/api/pyspark. SparkContext.html b. class pyspark.SparkContext(master=None, appName=None, sparkHome=None, pyFiles=None, environment=None, batchSize=0, serializer=PickleSerializer(), conf=None, gateway=None, jsc=None, profiler_cls=<class 'pyspark.profiler.BasicProfiler'>) c. gateway: py4j.java_gateway.JavaGateway, optional i. Use an existing gateway and JVM, otherwise a new JVM will be instantiated. This is only used internally. remote spark 구성
  • 6. remote spark 구성 ● spark server에서 spark driver 를 위한 statefulset 실행 ○ 관련 library : ● spark image 생성시 javagateway 연결을 위한 daemon실행 ○ 관련 library : https://github.com/cce199/PysparkGateway.git ○ spark docker build시 entrypoint.sh에 driver 실행 부분에 pyspark-gateway start 추가
  • 7. ipynb import KubeflowSparkDriver import PysparkGateway SparkContext( gateway= PysparkGateway()) spark server Driver Executors spark-shell Spark Context Spark Worker custom pyspark gateway :25000 javaGateway remote sparkContext Driver와 Notebook의 분리 Notebook 서버에서 pyspark 통해 마치 local socket 통신 하듯 Driver와 연동 Custom pyspark gateway가 remote driver 노드에서 Spark Context를 생성하고 해당 정보를 ssh tunnel통해 전달
  • 9. spark database server 개발 이유? ● 현상 : 사용자가 팀에서 서비스하는 Presto를 안씀 ○ 왜? presto 는 worker수가 지정되어있어(autoscale 지정할수 있기는 한데 오래걸림. 물론 spark server도 pod띄우는데 오래 걸리기는 함) ○ 왜? tableau에서 조회하는 데이터가 큰 query를 실행시키면 presto실패 ○ 결과 : 그래서, Tableau에서 무거운 쿼리는 Athena를 사용 ● 해결방안 ○ 요청에 따라 resource가 Load에 맞춰 요청되고, 요청간 Resource가 분리된 Query Service 가 DB형태(Athena connector가 있는) 로 제공되면 Athena를 안쓰고 팀에서 Heavy 한 쿼리를 서비 스하는 플랫폼 제공가능 ● 해결방안을 찾는 과정 ○ Spark on K8s가 resource가 서로 독립된 형태로 실행되고, resource도 요청에 따라 지정할수 있음 ○ Spark Server는 서로 독립적인 실행이 아니라서 제외 ○ Apache Kyuubi project 가 비슷한 컨셉인데 spark image를 서버에 설치해야해서, 생각한 개념 이랑 달라, drop
  • 10. ● spark on kubernetes query service는 ch1에서 개발 ● db 형태의 서비스 개발 ○ java 로 개발은 어려움 ○ python개발이 선호 ○ JDBC가 범용적이기는 하나, 이름부터가 java 로 시작하는데 python으로 만들기는 어려워 보이 기도 하고 java로 만드려고 해도 protocol 에 대하 reference 부족 ○ 결론 : thrift protocol이 multi 언어를 위해 나온 protocol인데 db 형태의 reference(Hive)가 있어서 python을 이용한 Hive/Spark thrift Server 를 가져다 쓰기로 spark database server 개발 이유?
  • 11. Apache thrift? - The Apache Thrift software framework, for scalable cross-language services development, combines a software stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, OCaml and Delphi and other languages. - Writing a .thrift file After the Thrift compiler is installed you will need to create a thrift file. This file is an interface definition made up of thrift types and Services. The services you define in this file are implemented by the server and are called by any clients. The Thrift compiler is used to generate your Thrift File into source code which is used by the different client libraries and the server you write. To generate the source from a thrift file run thrift --gen <language> <Thrift filename>
  • 12. https://thrift.apache.org/docs/concepts.html +-------------------------------------------+ | Server | -> 구현 | (single-threaded, event-driven etc) | +-------------------------------------------+ | Processor | -> Hive에서 thrift 제공. ex) JDBC spec | (compiler generated) | +-------------------------------------------+ | Protocol | -> thrift 내에서 구현 | (JSON, compact etc) | +-------------------------------------------+ | Transport | -> thrift 내에서 구현 | (raw TCP, HTTP etc) | +-------------------------------------------+ Apache thrift?
  • 13. - Hive github - thrift 에서 JDBC 통신/함수에 대한 정의. spark 과 동일하게 사용가능 - https://github.com/cce199/hive.git - service-rpc/src/gen/thrift/gen-py/TCLIService/TCLIService.py - thrift 도 hive thrift에 적용하려면 수정필요 - 실제 hiveserver2 와 packet 전송format이 약간 다름 - https://github.com/cce199/thrift.git - ForkServer - default 로 설정된 multi thread 방식에서는 multi spark context 가 불가능하기 때문에 ForkServer로 multi process 방식으로 서비스 - 접속 - query tool - DBeaber Hadoop / Apache Spark) - python library - PyHive JDBC Hive server using thrift
  • 15. ● spark on k8s 를 database server형태로 제공 시 장점/차이점 a. athena spark, glue spark 대체 가능 i. 비용/성능은 비교해보지 않음 ii. 비용/성능을 떠나서 대안은 될수 있음 b. batch에서 활용되는 spark operator 대체 가능 ● Database를 만들었을때 할수 있는것들 a. presto on request b. ML model serving i. tableau 등 BI tool에서 db 형태로 ML데이터 제공 ii. ex) from model where parameter1 = ? and parameter2 = ? spark database server
  • 16. spark driver/executor 실행 방안 1. connection에서 a. 설정마다 resource 정하면 resource 종류별로 별도의 connection name 을 사용해야함. ex) dbeaver같은 db tool에서 connection설정에 resource정보를 넣는다면 resource별로 다른 connection이름이 필요 2. query 마다 a. query마다 설정을 추가해야하기도 해야하고 spark resource 가 뜨는데 걸리는 시간이 있는데 기존에 생성된 resource를 안쓰는건 비효율적일듯? 필요한 경우도 있겠지만. tableau 같은경우 대부분 쿼리 1개니까 별 차이는 없음 3. 첫번째 쿼리 a. 첫번째 쿼리 = resource(서버) 요청과 같은 개념으로 생각 b. dynamic allocation사용하면 driver 설정만 해주면 됨
  • 17. spark db server 실행 demo - dbeaver - dbeaver에서 thrift hive/spark server connection으로 테스트함 - query example) - 처음실행시에 spark option 설정 기능추가 /* { "spark_driver_cores":"5", "spark_driver_memory":"40G" , "memoryOverheadFactor" : "0.1" , "spark_executor_instances": "5" } */ select base_date, count(*) from common.tbl where base_date = '2023-08-20' group by 1 order by 1
  • 18. spark db server 실행 demo driver start executor start
  • 19. ● multiple spark db server ● 대량 데이터 조회 ex) over 1M rows spark database server - 기능개선