NetApp AI Control Plane for Kubernetes and Kubeflow
NetApp AI Data Control Plane for Kubernetes and Kubeflow
NetApp Trident and Python REST API for Kubernetes and Kubeflow
spark 1.6을 기준으로 spark sql에 대해서 개략적으로 설명한 자료입니다. 발표 자료가 친절하지 않으나 한글로 된 자료가 없길래 혹시나 도움 되시는 분들이 있을까 하여 공유합니다.
발표자료 보다는 마지막 페이지의 참고자료들을 읽어보시기를 권장 드립니다.
출처만 남겨주시면 자유롭게 가져가셔서 사용하셔도 무방합니다.
NetApp AI Control Plane for Kubernetes and Kubeflow
NetApp AI Data Control Plane for Kubernetes and Kubeflow
NetApp Trident and Python REST API for Kubernetes and Kubeflow
spark 1.6을 기준으로 spark sql에 대해서 개략적으로 설명한 자료입니다. 발표 자료가 친절하지 않으나 한글로 된 자료가 없길래 혹시나 도움 되시는 분들이 있을까 하여 공유합니다.
발표자료 보다는 마지막 페이지의 참고자료들을 읽어보시기를 권장 드립니다.
출처만 남겨주시면 자유롭게 가져가셔서 사용하셔도 무방합니다.
Backend.AI (https://backend.ai)는 클라우드 및 온-프레미스 환경에서 여러 사용자가 안전하고 효율적으로 컴퓨팅 자원을 공유할 수 있는 머신러닝에 특화된 인프라 관리 프레임워크입니다. 현재 널리 사용되고 있는 오픈소스 기술인 OpenStack, Kubernetes 등과 비교하여 어떤 특징과 차이점이 있는지 소개하고, 프레임워크의 구조와 기반 기술 및 응용 사례를 데모와 함께 소개합니다.
Auto Scalable 한 Deep Learning Production 을 위한 AI Serving Infra 구성 및 AI DevOps...hoondong kim
[Tensorflow-KR Offline 세미나 발표자료]
Auto Scalable 한 Deep Learning Production 을 위한 AI Serving Infra 구성 및 AI DevOps Cycle 구성 방법론. (Azure Docker PaaS 위에서 1만 TPS Tensorflow Inference Serving 방법론 공유)
오픈 소스 Actor Framework 인 Akka.NET 을 통해 온라인 게임 서버를 어떻게 구현할 수 있는지를 설명합니다. Actor Model 에 대한 기본 이해부터 Scale-out 가능한 게임 서버 구축까지 전반적인 내용에 대해 알 수 있습니다. 설명을 위해 클라이언트는 Unity3D 를 사용할 예정입니다.
Machine Learning Model Serving with Backend.AIJeongkyu Shin
머신러닝 모델을 서비스 단에서 서빙하는 것은 손이 많이 갑니다.
서비스 과정을 편리하게 하기 위하여 TensorFlow serving 등 서빙 과정을 돕는 다양한 도구들이 공개되고 개발되고 있습니다만, 여전히 서빙 과정은 귀찮고 불편합니다. 이 세션에서는 Backend.AI 와 TensorFlow serving을 이용하여 간단하게 TensorFlow 모델을 서빙하는 법에 대해 다루어 봅니다.
Backend.AI 서빙 모드를 소개하고, 여러 TF serving 모델 등을 Backend.AI 로 서비스하는 과정을 통해 실제로 사용하는 법을 알아봅니다.
Serving the machine learning model at the service level is a lot of work. A variety of tools are being developed and released to facilitate the process of serving. TensorFlow serving is the greatest one for serving now, but the docker image baking-based serving process is not easy, not flexible and controllable enough. In this session, I will discuss how to simplify the serving process of TensorFlow models by using Backend.AI and TensorFlow serving.
I will introduce the Backend.AI serving mode (on the trunk but will be official since 1.6). After that, I will demonstrate how to use the Backend.AI serving mode that conveniently provides various TensorFlow models with TensorFlow serving on the fly.
Backend.AI (https://backend.ai)는 클라우드 및 온-프레미스 환경에서 여러 사용자가 안전하고 효율적으로 컴퓨팅 자원을 공유할 수 있는 머신러닝에 특화된 인프라 관리 프레임워크입니다. 현재 널리 사용되고 있는 오픈소스 기술인 OpenStack, Kubernetes 등과 비교하여 어떤 특징과 차이점이 있는지 소개하고, 프레임워크의 구조와 기반 기술 및 응용 사례를 데모와 함께 소개합니다.
Auto Scalable 한 Deep Learning Production 을 위한 AI Serving Infra 구성 및 AI DevOps...hoondong kim
[Tensorflow-KR Offline 세미나 발표자료]
Auto Scalable 한 Deep Learning Production 을 위한 AI Serving Infra 구성 및 AI DevOps Cycle 구성 방법론. (Azure Docker PaaS 위에서 1만 TPS Tensorflow Inference Serving 방법론 공유)
오픈 소스 Actor Framework 인 Akka.NET 을 통해 온라인 게임 서버를 어떻게 구현할 수 있는지를 설명합니다. Actor Model 에 대한 기본 이해부터 Scale-out 가능한 게임 서버 구축까지 전반적인 내용에 대해 알 수 있습니다. 설명을 위해 클라이언트는 Unity3D 를 사용할 예정입니다.
Machine Learning Model Serving with Backend.AIJeongkyu Shin
머신러닝 모델을 서비스 단에서 서빙하는 것은 손이 많이 갑니다.
서비스 과정을 편리하게 하기 위하여 TensorFlow serving 등 서빙 과정을 돕는 다양한 도구들이 공개되고 개발되고 있습니다만, 여전히 서빙 과정은 귀찮고 불편합니다. 이 세션에서는 Backend.AI 와 TensorFlow serving을 이용하여 간단하게 TensorFlow 모델을 서빙하는 법에 대해 다루어 봅니다.
Backend.AI 서빙 모드를 소개하고, 여러 TF serving 모델 등을 Backend.AI 로 서비스하는 과정을 통해 실제로 사용하는 법을 알아봅니다.
Serving the machine learning model at the service level is a lot of work. A variety of tools are being developed and released to facilitate the process of serving. TensorFlow serving is the greatest one for serving now, but the docker image baking-based serving process is not easy, not flexible and controllable enough. In this session, I will discuss how to simplify the serving process of TensorFlow models by using Backend.AI and TensorFlow serving.
I will introduce the Backend.AI serving mode (on the trunk but will be official since 1.6). After that, I will demonstrate how to use the Backend.AI serving mode that conveniently provides various TensorFlow models with TensorFlow serving on the fly.
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
추가
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>
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