SlideShare a Scribd company logo
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
GPU 인스턴스 비용 효율을 위한 스팟 활용기
스타트업이 딥러닝 서비스를 어떻게 운영하는가
손은주 / Mathpresso
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Mathpresso
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Contents
문제검색 서비스 아키텍쳐
Docker 기반 worker 운영 및 모니터링
- Nvidia-Docker AMI
- Count proper number of worker in Instance
- Lambda - Health Checker
GPU spot 안전하고 효율적으로 쓰기
- Spot Instance
- 최적화 배경
- spot to on-demand
- Lambda - Availability checker
- 효과
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
발표자 소개
- 손은주
- 한양대학교 학생
- Mathpresso에서 개발자로 근무했습니다
- 배우지 않으면 좀이 쑤시는 개발자입니다
- 이것 저것 해보기를 좋아합니다
- 2017 Let’s swift, 2018 Pycon 스피커
@EJSohn
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
앱 소개
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
앱 소개
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
문제검색 서비스 구성
Chatting server
Optical character
recognition (OCR)
Architecture
Question search server
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
OCR 구성
Dynamic Rpc-style Image
Processing (DRIP) Server
Google Vision
Server Queue
Keras worker
Preprocess worker
Mathpresso OCR
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
OCR 구성
Dynamic Rpc-style Image
Processing (DRIP) Server
Google Vision
Server Queue
Keras worker
Preprocess worker
Mathpresso OCR
Amazon EC2
Rabbitmq on EC2
Amazon Lambda
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
OCR 구성
Dynamic Rpc-style Image
Processing (DRIP) Server
Google Vision
Server Queue
Keras worker
Preprocess worker
Mathpresso OCR
Amazon EC2
Rabbitmq on EC2
Amazon Lambda
+
Monitoring
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Docker 기반 worker 운영 및 모니터링
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Nvidia-Docker AMI
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Nvidia-Docker AMI
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Nvidia-Docker AMI
Containerizing GPU applications provides
several benefits, among them:
- Ease of deployment
- Isolation of individual devices
- Run across heterogeneous driver/toolkit
environments
- Requires only the NVIDIA driver to be
installed on the host
- Facilitate collaboration: reproducible
builds, reproducible performance,
reproducible results.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Nvidia-Docker AMI
‣ 필요한 딥러닝 패키지들(cuda, tensorrt, opencv...)과 서비스
준비된 프로덕션 코드로 Docker 이미지 생성
‣ Private Dockerhub ( AWS ECR )에 태그를 달아 업로드
‣ Nvidia-docker가 설치된 p3 인스턴스로 해당 Docker 이미지
를 받아 실행시키는 AWS AMI 생성
‣ Auto Scaling - 트래픽에 따라 인스턴스 수 제어
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Nvidia-Docker AMI
‣ 필요한 딥러닝 패키지들(cuda, tensorrt, opencv...)과 서비스
준비된 프로덕션 코드로 Docker 이미지 생성
‣ Private Dockerhub ( AWS ECR )에 태그를 달아 업로드
‣ Nvidia-docker가 설치된 p3 인스턴스로 해당 Docker 이미지
를 받아 실행시키는 AWS AMI 생성
‣ Auto Scaling - 트래픽에 따라 인스턴스 수 제어
CloudWatch? 어떤 기준으로?
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Count proper number of worker in Instance
‣ GPU Utilization / Search log
- 인스턴스 기준 스케일링?
- 인스턴스는 동작하는 상태이지만 내부의 worker는 동작하지 않을 수도 있다. (worker 코
드를 수정한 개발자의 실수, 라이브러리 오류, 시스템 오류 등 가능성 존재)
- 사내 서버도 완전히 믿을 수는 없음
- 최초의 시행착오
- 사내/ AWS 서버에서 동작하는 worker 개별의 상태를 알 수 있는 지표 필요
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Monitoring GPU Utilization with Amazon Cloudwatch
https://aws.amazon.com/ko/blogs/machine-learning/monitoring-gpu-utilization-with-amazon-cloudwatch/
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Count proper number of worker in Instance
‣ GPU Utilization / Search log
- 사내/ AWS 서버에서 동작하는 worker 개별의 상태를 알 수 있는 지표 필요
- GPU Util * EC2 기본 지원 X, 데이터 수집 및 전송하는 agent에 대한 개발이 추가적으로
필요
- Search log * 이미 수집하고 있던 데이터, 추가적인 작업 없이 활용 가능
- Search log로 사내/ AWS 서버의 worker cluster load rates를 계산하는 알고리즘을 개발
( = GPU load rates)
- AWS Lamba에 해당 알고리즘 탑재, 주기적으로 Monitoring & Scaling 수행
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Monitoring - Health Checker
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
GPU spot 안전하고 효율적으로 쓰기
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Spot Instance
시간당 온디맨드 대비 스팟 가격 2018.10.10 2pm
‣ 온디맨드 가격보다 저렴
한 비용으로 사용할 수 있
는 미사용 EC2 인스턴스
‣ 최대 90% 할인된 금액으
로 이용
‣ 시간당 가격에 대한 입찰
방식으로 EC2 가용 용량
이 부족하거나 스팟 가격
이 최고 가격을 초과하면
중단
GPU
Instance
온디맨드 요금 스팟 요금
p2.xlarge $1.465 $0.4395
p2.8xlarge $11.72 $11.72
p2.16xlarge $23.44 $23.44
p3.2xlarge $4.981 $1.4943
p3.8xlarge $19.924 $5.9772
p3.16xlarge $39.848 $39.848
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Spot Instance - 작동 방식
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Spot Instance - 스팟 요청 상태
‣ 은근히 자주 발생하는 상태 코드
‣ capacity-not-available
‣ system-error
‣ Instance-terminated-no-capacity
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Spot Instance - 스팟 요청 상태
‣ 은근히 자주 발생하는 상태 코드
‣ capacity-not-available
‣ system-error
‣ Instance-terminated-no-capacity
‣ 스팟 요청부터 실패할 수 있다
‣ 스팟 인스턴스를 시작하더라도 언제든 중단
될 수 있다
‣ 스팟 가격은 온디맨드 가격과 같게 설정해놔
도, 그대로 서비스에 사용하기에는 위험성이
큼
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS SDK - describe-spot-instance-requests
‣ aws cli command
‣ 각 언어별 aws sdk
에도 포함되어 있
는 기능
‣ 스팟 요청이 어떻
게 처리되고 있는
지 모든 과정 조회
가능
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS SDK - describe-spot-instance-requests
…
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Availability checker
Spot 요청에 실패하거
나 인스턴스의 중단 알
람을 받을 경우,
(spot autoscaling
group desired
count - active
count)
만큼의 on-demand
인스턴스를 시작
스팟이 성공적으로 시
작되었을 경우,
(성공한 스팟 요청)
만큼의 on-demand
인스턴스를 종료
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Availability checker
Amazon Lambda
Spot Autoscaling Group
On-demand Autoscaling Group
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Availability checker
중단 2분 전 상태 코드
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Availability checker
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
효과
‣ GPU 비용 1/10
‣ 사내/ AWS GPU 서버 내의 서비스 방식 통일
‣ 기존의 인스턴스 기반 스케일링을 worker 기반 스케일링으로 전환
‣ 분단위로 필요한 만큼의 스팟을 생성/종료
‣ 스팟 사용에 문제가 있을 경우 온디맨드 인스턴스를 사용 후 전환
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
들어주셔서 감사합니다 :)
Q&A

More Related Content

PDF
데이터 과학자를 위한 신규 인공지능 서비스 - 김대근, 이유동, AWS AI/ML 스페셜리스트 솔루션즈 아키텍트 / 소성운, 카카오스타일 ...
PDF
AWS와 함께하는 클라우드 컴퓨팅 (강철 AWS 매니저) :: AWS 기초 교육 온라인 세미나
PDF
Amazon DynamoDB 키 디자인 패턴
PDF
[AWS Builders] AWS와 함께하는 클라우드 컴퓨팅
PDF
실전! AWS 하이브리드 네트워킹 (AWS Direct Connect 및 VPN 데모 세션) - 강동환, AWS 솔루션즈 아키텍트:: A...
PDF
Amazon Personalize 소개 (+ 실습 구성)::김영진, 솔루션즈 아키텍트, AWS::AWS AIML 스페셜 웨비나
PDF
[2017 AWS Startup Day] AWS 비용 최대 90% 절감하기: 스팟 인스턴스 Deep-Dive
PDF
[AWS Hero 스페셜] Amazon Personalize를 통한 개인화/추천 서비스 개발 노하우 - 소성운(크로키닷컴) :: AWS C...
데이터 과학자를 위한 신규 인공지능 서비스 - 김대근, 이유동, AWS AI/ML 스페셜리스트 솔루션즈 아키텍트 / 소성운, 카카오스타일 ...
AWS와 함께하는 클라우드 컴퓨팅 (강철 AWS 매니저) :: AWS 기초 교육 온라인 세미나
Amazon DynamoDB 키 디자인 패턴
[AWS Builders] AWS와 함께하는 클라우드 컴퓨팅
실전! AWS 하이브리드 네트워킹 (AWS Direct Connect 및 VPN 데모 세션) - 강동환, AWS 솔루션즈 아키텍트:: A...
Amazon Personalize 소개 (+ 실습 구성)::김영진, 솔루션즈 아키텍트, AWS::AWS AIML 스페셜 웨비나
[2017 AWS Startup Day] AWS 비용 최대 90% 절감하기: 스팟 인스턴스 Deep-Dive
[AWS Hero 스페셜] Amazon Personalize를 통한 개인화/추천 서비스 개발 노하우 - 소성운(크로키닷컴) :: AWS C...

What's hot (20)

PDF
아마존의 관리형 게임 플랫폼 활용하기: GameLift (Deep Dive) :: 구승모 솔루션즈 아키텍트 :: Gaming on AWS ...
PDF
데이터 마이그레이션 및 전송을 위한 AWS 스토리지 서비스 활용방안 - 박용선, 메가존 클라우드 매니저
PDF
금융권을 위한 AWS Direct Connect 기반 하이브리드 구성 방법 - AWS Summit Seoul 2017
PDF
AWS Backup을 이용한 데이터베이스의 백업 자동화와 편리한 복구방법
PPTX
AWS로 게임 기반 다지기 - 김병수, 박진성 :: AWS Game Master 온라인 세미나 #3
PDF
효과적인 NoSQL (Elasticahe / DynamoDB) 디자인 및 활용 방안 (최유정 & 최홍식, AWS 솔루션즈 아키텍트) :: ...
PDF
비용 관점에서 AWS 클라우드 아키텍처 디자인하기::류한진::AWS Summit Seoul 2018
PDF
AWS 클라우드 기반 게임 아키텍처 사례 - AWS Summit Seoul 2017
PDF
AWS KMS 에서 제공하는 봉투암호화 방식의 암호화 및 사이닝 기능에 대한 소개와 실습 - 신은수, AWS 솔루션즈 아키텍트 :: AWS...
PPTX
AWS 기반 대규모 트래픽 견디기 - 장준엽 (구로디지털 모임) :: AWS Community Day 2017
PDF
AWS 클라우드 비용 최적화를 위한 TIP - 임성은 AWS 매니저
PDF
Amazon EKS로 간단한 웹 애플리케이션 구축하기 - 김주영 (AWS) :: AWS Community Day Online 2021
PDF
게임사를 위한 Amazon GameLift 세션 - 이정훈, AWS 솔루션즈 아키텍트
PDF
KB국민은행은 시작했다 -  쉽고 빠른 클라우드 거버넌스 적용 전략 - 강병억 AWS 솔루션즈 아키텍트 / 장강홍 클라우드플랫폼단 차장, ...
PDF
클라우드 세상에서 살아남기: 금융편 - 이한주 대표이사/공동창업자, 베스핀 글로벌 / 김민성 팀장, KB국민카드 :: AWS Summit ...
PDF
AWS를 활용해서 글로벌 게임 런칭하기 - 박진성 AWS 솔루션즈 아키텍트 :: AWS Summit Seoul 2021
PDF
다양한 솔루션으로 만들어가는 AWS 네트워크 보안::이경수::AWS Summit Seoul 2018
PDF
롯데이커머스의 마이크로 서비스 아키텍처 진화와 비용 관점의 운영 노하우-나현길, 롯데이커머스 클라우드플랫폼 팀장::AWS 마이그레이션 A ...
PDF
고급 클라우드 아키텍처 방법론- 양승도 솔루션즈 아키텍트:: AWS Cloud Track 2 Advanced
PDF
2020.02.06 우리는 왜 glue를 버렸나?
아마존의 관리형 게임 플랫폼 활용하기: GameLift (Deep Dive) :: 구승모 솔루션즈 아키텍트 :: Gaming on AWS ...
데이터 마이그레이션 및 전송을 위한 AWS 스토리지 서비스 활용방안 - 박용선, 메가존 클라우드 매니저
금융권을 위한 AWS Direct Connect 기반 하이브리드 구성 방법 - AWS Summit Seoul 2017
AWS Backup을 이용한 데이터베이스의 백업 자동화와 편리한 복구방법
AWS로 게임 기반 다지기 - 김병수, 박진성 :: AWS Game Master 온라인 세미나 #3
효과적인 NoSQL (Elasticahe / DynamoDB) 디자인 및 활용 방안 (최유정 & 최홍식, AWS 솔루션즈 아키텍트) :: ...
비용 관점에서 AWS 클라우드 아키텍처 디자인하기::류한진::AWS Summit Seoul 2018
AWS 클라우드 기반 게임 아키텍처 사례 - AWS Summit Seoul 2017
AWS KMS 에서 제공하는 봉투암호화 방식의 암호화 및 사이닝 기능에 대한 소개와 실습 - 신은수, AWS 솔루션즈 아키텍트 :: AWS...
AWS 기반 대규모 트래픽 견디기 - 장준엽 (구로디지털 모임) :: AWS Community Day 2017
AWS 클라우드 비용 최적화를 위한 TIP - 임성은 AWS 매니저
Amazon EKS로 간단한 웹 애플리케이션 구축하기 - 김주영 (AWS) :: AWS Community Day Online 2021
게임사를 위한 Amazon GameLift 세션 - 이정훈, AWS 솔루션즈 아키텍트
KB국민은행은 시작했다 -  쉽고 빠른 클라우드 거버넌스 적용 전략 - 강병억 AWS 솔루션즈 아키텍트 / 장강홍 클라우드플랫폼단 차장, ...
클라우드 세상에서 살아남기: 금융편 - 이한주 대표이사/공동창업자, 베스핀 글로벌 / 김민성 팀장, KB국민카드 :: AWS Summit ...
AWS를 활용해서 글로벌 게임 런칭하기 - 박진성 AWS 솔루션즈 아키텍트 :: AWS Summit Seoul 2021
다양한 솔루션으로 만들어가는 AWS 네트워크 보안::이경수::AWS Summit Seoul 2018
롯데이커머스의 마이크로 서비스 아키텍처 진화와 비용 관점의 운영 노하우-나현길, 롯데이커머스 클라우드플랫폼 팀장::AWS 마이그레이션 A ...
고급 클라우드 아키텍처 방법론- 양승도 솔루션즈 아키텍트:: AWS Cloud Track 2 Advanced
2020.02.06 우리는 왜 glue를 버렸나?
Ad

Similar to 딥러닝 서비스에 쓰이는 GPU 인스턴스 비용 효율을 위한 스팟(Spot) 활용기 - 손은주, 매스프레소 :: AWS DevDay 2018 (20)

PDF
AWS 상에서 비즈니스를 수행하고자 하는 고객들에게 드리는 5가지 꿀팁 :: 정우근 :: AWS Summit Seoul 2018
PDF
AWS를 활용한 다양한 DB 마이그레이션 및 게임 엔진 서버 구축 방법::맹상영 대표, 엔클라우드24::AWS Summit Seoul 2018
PDF
모바일 게임을 만들기 위한 AWS 활용 고군분투기::최용호::AWS Summit Seoul 2018
PDF
Serverless Architecture를 응용한 실시간 DW 플랫폼 구현 :: 서지형 :: AWS Summit Seoul 2018
PDF
Serverless Architecture를 응용한 실시간 DW 플랫폼 구현 :: 서지형 :: AWS Summit Seoul 2018
PDF
AWS 기반 클라우드 아키텍처 모범사례 - 삼성전자 개발자 포털/개발자 워크스페이스 - 정영준 솔루션즈 아키텍트, AWS / 유현성 수석,...
PDF
클라우드 프론트의 재발견::백본을 이용한 초고속 콘텐츠 전송::서호석 이사, 영우디지탈::AWS Summit Seoul 2018
PDF
강의 4 - AWS 아키텍처 설계 (조재구 테크니컬 트레이너, AWS) :: AWSome Day 온라인 컨퍼런스 2018
PDF
Amazon EC2 고급 활용 기법 및 모범 사례::이진욱::AWS Summit Seoul 2018
PDF
개발자를 위한 클라우드 기술 트렌드- 윤석찬, AWS 테크에반젤리스트 :: Hello T 개발자 컨퍼런스
PDF
[Games on AWS 2019] AWS 사용자를 위한 만랩 달성 트랙 | 코드 기반으로 인프라 운영하기 - 박성훈 NEOWIZ 팀장,...
PPTX
[AWS Summit 2018] 모바일 게임을 만들기 위한 AWS 고군분투기
PPTX
D1T4S2_클라우드를 넘어, 보험사의 미래를 그리다_241104_블로그포스팅용....
PDF
AWS Greengrass, Lambda and ML Inference at the Edge site (김민성, AWS 솔루션즈 아키텍트)...
PDF
분석 워크로드 마이그레이션의 모든 것-김기영, AWS Analytics Specialist SA / 김성일, AWS Analytics Sp...
PDF
클라우드를 활용한 디지털 제조(Digital Manufacturing)실현 방법 및 사례 소개 - 윤석찬 (AWS 테크에반젤리스트) :: ...
PDF
[Games on AWS 2019] AWS 사용자를 위한 만랩 달성 트랙 | AWS 최적화 사용을 위해 운영자가 아닌 개발자들이 해야 할 ...
PDF
AWS 인공지능 서비스를 이용한 SAP 비즈니스 프로세스 자동화 (이상규, AWS 솔루션즈 아키텍트) :: AWS DevDay2018
PDF
타 게임사의 경험으로 본 AWS 핵심 모범 사례 한방에 배우기 - 이정훈 솔루션즈 아키텍트, AWS / 김지선 테크니컬 어카운트 매니저, ...
PDF
클라우드 세상에서 살아남기 (2) “진화의시작: 인프라 엔지니어에서 Ops 엔지니어로”::이한주::AWS Summit Seoul 2018
AWS 상에서 비즈니스를 수행하고자 하는 고객들에게 드리는 5가지 꿀팁 :: 정우근 :: AWS Summit Seoul 2018
AWS를 활용한 다양한 DB 마이그레이션 및 게임 엔진 서버 구축 방법::맹상영 대표, 엔클라우드24::AWS Summit Seoul 2018
모바일 게임을 만들기 위한 AWS 활용 고군분투기::최용호::AWS Summit Seoul 2018
Serverless Architecture를 응용한 실시간 DW 플랫폼 구현 :: 서지형 :: AWS Summit Seoul 2018
Serverless Architecture를 응용한 실시간 DW 플랫폼 구현 :: 서지형 :: AWS Summit Seoul 2018
AWS 기반 클라우드 아키텍처 모범사례 - 삼성전자 개발자 포털/개발자 워크스페이스 - 정영준 솔루션즈 아키텍트, AWS / 유현성 수석,...
클라우드 프론트의 재발견::백본을 이용한 초고속 콘텐츠 전송::서호석 이사, 영우디지탈::AWS Summit Seoul 2018
강의 4 - AWS 아키텍처 설계 (조재구 테크니컬 트레이너, AWS) :: AWSome Day 온라인 컨퍼런스 2018
Amazon EC2 고급 활용 기법 및 모범 사례::이진욱::AWS Summit Seoul 2018
개발자를 위한 클라우드 기술 트렌드- 윤석찬, AWS 테크에반젤리스트 :: Hello T 개발자 컨퍼런스
[Games on AWS 2019] AWS 사용자를 위한 만랩 달성 트랙 | 코드 기반으로 인프라 운영하기 - 박성훈 NEOWIZ 팀장,...
[AWS Summit 2018] 모바일 게임을 만들기 위한 AWS 고군분투기
D1T4S2_클라우드를 넘어, 보험사의 미래를 그리다_241104_블로그포스팅용....
AWS Greengrass, Lambda and ML Inference at the Edge site (김민성, AWS 솔루션즈 아키텍트)...
분석 워크로드 마이그레이션의 모든 것-김기영, AWS Analytics Specialist SA / 김성일, AWS Analytics Sp...
클라우드를 활용한 디지털 제조(Digital Manufacturing)실현 방법 및 사례 소개 - 윤석찬 (AWS 테크에반젤리스트) :: ...
[Games on AWS 2019] AWS 사용자를 위한 만랩 달성 트랙 | AWS 최적화 사용을 위해 운영자가 아닌 개발자들이 해야 할 ...
AWS 인공지능 서비스를 이용한 SAP 비즈니스 프로세스 자동화 (이상규, AWS 솔루션즈 아키텍트) :: AWS DevDay2018
타 게임사의 경험으로 본 AWS 핵심 모범 사례 한방에 배우기 - 이정훈 솔루션즈 아키텍트, AWS / 김지선 테크니컬 어카운트 매니저, ...
클라우드 세상에서 살아남기 (2) “진화의시작: 인프라 엔지니어에서 Ops 엔지니어로”::이한주::AWS Summit Seoul 2018
Ad

More from Amazon Web Services Korea (20)

PDF
[D3T1S01] Gen AI를 위한 Amazon Aurora 활용 사례 방법
PDF
[D3T1S06] Neptune Analytics with Vector Similarity Search
PDF
[D3T1S03] Amazon DynamoDB design puzzlers
PDF
[D3T1S04] Aurora PostgreSQL performance monitoring and troubleshooting by use...
PDF
[D3T1S07] AWS S3 - 클라우드 환경에서 데이터베이스 보호하기
PDF
[D3T1S05] Aurora 혼합 구성 아키텍처를 사용하여 예상치 못한 트래픽 급증 대응하기
PDF
[D3T1S02] Aurora Limitless Database Introduction
PDF
[D3T2S01] Amazon Aurora MySQL 메이저 버전 업그레이드 및 Amazon B/G Deployments 실습
PDF
[D3T2S03] Data&AI Roadshow 2024 - Amazon DocumentDB 실습
PDF
AWS Modern Infra with Storage Roadshow 2023 - Day 2
PDF
AWS Modern Infra with Storage Roadshow 2023 - Day 1
PDF
사례로 알아보는 Database Migration Service : 데이터베이스 및 데이터 이관, 통합, 분리, 분석의 도구 - 발표자: ...
PDF
Amazon DocumentDB - Architecture 및 Best Practice (Level 200) - 발표자: 장동훈, Sr. ...
PDF
Amazon Elasticache - Fully managed, Redis & Memcached Compatible Service (Lev...
PDF
Internal Architecture of Amazon Aurora (Level 400) - 발표자: 정달영, APAC RDS Speci...
PDF
[Keynote] 슬기로운 AWS 데이터베이스 선택하기 - 발표자: 강민석, Korea Database SA Manager, WWSO, A...
PDF
Demystify Streaming on AWS - 발표자: 이종혁, Sr Analytics Specialist, WWSO, AWS :::...
PDF
Amazon EMR - Enhancements on Cost/Performance, Serverless - 발표자: 김기영, Sr Anal...
PDF
Amazon OpenSearch - Use Cases, Security/Observability, Serverless and Enhance...
PDF
Enabling Agility with Data Governance - 발표자: 김성연, Analytics Specialist, WWSO,...
[D3T1S01] Gen AI를 위한 Amazon Aurora 활용 사례 방법
[D3T1S06] Neptune Analytics with Vector Similarity Search
[D3T1S03] Amazon DynamoDB design puzzlers
[D3T1S04] Aurora PostgreSQL performance monitoring and troubleshooting by use...
[D3T1S07] AWS S3 - 클라우드 환경에서 데이터베이스 보호하기
[D3T1S05] Aurora 혼합 구성 아키텍처를 사용하여 예상치 못한 트래픽 급증 대응하기
[D3T1S02] Aurora Limitless Database Introduction
[D3T2S01] Amazon Aurora MySQL 메이저 버전 업그레이드 및 Amazon B/G Deployments 실습
[D3T2S03] Data&AI Roadshow 2024 - Amazon DocumentDB 실습
AWS Modern Infra with Storage Roadshow 2023 - Day 2
AWS Modern Infra with Storage Roadshow 2023 - Day 1
사례로 알아보는 Database Migration Service : 데이터베이스 및 데이터 이관, 통합, 분리, 분석의 도구 - 발표자: ...
Amazon DocumentDB - Architecture 및 Best Practice (Level 200) - 발표자: 장동훈, Sr. ...
Amazon Elasticache - Fully managed, Redis & Memcached Compatible Service (Lev...
Internal Architecture of Amazon Aurora (Level 400) - 발표자: 정달영, APAC RDS Speci...
[Keynote] 슬기로운 AWS 데이터베이스 선택하기 - 발표자: 강민석, Korea Database SA Manager, WWSO, A...
Demystify Streaming on AWS - 발표자: 이종혁, Sr Analytics Specialist, WWSO, AWS :::...
Amazon EMR - Enhancements on Cost/Performance, Serverless - 발표자: 김기영, Sr Anal...
Amazon OpenSearch - Use Cases, Security/Observability, Serverless and Enhance...
Enabling Agility with Data Governance - 발표자: 김성연, Analytics Specialist, WWSO,...

딥러닝 서비스에 쓰이는 GPU 인스턴스 비용 효율을 위한 스팟(Spot) 활용기 - 손은주, 매스프레소 :: AWS DevDay 2018

  • 1. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. GPU 인스턴스 비용 효율을 위한 스팟 활용기 스타트업이 딥러닝 서비스를 어떻게 운영하는가 손은주 / Mathpresso
  • 2. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Mathpresso
  • 3. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Contents 문제검색 서비스 아키텍쳐 Docker 기반 worker 운영 및 모니터링 - Nvidia-Docker AMI - Count proper number of worker in Instance - Lambda - Health Checker GPU spot 안전하고 효율적으로 쓰기 - Spot Instance - 최적화 배경 - spot to on-demand - Lambda - Availability checker - 효과
  • 4. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 발표자 소개 - 손은주 - 한양대학교 학생 - Mathpresso에서 개발자로 근무했습니다 - 배우지 않으면 좀이 쑤시는 개발자입니다 - 이것 저것 해보기를 좋아합니다 - 2017 Let’s swift, 2018 Pycon 스피커 @EJSohn
  • 5. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 앱 소개
  • 6. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 앱 소개
  • 7. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 문제검색 서비스 구성 Chatting server Optical character recognition (OCR) Architecture Question search server
  • 8. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. OCR 구성 Dynamic Rpc-style Image Processing (DRIP) Server Google Vision Server Queue Keras worker Preprocess worker Mathpresso OCR
  • 9. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. OCR 구성 Dynamic Rpc-style Image Processing (DRIP) Server Google Vision Server Queue Keras worker Preprocess worker Mathpresso OCR Amazon EC2 Rabbitmq on EC2 Amazon Lambda
  • 10. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. OCR 구성 Dynamic Rpc-style Image Processing (DRIP) Server Google Vision Server Queue Keras worker Preprocess worker Mathpresso OCR Amazon EC2 Rabbitmq on EC2 Amazon Lambda + Monitoring
  • 11. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Docker 기반 worker 운영 및 모니터링
  • 12. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Nvidia-Docker AMI
  • 13. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Nvidia-Docker AMI
  • 14. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Nvidia-Docker AMI Containerizing GPU applications provides several benefits, among them: - Ease of deployment - Isolation of individual devices - Run across heterogeneous driver/toolkit environments - Requires only the NVIDIA driver to be installed on the host - Facilitate collaboration: reproducible builds, reproducible performance, reproducible results.
  • 15. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Nvidia-Docker AMI ‣ 필요한 딥러닝 패키지들(cuda, tensorrt, opencv...)과 서비스 준비된 프로덕션 코드로 Docker 이미지 생성 ‣ Private Dockerhub ( AWS ECR )에 태그를 달아 업로드 ‣ Nvidia-docker가 설치된 p3 인스턴스로 해당 Docker 이미지 를 받아 실행시키는 AWS AMI 생성 ‣ Auto Scaling - 트래픽에 따라 인스턴스 수 제어
  • 16. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Nvidia-Docker AMI ‣ 필요한 딥러닝 패키지들(cuda, tensorrt, opencv...)과 서비스 준비된 프로덕션 코드로 Docker 이미지 생성 ‣ Private Dockerhub ( AWS ECR )에 태그를 달아 업로드 ‣ Nvidia-docker가 설치된 p3 인스턴스로 해당 Docker 이미지 를 받아 실행시키는 AWS AMI 생성 ‣ Auto Scaling - 트래픽에 따라 인스턴스 수 제어 CloudWatch? 어떤 기준으로?
  • 17. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Count proper number of worker in Instance ‣ GPU Utilization / Search log - 인스턴스 기준 스케일링? - 인스턴스는 동작하는 상태이지만 내부의 worker는 동작하지 않을 수도 있다. (worker 코 드를 수정한 개발자의 실수, 라이브러리 오류, 시스템 오류 등 가능성 존재) - 사내 서버도 완전히 믿을 수는 없음 - 최초의 시행착오 - 사내/ AWS 서버에서 동작하는 worker 개별의 상태를 알 수 있는 지표 필요
  • 18. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Monitoring GPU Utilization with Amazon Cloudwatch https://aws.amazon.com/ko/blogs/machine-learning/monitoring-gpu-utilization-with-amazon-cloudwatch/
  • 19. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Count proper number of worker in Instance ‣ GPU Utilization / Search log - 사내/ AWS 서버에서 동작하는 worker 개별의 상태를 알 수 있는 지표 필요 - GPU Util * EC2 기본 지원 X, 데이터 수집 및 전송하는 agent에 대한 개발이 추가적으로 필요 - Search log * 이미 수집하고 있던 데이터, 추가적인 작업 없이 활용 가능 - Search log로 사내/ AWS 서버의 worker cluster load rates를 계산하는 알고리즘을 개발 ( = GPU load rates) - AWS Lamba에 해당 알고리즘 탑재, 주기적으로 Monitoring & Scaling 수행
  • 20. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Monitoring - Health Checker
  • 21. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. GPU spot 안전하고 효율적으로 쓰기
  • 22. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Spot Instance 시간당 온디맨드 대비 스팟 가격 2018.10.10 2pm ‣ 온디맨드 가격보다 저렴 한 비용으로 사용할 수 있 는 미사용 EC2 인스턴스 ‣ 최대 90% 할인된 금액으 로 이용 ‣ 시간당 가격에 대한 입찰 방식으로 EC2 가용 용량 이 부족하거나 스팟 가격 이 최고 가격을 초과하면 중단 GPU Instance 온디맨드 요금 스팟 요금 p2.xlarge $1.465 $0.4395 p2.8xlarge $11.72 $11.72 p2.16xlarge $23.44 $23.44 p3.2xlarge $4.981 $1.4943 p3.8xlarge $19.924 $5.9772 p3.16xlarge $39.848 $39.848
  • 23. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Spot Instance - 작동 방식
  • 24. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Spot Instance - 스팟 요청 상태 ‣ 은근히 자주 발생하는 상태 코드 ‣ capacity-not-available ‣ system-error ‣ Instance-terminated-no-capacity
  • 25. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Spot Instance - 스팟 요청 상태 ‣ 은근히 자주 발생하는 상태 코드 ‣ capacity-not-available ‣ system-error ‣ Instance-terminated-no-capacity ‣ 스팟 요청부터 실패할 수 있다 ‣ 스팟 인스턴스를 시작하더라도 언제든 중단 될 수 있다 ‣ 스팟 가격은 온디맨드 가격과 같게 설정해놔 도, 그대로 서비스에 사용하기에는 위험성이 큼
  • 26. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS SDK - describe-spot-instance-requests ‣ aws cli command ‣ 각 언어별 aws sdk 에도 포함되어 있 는 기능 ‣ 스팟 요청이 어떻 게 처리되고 있는 지 모든 과정 조회 가능
  • 27. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS SDK - describe-spot-instance-requests …
  • 28. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Availability checker Spot 요청에 실패하거 나 인스턴스의 중단 알 람을 받을 경우, (spot autoscaling group desired count - active count) 만큼의 on-demand 인스턴스를 시작 스팟이 성공적으로 시 작되었을 경우, (성공한 스팟 요청) 만큼의 on-demand 인스턴스를 종료
  • 29. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Availability checker Amazon Lambda Spot Autoscaling Group On-demand Autoscaling Group
  • 30. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Availability checker 중단 2분 전 상태 코드
  • 31. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Availability checker
  • 32. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 효과 ‣ GPU 비용 1/10 ‣ 사내/ AWS GPU 서버 내의 서비스 방식 통일 ‣ 기존의 인스턴스 기반 스케일링을 worker 기반 스케일링으로 전환 ‣ 분단위로 필요한 만큼의 스팟을 생성/종료 ‣ 스팟 사용에 문제가 있을 경우 온디맨드 인스턴스를 사용 후 전환
  • 33. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 들어주셔서 감사합니다 :) Q&A