aws 클라우드 기반 서버리스(serverless) 컴퓨팅 …c0%b1%bc...서버리스 아키텍처 -...
TRANSCRIPT
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
서버리스(Serverless) 컴퓨팅 패턴과 사례 AWS 클라우드 기반
윤석찬
@channyun
아마존웹서비스 테크에반젤리스트
본 강연에서 다룰 내용
1. 서버리스 아키텍처의 출현
2. 서버리스 컴퓨팅 패턴
3. 서버리스 애플리케이션 패턴
4. 서버리스 개발 생산성 확대
1. 서버리스 아키텍처의 출현
클라우드 컴퓨팅의 진화
가상 서버 콘테이너 서버리스 데이터센터
Minutes Seconds Milliseconds Weeks
서버리스 아키텍처 - 관리의 대상 제거
Provisioning and utilization Availability and fault tolerance Scaling Operations and management
서버리스 아키텍처 - 주요 이점
서버 관리 없는 컴퓨팅 확장
이벤트 기반 앱 개발
미 실행시 과금 안함
무상태(Stateless) 앱 개발
서버리스 아키텍처 - 서비스 조건
완전 관리형 컴퓨팅 • 프로비져닝 제거 • 제로 관리 • 고가용(Fault Tolerant Stateless)
개발자 생산성 확보 • 문제 중심의 개발 능력 • 민첩한 혁신 • 시장 접근성 강화
지속적 확장 능력 • 자동화 기반 • 용량 증가 및 용량 감소
서버리스 아키텍처 - AWS 서비스 종류
AWS Lambda
Amazon Kinesis
Amazon S3
Amazon API Gateway
Amazon SQS
Amazon DynamoDB
AWS IoT
Amazon EMR
Amazon ElastiCache
Amazon RDS
Amazon Redshift
Amazon Elasticsearch Service
Managed Serverless
Amazon EC2
Manual
Amazon Cognito
Amazon CloudWatch
2. 서버리스 컴퓨팅 패턴
서버리스 컴퓨팅- AWS 빌딩 블록
AWS Lambda Amazon DynamoDB
Amazon SNS
Amazon API Gateway
Amazon SQS Amazon Kinesis
Amazon S3
Orchestration & State Management
API Proxy Messaging and Queues Analytics
Monitoring and Debugging
Compute Storage Database
AWS X-Ray AWS Step Functions
Edge Compute
AWS Greengrass
Lambda@Edge
서버리스 컴퓨팅 - AWS Lambda
COMPUTE SERVICE
EVENT- DRIVEN
서버 관리할 필요 없이 코드 실행
가능
필요할 때만 코드가 실행 및
과금
무료 제공(Free-tier) 매월 1백만회 호출 및 512MB 80만초 실행 무료
Demo- AWS Lambda 이미지 썸네일 만들기
② Amazon S3 파일 업로드 ③ AWS Lambda 코드 실행
① 큰 이미지 업로드 ④ 압축 및 크기 변경
⑤ 저장
AWS Lambda를 호출하는 다양한 방법
AWS CloudFormation
custom resources
Amazon Echo skills
Amazon SWF tasks
Customized notifications with
Amazon SNS
Amazon Cognito triggers
Amazon S3 triggers
Amazon Dynamo DB
triggers
Amazon Kinesis
processors
Microservices with API Gateway
Alexa, do my expense report
….
인공 지능 (챗봇)
• Powering chatbot logic
• Alexa Skills for Amazon Echo
서버리스 컴퓨팅- 최근 사용 사례
웹 애플리케이션
• 정적 웹사이트
• 동적 웹 앱
• Express.js 기반 웹 앱
백엔드
• 애플리케이션 및 서비스
• 모바일
• IoT
</> </>
미디어/로그 처리
• 스트리밍 데이터
• 실시간 데이터
빅데이터 분석
• MapReduce
• Batch
아키텍처 패턴 - 웹 애플리케이션
Amazon Cognito
Amazon API Gateway
AWS Lambda
Amazon DynamoDB
Amazon ElastiCache
Amazon RDS
View Blog Posts (GETs)
Manage/edit blog posts (POSTs)
Web-federated identity & Cognito User Pools AWS
Lambda
Triggers for sign-ups
Amazon SES
Mailers
Amazon CloudFront
Amazon S3 S3 Events On AWS Lambda
Static Contents
Mobile apps
Websites
Partner Services
https://aws.amazon.com/ko/solutions/case-studies/bustle/
아키텍처 패턴 - IoT 백엔드
아키텍처 패턴 - 빅 데이터 배치 처리
AWS Lambda: Splitter
Amazon S3 Object
Amazon DynamoDB: Mapper Results
AWS Lambda: Mappers
….
…. AWS Lambda: Reducer
Amazon S3 Results
https://aws.amazon.com/ko/blogs/big-data/building-scalable-and-responsive-big-data-interfaces-with-aws-lambda/
아키텍처 패턴 - 미디어 및 스트리밍 처리
Laptop Encoders
HLS S3
Playback
VOD Stream mobile client
CloudFront
Streaming
Live stream mobile client CloudFron
t S3 Ingest
480p Transcode
HQ Copy
360p Transcode
Audio-only Transcode
Thumbnail
QOS Analytics
Cascading Lambda Functions
http://www.slideshare.net/AmazonWebServices/arc308-the-serverless-company-using-aws-lambda
서버리스 기반 서비스 혁신 사례
서버리스 기반 서비스 혁신 사례
3. 서버리스 애플리케이션 개발 패턴
Demo - 애플리케이션 비즈니스 로직의 변화
Monolith Microservices Functions
성장하는 서비스에서 “Monolith 앱”의 단점
장기 개발 사이클 (다수개발자 공동 참여)
운영의 어려움 (특정 모듈 장애시)
애플리케이션 확장성 애로
신규 출시에 몇 달이 걸림
신규 기능 추가에 어려움
아키텍처 유지 진화의 어려움
혁신 저해
고객 불만족
민첩성 저해
Netflix embraces a fine-grained Service Oriented Architecture as the underpinning of its Cloud based deployment model. Currently, we run hundreds of such fine grained services that are collectively responsible in handling the customer facing requests via a few "Edge Services" such as the Netflix API Service. A lightweight REST based protocol is the choice for inter process communication amongst these services.
http://techblog.netflix.com/2013/01/announcing-ribbon-tying-netflix-mid.html
= 연간 5천만회 배포 (2014년)
수 천개 팀 (자율적 DevOps팀)
× 마이크로서비스 아키텍처
× 지속적 배포 (CD)
× 다양한 개발 환경
(시간당 5708 회, 또는 0.63 초)
Amazon.com의 사례
Werner Vogels (CTO, Amazon.com, 2015)
AWS 기반 마이크로 서비스 활용 사례
Building a Microservices Gaming Platform for Turbine Mobile Games (2016)
From Monolithic to Microservices Evolving Architecture Patterns in the Cloud (2016)
Developing Mobile Apps and Serverless Microservices for Enterprises using AWS (2016)
Pure Play Video OTT- A Microservices Architecture (2015)
Nike's Journey into Microservices (2014)
A Journey to Microservices (2015)
마이크로서비스 기반 모바일 서비스 마이그레이션 (2016)
마이크로 서비스 아키텍처로 방송 서비스 진화 (2016)
Amazon API Gateway Clients
HTTP REST
Amazon EC2
AWS Lambda
Lambda Blueprints
AWS 기반 마이크로서비스 아키텍처 패턴
Elastic Load Balancing
Amazon ECS
서버리스 마이크로서비스 구현 사례
Elastic Load Balancer AWS Opsworks
www.vingle.net
api1.vingle.net
EC2
. .
. DB / Cache
EC2
EC2
기존 서비스 및 인프라 구조
Web server / Background Worker /
REST API / ORM /
Business logic ….
Feed Search Card Writing Admin Spam ….
API Gateway Lambda
DynamoDB (List of spam keywords)
POST /api/validates Body: {
data: “ABCDEFG” }
테스트 구현- 예) 스팸 필터
서버리스 마이크로서비스 이전- 6개월 뒤…
• Netflix와 같은 Strangler Pattern Architecture
• 모든 요청을 받는 기존 API서버가 있고, 해당 API서버에서 필요로 하는 마이크로서비스를 REST HTTP기반 통신으로 사용
• 모니터링을 위해 Cloudwatch를 사용하여 알림 자동화
• 서비스들 간의 Dependency를 모니터링 툴을 만들어 관리
• 각 서비스를 독립적으로 개발 / 배포 / 모니터링
4. 서버리스 개발 생산성 확대
서버리스 개발 자동화 - DevOps in Serverless
• Lambda 함수 로컬 개발 및 빌드 도구와 자동 배포 도구 필요
• Lambda 함수 로그, 성능 추적 및 오류 탐지
• Lambda 함수를 통한 비즈니스 로직 구성
Write code
Deploy to customer
Build and test
Receive feedback
서버리스 오픈소스 프레임웍
Chalice Framework
Serverless Java Container
AWS Serverless Application Model (SAM)
• AWS CloudFormation 기반
배포 방식
• Lambda 함수를 SAM
• 템플릿으로 배포 가능
• 공개 표준 기반 (Apache 2.0)
https://github.com/awslabs/serverless-application-model
</>
GitHub Amazon S3 AWS CodeCommit
AWS CodeBuild
AWS CodeBuild Third-party tools
AWS CloudFormation
Commit
Build
Test
Deploy to Prod
서버리스 데브옵스 - SAM + AWS Code*
AWS Lambda Functions
AWS CodeStar - 통합 프로젝트 관리 서비스
Trace Requests Record Traces View Service Map Analyze Issues
AWS X-Ray: Lambda 함수 성능 추적
AWS X-Ray: Lambda 함수 성능 추적
AWS Step Functions
시각적 워크플로를 사용해 분산 앱 및 마이크로서비스 구성 요소 조정 및 실행
• 자동으로 각 단계를 트리거 및 추적하고 오류가 발생할 경우 재시도하므로 애플리케이션이 의도대로 정상적으로 실행
• 앱을 단계별로 배열 및 시각화할 수 있는 그래픽 콘솔 제공
• 각 단계의 상태를 기록하여, 잘못된 경우 빠르게 문제를 진단하고 디버깅 가능
상태 변경이 일어나는 경우만 과금
Demo: Amazon AI 및 서버리스 기반 스마트 앱
https://github.com/awslabs/lambda-refarch-imagerecognition
상태 머신 실행
사진 메타 데이터 추출
사진 메타 데이터 저장
이미지 인식 서비스 호출
서버리스 개발자 생태계 - 서드 파티 파트너
Monitoring Deployment Integrations Code Libraries
서버리스 API 서비스 비즈니스 모델 확대
https://aws.amazon.com/ko/blogs/compute/generate-your-own-api-gateway-developer-portal/
https://aws.amazon.com/ko/blogs/compute/monetize-your-apis-in-aws-marketplace-using-api-gateway/
API Gateway Developer Portal Serverless Application Model (SAM) 기반의 오픈 소스 키 발급 및 관리 백엔드
API Monetization in Marketplace AWS Marketplace를 통해 API 서비스 판매 및 수익화 가능
Q&A
Serverless is a fundamental component of modern applications
기술 관련 문의: http://bit.ly/awskr-feedback