Upload
yasuhiro-matsuo
View
2.180
Download
4
Embed Size (px)
Citation preview
Scaling MongoDB on AWSMongoDB Tokyo 2013
Copyright © 2013 Amazon Data Services Japan
自己紹介Name :松尾康博 ( @understeer )
Company : Amazon Data Services Japan
Job : Solutions Architect
Famous AWS Services : High Performance Instance
High Performance Storage
Community MongoDB-JP
Copyright © 2013 Amazon Data Services Japan
Agenda
AWS OverviewMongoDB on AWSUse casesTips
クラウドコンピューティングとは?
初期投資が不要 実際の使用分のみ支払い
セルフサービスなインフラ
スケールアップ、ダウンが容易
ビジネススピードの改善
低額な利用価格
Deploy
5
AWS の様々なサービス
お客様のアプリケーション
認証 AWS IAM
モニタリングAmazon
CloudWatch
Web 管理画面Management
Console
デプロイと自動化AWS Elastic BeanstalkAWS Cloud Formation
AWS OpsWorks
IDE プラグインEclipse
Visual Studio
ライブラリ & SDKs
Java, PHP, .NET, Python, Ruby,
node.js
Development & Administration
AWS グローバルインフラGeographical Regions, Availability Zones, Points of PresenceAZRegion
ネットワーク & ルーティングAmazon VPC / Amazon Elastic Load Balancer / Amazon Route 53 /AWS Direct Connect
InfrastructureService
コンピュータ処理 Amazon EC2
Auto Scale
ストレージ Amazon S3Amazon EBS
Amazon GlacierAWS StorageGateway
データベースAmazon RDS
Amazon DynamoDBAmazon ElastiCache
Amazon Redshift
コンテンツ配信Amazon CloudFront
メッセージAmazon SNSAmazon SQSAmazon SES
分散処理Elastic MapReduce
検索エンジン Amazon Cloud Search
トランスコードAmazon Elastic Transcoder
ワークフロー管理Amazon SWF
AWS DataPipeline
Application Service
世界に広がる AWS のインフラ米国西部(Northern California, Oregon)
米国東部(Northern Virginia)
EU 西部(Dublin)
アジアパシフィック
(Singapore)
アジアパシフィック
(東京)
AWS リージョン
AWS エッジロケーション (CloudFront & Route 53)
GovCloud(US ITAR Region)
アジアパシフィック
(Sydney)
南アメリカ(Saopaulo)
世界 190 以上の国または地域で数十万のお客様がご利用
日本でも 20,000 超のお客様
世界で 500 を超える政府機関や、2,000 を超える教育機関もご利用
Amazon が年商 5000 億円規模の頃の同じサーバリソースを毎日追加
6
Copyright © 2013 Amazon Data Services Japan
Amazon EC2(Elastic Compute Cloud)
1任意のゾーンに分散配置可能
リージョンアベイラビリティ
ゾーン A
EC2
アベイラビリティゾーン B
EC2
EC2
数分で起動可能な仮想サーバ1 時間ごとの従量課金で利用可能14 種類の仮想サーバを選択可能Windows, Linux など x86-64 アーキテクチャの OS が利用可能OS 以上は自由に触れる MongoDB でもそれ以外の NoSQL でもインストール可能
AWS の高い汎用性
HTML5
×
開発言語フロント UI
×
ミドルウェア
OS
MongoDB on AWS
Copyright © 2013 Amazon Data Services Japan
MongoDB を AWS で実行すると・・
簡単に試せる しかも安く試せる 複数データセンター間・遠隔レプリカを簡単に実現
AWS の機能を活用して、運用を楽に! データの可用性、耐久性対策
スケーラブル! 高性能インスタンスに簡単にスケールアップ すぐに台数を増やして簡単にスケールアウト
Copyright © 2013 Amazon Data Services Japan
簡単に試せるLinux インスタンス起動 5 分EBS 設定 5 分MongoDB インストール 数分MongoDB セットアップ 数分MongoDB 起動 数分
http://docs.mongodb.org/ecosystem/platforms/amazon-ec2/
Copyright © 2013 Amazon Data Services Japan
Easy to start a single node
AWS マーケットプレイス MongoDB 2.4.8 がプリインストールされたイメージを無償提
供• https://aws.amazon.com/marketplace/pp/B00COAAEH8/
Copyright © 2013 Amazon Data Services Japan
AWS マーケットプレイス MongoDB がプリインストールされたイメージを無償提供
• https://aws.amazon.com/marketplace/pp/B007IBMJPI/ 手順も公開
• http://www.mongodb.org/display/DOCS/AWS+Marketplace
DEMOEasy to start a single node
Scale MongoDB!
Replica sets on AWS
MongoDB + Arbiter in Availability Zones.
Sharded Replica sets on AWS
Config Servers (t1.micro) and MongoDBs in AZs
Copyright © 2013 Amazon Data Services Japan
Copyright © 2013 Amazon Data Services Japan
replicate
Copyright © 2013 Amazon Data Services Japan
shard
shard
shard
Copyright © 2013 Amazon Data Services Japan
shard
shard
shard
Scale OUT!
Copyright © 2013 Amazon Data Services Japan
shard
shard
shard
Copyright © 2013 Amazon Data Services Japan
3.757.51517.134.268.460.5244
< - - -Where you should be
Copyright © 2013 Amazon Data Services Japan
3.75 m1.medium7.5 m1.large15 m1.xlarge17.1 m2.xlarge34.2 m2.2xlarge68.4 m2.4xlarge60.5 c3.8xlarge244 cr1.8xlarge
… GB メモリ
256
128
64
32
16
8
4
2
1
1 2 4 8 16 32 64 128 256
High I/O 4XL 60.5 GB35 EC2 Compute Units16 virtual cores2*1024 GB SSD-based local instance storage
EC2 Compute Units
Mem
ory
(G
B)
Small 1.7 GB, 1 EC2 Compute Unit1 virtual core
Micro 613 MB Up to 2 ECUs (for short bursts)
Large 7.5 GB4 EC2 Compute Units 2 virtual cores
Hi-Mem XL 17.1 GB6.5 EC2 Compute Units 2 virtual cores
Hi-Mem 2XL 34.2 GB13 EC2 Compute Units4 virtual cores
Hi-Mem 4XL 68.4 GB26 EC2 Compute Units 8 virtual cores
High-CPU Med 1.7 GB 5 EC2 Compute Units 2 virtual cores
High-CPU XL 7 GB 20 EC2 Compute Units8 virtual cores
Medium 3.7 GB, 2 EC2 Compute Units1 virtual core
M3 XL 15 GB 13 EC2 Compute Units 4 virtual coresEBS storage only
M3 2XL 30 GB 26 EC2 Compute Units 8 virtual coresEBS storage only
Extra Large 15 GB 8 EC2 Compute Units4 virtual cores
10 GB Inter-
Instance Network
Cluster GPU 4XL 22 GB 33.5 EC2 Compute Units, 2 x NVIDIA Tesla “Fermi” M2050 GPUs
Cluster Compute 4XL 23 GB 33.5 EC2 Compute Units
Cluster Compute 8XL 60.5 GB 88 EC2 Compute Units
High Storage 8XL 117 GB35 EC2 Compute Units, 24 * 2 TB ephemeral drives10 GB Ethernet
Hi-Mem Cluster Compute 8XL 244 GB 88 EC2 Compute Units16 virtual cores240 GB SSD
Scale U
p
Copyright © 2013 Amazon Data Services Japan
Scale UP!
高性能スペック
C3 インスタンス 3 世代目の、クラスタコンピュートインスタンスタイプHVM (完全仮想化)で実行Intel® Xeon® E5-2680v2 processors
10 Gigabit Ethernet
1
Cluster Compute
32 仮想 core
60GB RAM
320GB x 2Local SSD
大容量メモリスペック
CR1 インスタンス 3 世代目の、大容量メモリクラスタコンピュートインスタンスタイプIntel® Xeon® E5-2670 processors
10 Gigabit Ethernet
2
Cluster Compute
16 仮想 core
244GiB RAM
120GB x 2 Local SSD
Copyright © 2013 Amazon Data Services Japan
Scale I/O
SSD SSD SSD
SSD SSD SSD
SSD SSD SSD
高速 IO
I2 インスタンス高速ファイル I/O を実現するインスタンスタイプIntel® Xeon® E5-2670v2 processors
10 Gigabit Ethernet
高速な SSD を内蔵 ( Max 350,000 IOPS ※4KB read)
3
Cluster Compute
32 仮想 core
244 GB RAM
720GB x 8 Local SSD
Coming Soon!
30
New Instances まとめファミリー (6) タイプ (10) 新しいタイプ (3)
汎用General Purpose
M1M3
コンピューティング最適化Compute Optimized
C1CC2 C3
メモリ最適化Memory Optimized
M2CR1
ストレージ最適化Storage Optimized
HI1HS1 I2
マイクロインスタンスMicro T1
GPU インスタンスGPU CG1 G2
Storage Tuning
インスタンスを大きくすると EBS の帯域も増えるのでディスク本数を増やしてもサチらない(m1.xlarge, c1.xlarge, m2.4xlarge)
例 ) 100GiB を 8 本 RAID10 で 400+ IOPS
Copyright © 2013 Amazon Data Services Japan
Test: random 4k reads
EBS
SSD
One Volume: ~200 MongoOPSLoaded instance: ~ 1000 MongoOPS
One Volume: 4,000 MongoOPS
Loaded Instance: 80,000 MongoOPS
I2 SSD: ~180,000 MongoOPS
PIOPS+
Copyright © 2013 Amazon Data Services Japan
Test: random 4k reads
SSDPIOPS+
EBS
Copyright © 2013 Amazon Data Services Japan
random 4k reads
SSDPIOPS+
EBS
Sta
ble
Copyright © 2013 Amazon Data Services Japan
random 4k reads
SSDPIOPS+
EBS
Sta
ble
Fas
t!!!
Copyright © 2013 Amazon Data Services Japan
Config Tips
Sta
ble Ext4 or XFS, noatime
Raise file descriptor limits
Set disk read-ahead
No large virtual memory pagesFreeze IO’s during snapshots Fas
t!!!
Copyright © 2013 Amazon Data Services Japan
Whitepaper
Published March 2013.MongoDB 2.2
http://d36cz9buwru1tt.cloudfront.net/AWS_NoSQL_MongoDB.pdf
Copyright © 2013 Amazon Data Services Japan
Sumally( サマリー )
「モノの百科事典」を目指すサービス
• http://sumally.com/
• 250,000+ Users• 1,200,000+ Items• 35,500,000+ Wants/Haves
Case Study
Copyright © 2013 Amazon Data Services Japan
Sumally( サマリー )
「モノの百科事典」を目指すサービス
• 3 Replica Sets• Main: m2.2xlarge• Log: m1.large• Notification: m2.xlarge
• Use MMS• Availability
• 99.9996%• ( メンテ時間を含む )Case Study
Availability Zone a Availability Zone b
EBSEBSEBSEBSEBSEBS
EBSEBS EBSEBS
Copyright © 2013 Amazon Data Services Japan
JMTY( ジモティ -)
地元の無料の広告掲示板サービス
• Full AWS
• Only MongoDB as Datastore
• Replicaset ( 3 nodes)
Case Study
Copyright © 2013 Amazon Data Services Japan
SnapDish by Vuzz.inc
料理を簡単に美味しく撮る「料理カメラ」
• 70 万 DL
• 160 万 Posts
• 1000 万 もぐもぐ ( likes)
• 800posts/hour
Case Study
Copyright © 2013 Amazon Data Services Japan
SnapDish by Vuzz.inc
• Replicaset( 2 nodes +arb)• 1000 PIOPS EBS RAID10
• hi1.4xlarge + SSD
• GridFS – photos from users• GeoIndex – location of photo
Case Study
AWS を利用することで、インフラ管理を自分で全部できるのでコスト削減に役立っています。あと、アプリ開発により時間がとれるので、サービスの向上に繋がっています。
Vuzz CTO 清田史和様
・フル AWS・データベースは Mongo のみ・ 1 レプリカ・ S3 にバックアップ・ EBS 2000IOPS・ 150000+ Users・ Chef + Capistrano でサーバ構築を自動化・ Github + Capistrano + Jenkins で自動 deploy
発行部数 6,000 万部!伝説の不良漫画のソーシャルゲーム
ELB
ElastiCache
Cloud Front
S3
Web Server
Mongo DBSecondary
Admin Server
Batch Server
Mongo DBPrimary
Mongo DBSecondary
Web ServerWeb ServerApache + CakePHP
Web Server
Web ServerWeb ServerApache + CakePHP
Jenkins Server
ap-northeast-1a:m3.2xlarge * 2ap-northeast-1c:m3.2xlarge * 1
ap-northeast-1a:c1.medium * nap-northeast-1c:c1.medium * n
github
Copyright © 2013 Amazon Data Services Japan
Whitepaper
Published March 2013.MongoDB 2.2
http://d36cz9buwru1tt.cloudfront.net/AWS_NoSQL_MongoDB.pdf
Copyright © 2013 Amazon Data Services Japan
まとめ
MongoDB をすぐに安く試すなら AWS! 無料枠でも十分試せます!
AWS の多くの機能で運用を楽に ! Whitepaperあります
AWS で MongoDB の機能をフル活用! 本番利用時は MongoDB サポートも併せて!