본 세션에서는 Amazon의 관리형 데이터베이스 서비스(RDS) 중 기존 상용데이터베이스의 5배 성능 및 1/10 가격으로도 확장성을 보장하는 Aurora에 대한 소개 및 사용법 그리고 기존의 DB에서의 마이그레이션 방법에 대해 소개해드립니다. 10월 리인벤트를 통해 동경 리전에 Aurora를 사용가능하게 되었습니다.
2. v
Amazon RDS for Aurora
• Amazon Aurora는 MySQL 호환 관계형 데이터베이스 엔진
• Aurora는 상용 데이터베이스의 10분의 1 가격으로 MySQL보다 최
고 5배 뛰어난 성능을 제공
• 3 가용영역에 거쳐 6개의 복제를 저장하여 고가용성 제공
• Amazon S3에 지속적으로 데이터를 백업
• 지역 내 15개 Amazon Aurora Replicas
• 10GB에서 64TB까지 스토리지 자동 증가
• 리전 : Virginia, Oregon, Ireland 및 Tokyo
3. v
Amazon Aurora 개요
• 서비스 중심 아키텍처의 적용
• 로깅 및 스토리지 레이어에, 멀
티-티넌트, 스케일-아웃, 데이터
베이스 최적화된 스토리지 서비
스 적용
• 내부 운영을 위하여 EC2, VPC,
DynamoDB, SWF, Route 53 등
AWS 기존 서비스 활용
• 연속 백업을 위하여 Amazon S3
통합
Logging + Storage
SQL
Transac1ons
Caching
Control Plane Data Plane
Amazon S3
DynamoDB
Amazon SWF
Amazon Route 53
5. v
손쉬운 데이터베이스 관리
• 수 분 내에 데이터베이스 생성
• 자동화된 패치
• 푸시-버튼 용량 확장
• Amazon S3 연속 백업
• 자동 장애 감지 및 페일오버
Amazon RDS
6. v
손쉬운 스토리지 관리
• 읽기 복제에 페일오버 – 데이터 유실 없음
• 사용자 스냅샷 즉각 생성 – 성능 영향 없음
• Amazon S3에 연속, 증분 백업
• 최대 64TB까지 자동 스토리지 용량 확장 – 성능, 가용성 영향 없음
• 자동화된 재스트라이핑, 미러 복구, 핫스팟 관리, 암호화
7. v
손쉬운 보안 향상
• 저장 시 암호화
• AES-256 및 하드웨어 가속
• 디스크 및 S3 내 모든 블록들은 암호화
• AWS KMS 를 통한 키 관리
• 전송 시 암호화 – SSL
• Amazon VPC를 통한 네트워크 격리
• 노드에 직접 접근 없음
• 산업 표준의 보안 및 데이터 보호 인증서 지원
Storage
SQL
Transac1ons
Caching
Amazon S3
Applica1on
9. v
Amazon Aurora의 스토리지
• 기본 고가용성
• 3가용영역에 6-way 복제
• 4 / 6 쓰기, 3 / 6 읽기 쿼럼
• S3 저장소에 연속 백업
• SSD, 스케일-아웃, 멀티-테넌
트 스토리지
• 연속적 스토리지 확장
• 최대 64TB 크기
• 사용한만큼만 지불
• 로그-구조 기반 스토리지
SQL
Transac1ons
AZ 1 AZ 2 AZ 3
Caching
Amazon S3
10. v
일관성 및 낮은 응답속도 쓰기
개선 사항
• 일관성 - tolerance to outliers
• 응답속도 - synchronous vs. asynchronous replication
• 효율성 - significantly more efficient use of network I/O
AZ 1 AZ 2
Primary
Instance
Standby
Instance
Amazon Elas=c Block
Store (EBS)
Amazon S3
EBS
mirror
EBS
EBS
mirror
AZ 1 AZ 3
Primary
Instance
Amazon S3
AZ 2
Replica
Instance
Log records
Binlog
Data
Double-write buffer
FRM files, metadata
Type of writes
MySQL with standby Amazon Aurora
async
4/6 quorum
PiTR
Sequen=al
write
Sequen=al
write Distributed
writes
11. v
자가 치유 및 장애 내구성
• Lose two copies or an AZ failure without read or write availability impact
• Lose three copies without read availability impact
• Automatic detection, replication, and repair
SQL
Transac=on
AZ 1 AZ 2 AZ 3
Caching
SQL
Transac=on
AZ 1 AZ 2 AZ 3
Caching
Read and write availability Read availability
12. 기존 데이터베이스
• Have to replay logs since the last
checkpoint
• Single-threaded in MySQL; requires a
large number of disk accesses
Amazon Aurora
• Underlying storage replays redo
records on demand as part of a disk
read
• Parallel, distributed, asynchronous
Checkpointed Data Redo Log
Crash at T0 requires
a re-applica=on of the
SQL in the redo log since
last checkpoint
T0 T0
Crash at T0 will result in redo
logs being applied to each segment
on demand, in parallel, asynchronously
신속한 크래시 복구
13. v
캐시 유지
• We moved the cache out of the
database process
• Cache remains warm in the
event of a database restart
• Lets you resume fully loaded
operations much faster
• Instant crash recovery +
survivable cache = quick and
easy recovery from DB failures
SQL
Transac1ons
Caching
SQL
Transac1ons
Caching
SQL
Transac1ons
Caching
Caching process is outside the DB process
and remains warm across a database restart
14. v
Amazon Aurora Replica의 읽기 복제
MySQL 읽기 확장
• 복제는 반드시 로그를 재생
• 복제는 마스터에 추가적인 부하
• 복제 지연의 증가
• 페일오버 시 데이터 유실 발생 가능
Page cache
invalida=on
Aurora Master
30% Read
70% Write
Aurora Replica
100% New Reads
Shared Mul1-AZ Storage
MySQL Master
30% Read
70% Write
MySQL Replica
30% New Reads
70% Write
Single threaded
binlog apply
Data Volume Data Volume
15. v
보다 신속하고 예측 가능한 페일오버
Failure Detec=on DNS Propaga=on
Recovery Recovery
App
running
DB
Failure
Failure Detec=on
Recovery
App
running
DB
Failure
?
DNS Propaga=on
16. v
SQL 사용 장애 시뮬레이션 지원
• To cause the failure of a component at the database node:
ALTER SYSTEM CRASH [{INSTANCE | DISPATCHER | NODE}]
• To simulate the failure of disks:
ALTER SYSTEM SIMULATE percent_failure DISK failure_type IN
[DISK index | NODE index] FOR INTERVAL interval
• To simulate the failure of networking:
ALTER SYSTEM SIMULATE percent_failure NETWORK failure_type
[TO {ALL | read_replica | availability_zone}] FOR INTERVAL interval
18. v
• MySQL Sysbench
• R3.8XL - 32 vCPU 및
244 GB RAM
• 4 클라이언트 - 각 1,000
쓰레드
쓰기 성능 (console screenshot)
19. v
• MySQL Sysbench
• R3.8XL - 32 vCPU 및
244 GB RAM
• 1 클라이언트 - 각 1,000
쓰레드
읽기 성능 (console screenshot)
20. v
• 초당 13,800 회 업데이트 발생 시 Aurora Replica는 7.27 밀리 초 지연
• 동일 사양의 MySQL 5.6 은 초당 2,000 회 업데이트 발생 시 ~2초 지연
Read Replica 지연 (console screenshot)
21. v
-
10
20
30
40
50
60
70
10 100 1,000 10,000
Thousands of writes per second
Number of tables
Write performance and table count
Aurora MySQL on I2.8XL
MySQL on I2.8XL with RAM Disk RDS MySQL with 30,000 IOPS (Single AZ)
Tables Amazon Aurora
MySQL
I2.8XL
local SSD
MySQL
I2.8XL
RAM disk
RDS MySQL
30K IOPS
(single AZ)
10 60,000 18,000 22,000 25,000
100 66,000 19,000 24,000 23,000
1,000 64,000 7,000 18,000 8,000
10,000 54,000 4,000 8,000 5,000
Write-only workload
1,000 connections
Query cache (default on for Amazon Aurora, off for MySQL)
Amazon Aurora의 테이블 수에 따른 쓰기 확장성
23. v
캐시를 통한 성능 향상
-
50
100
150
200
250
300
350
400
100/0 50/50 0/100
Thousands of opera1ons per second
Read/write ra1o
Performance with query cache on and off
Aurora without Caching
Aurora with Caching
RDS MySQL;30,000 IOPS (Single AZ) - without caching
RDS MySQL;30,000 IOPS (Single AZ) - with caching
R/W ra1o
Amazon Aurora
without caching
Amazon Aurora
with
caching
RDS MySQL
30K IOPS
without caching
RDS MySQL
30K IOPS
with
caching
100/0 160,000 375,000 35,000 19,000
50/50 130,000 93,000 24,000 20,000
0/100 64,000 64,000 16,000 16,000
OLTP workload
1,000 connections
250 tables
Query cache on/off tested
24. v
2.6 3.4 3.9 5.4
1,000 2,000 5,000 10,000
0
50,000
100,000
150,000
200,000
250,000
300,000
350,000
Updates per second
Read replica lag in milliseconds
Read replica lag
Aurora RDS MySQL;30,000 IOPS (Single AZ)
Updates per
second
Amazon
Aurora
RDS MySQL
30K IOPS (single
AZ)
1,000 2.62 ms 0 s
2,000 3.42 ms 1 s
5,000 3.94 ms 60 s
10,000 5.38 ms 300 s
Write workload
250 tables
Query cache on for Amazon Aurora, off for MySQL (best
settings)
복제는 최대 400배 낮은 지연
25. v
Amazon Aurora 성능 벤치마크 가이드 제공
• https://d0.awsstatic.com/product-marketing/Aurora/
RDS_Aurora_Performance_Assessment_Benchmarking_v1-2.pdf
./sysbench --test=tests/db/oltp.lua
--mysql-host=<rds-aurora-
instancehost-name>!
--oltp-tables-count=250 --mysql-
user=<db-username> --
mysqlpassword=<db-password>!
--mysql-port=3306 --db-driver=mysql
--oltp-tablesize=25000!
--mysql-db=<db-name> --max-requests=0
--max-time=600 --!
oltp_simple_ranges=0 --oltp-distinct-
ranges=0 --oltp-sum-ranges=0 --
oltporder-ranges=0!
--oltp-point-selects=0 --num-
threads=1000 --randtype=uniform!
run !
27. v
RDS Aurora 생성 및 마이그레이션
RDS 런치 시 Amazon Aurora 엔진 선택하여
신규 RDS 인스턴스 런치
• 신규
• 이전 (MySQL)
• 이전 (RDS MySQL)
• 이전 (non-MySQL)
34. v
RDS Aurora 생성 및 마이그레이션
• 신규
• 이전 (MySQL)
• 이전 (RDS MySQL)
• 이전 (non-MySQL)
DB on
instance
RDS Aurora
instance
PostgreSQLPostgreSQLAurora
mysqldump / mysqlimport
• MySQL 에서 Aurora 이전을 위하여 데이터 익스포트
에 표준적인 mysqldump utility 사용 및 데이터 임포
트에 mysqlimport utility 사용 또는 반대도 가능
35. v
RDS Aurora 생성 및 마이그레이션
• 신규
• 이전 (MySQL)
• 이전 (RDS MySQL)
• 이전 (non-MySQL)
RDS MySQL
instance
RDS Aurora
instance
PostgreSQLPostgreSQLAurora
Snapshot migra=on
• MySQL v5.6 : RDS DB Snapshot 마이그레이션
• MySQL v5.6 이전 : DB 업그레이드 후 DB 스냅샷 마
이그레이션
MySQL
40. v
RDS Aurora 생성 및 마이그레이션
• 신규
• 이전 (MySQL)
• 이전 (RDS MySQL)
• 이전 (non-MySQL)
• RDS Migration Tool은 최소한의 다운타임으로 On-
premise 및 EC2 DB 를 RDS로 이전하기 위한 강력한 툴
• Full load 및 CDC(Change Data Capture)
• 이기종 DB 이전 지원 (예:MS SQL to Aurora)
• 요청 시 AMI 공유
RDS
instance
RDS Aurora
instance
PostgreSQLPostgreSQLAurora
RDS
migra=on tool
OracleMS SQLPostgreSQLPostgreSQL
49. Start your first migra.on in 10 minutes or less
Keep your apps running during the migra.on
Replicate within, to or from Amazon EC2 or RDS
Move data to the same or different database engine
Sign up for preview at aws.amazon.com/dms
AWS
Database Migration
Service
51. v
Customer
Premises
Application Users
AWS
Internet
VPN
• Start a replication instance
• Connect to source and target
databases
• Select tables, schemas, or databases
Let AWS Database Migration
Service create tables, load data, and
keep them in sync
Switch applications over to the
target at your convenience
Keep your apps running during the migration
AWS
Database Migration
Service
52. v
After migration, use for replication and data
integration
• Replicate data in on-premises databases to AWS
• Replicate OLTP data to Amazon Redshift
• Integrate tables from third-party software into your reporting or
core OLTP systems
• Hybrid cloud is a stepping stone in migration to AWS
53. 여러분의 피드백을 기다립니다!
• 공식 블로그: http://aws.amazon.com/ko/blogs/korea
• 한국어 공식 소셜 미디어
@AWSKorea
AmazonWebServices.ko
AWSKorea
AWSKorea