Persistence on Azure - Microsoft Azure の永続化
-
Upload
takekazu-omi -
Category
Technology
-
view
1.549 -
download
1
Transcript of Persistence on Azure - Microsoft Azure の永続化
![Page 1: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/1.jpg)
Persistence on AzureMicrosoft Azure の永続化
kyrt / Takekazu Omi
@takekazuomi
2015/1/14 R.1.0
![Page 2: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/2.jpg)
自己紹介
近江 武一JAZUG Azure Storage 担当(自称)
Microsoft MVP for Azure
kyrt @takekazuomi 2
kyrt.in
github.com/takekazuomi
white paper
監訳
![Page 3: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/3.jpg)
3
![Page 4: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/4.jpg)
Agenda
クラウドにおける永続化の紹介
Azureの永続化実装
Azure Storage
冗長構成
IaaS Disk
4
![Page 5: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/5.jpg)
はじめに
5
![Page 6: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/6.jpg)
永続化とは(基本ストーリー)
従来(オンプレ)⇨電源切るとメモリの内容はロスト⇨消えないところに書いておく⇨HDD=永続化領域
クラウドでは更に⇨ハードウェア障害でインスタンス内容はロスト⇨消えないところに書いておく⇨managed persistence serviceへ書いておく
6
![Page 7: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/7.jpg)
Managed Persistence Service
管理された、ストレージクラスターが用意
APIで、確保、開放できる
HA構成になっている
最大容量が大きい
従量課金になっている(Pay-per-use)
7
![Page 8: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/8.jpg)
違いオンプレ
⇨インスタンス障害時はマシンからのデータ復旧、バックアップからの復元が前提
⇨ストレージ障害(HDD,RAID)の場合はバックアップへ
クラウド⇨インスタンス障害では別ハードウェアの割り当て前提
⇨インスタンスの外に多重化して保存が基本⇨リアルタイムに多重化
8
![Page 9: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/9.jpg)
AZUREの永続化実装
10
![Page 10: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/10.jpg)
Managed Service 6種
永続化のためのManaged Serviceは6つある
11
1. Azure Table
2. Azure Blob
3. Azure Files
4. 仮想ディスク
5. SQL Database
6. DocumentDB
![Page 11: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/11.jpg)
Azure Storage 4種
いろいろあるように見えるが
⇨Azure内ではAzure Storage(分散ストレージ、ストレージクラスター)上に構築されているもの
⇨それ以外の2つに別れる
12
![Page 12: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/12.jpg)
6つのManaged Service
永続化のためのManaged Serviceは6つある
13
1. Azure Table
2. Azure Blob
3. Azure Files
4. 仮想ディスク
5. SQL Database
6. DocumentDB
![Page 13: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/13.jpg)
AZURE STORAGE
14
![Page 14: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/14.jpg)
Microsoft Azure Storage Cloud Storage – Anywhere and anytime access
⇨ Blob, Tables, Queue, Files
Highly Durable, Available and Massively Scalable⇨ 容易にinternet scaleのアプリケーションが構築可能⇨ 30 Trillion stored objects (※1)
⇨ 2.5+ Million request/sec on average (※2)
従量課金 簡単でOPENなREST APIで公開 複数のクライアントライブラリのサポート .NET, Java, Node.js,
Python, PHP, Ruby※1 TechEd 2014 / 2014-05 / Microsoft Azure Storage
http://channel9.msdn.com/Events/TechEd/NorthAmerica/2014/DCIM-B384
※2Azure IaaS for IT Pros Online Event / 2014-12 / View from the CTO: Mark Russinovich
http://channel9.msdn.com/Events/Microsoft-Azure/Level-Up-Azure-IaaS-for-IT-Pros/View-from-the-CTO-Mark-Russinovich-Chief-Technology-Office-Azure
![Page 16: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/16.jpg)
Azure Storage 基盤
4つは、共通のAzure Storage基盤の上に構築
Azure Storage Clusters
Table Blob
Disks
FilesQueue
![Page 17: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/17.jpg)
Abstractions - Blob, Table, Queue, Files
Storageは4種類
BlobREST file system
• Block/Page
• Data共有- image,
video …
• Big Data - raw
data/logs …
• Backup – SQL
Database, file
backup
• Disks – mount
VHDs
Tablestructure data
• NoSQL
• key/value
• schema less
• scale
• partitioned
sorted set
QueueReliable
messaging system
• component/role
間結合• 非同期タスクスケジュラーの実装
• process/work
flowsの構築
FilesSMB file share
• 複数インスタンスからマウント
• 標準的なSMBプロトコル
• config等の共有
preview
![Page 18: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/18.jpg)
Blob – massively scalable object store
データ共有⇨ 画像、動画、非構造化データ
Big Data
⇨ 生データ、ログの保存
Backup
⇨データやデバイスのバックアップ
19
![Page 19: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/19.jpg)
Disk(IaaS) – Azure VM向けの永続性Disk
ネットワーク経由でマウント
オンプレからクラウドへの移行
Blobに、保存されたVHDを利用
20
![Page 20: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/20.jpg)
Table – Massively scalable NoSQL cloud store
スケールするKey/Value store
トラフィックに応じた自動ロードバランス
構造化データの保存
OData protocol (AtomPub or JSON)
21
![Page 21: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/21.jpg)
Queue– Reliable messaging system
高信頼性、低レイテンシ、高スループットなメッセージングシステム
分離されたコンポーネント向け
⇨Web RoleとWorker Role の通信
⇨ロールを別々にスケール
非同期スケジュールの実装に
22
![Page 22: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/22.jpg)
STORAGE INTERNALS
2014/2/12 kyrt @takekazuomi 23
![Page 23: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/23.jpg)
Design Goals強い一貫性の元での高い可用性の実現(Highly Available
with Strong Consistency)⇨ 障害や分断に直面してもデータアクセスを提供
永続性(Durability)⇨ データの複数の複製の保持、(regionsを跨いた)
スケーラビリティ(Scalability)⇨ zettabytesへのスケール⇨ 世界中からアクセスできるglobal namespaceの提供⇨ meet peak traffic での、automatically scale out と load balance
Additional details can be found in the SOSP paper:⇨ “SOSP 論文Windows Azure ストレージ: 高可用性と強い一貫を両立するクラウドストレージサービス”, 2011 年 10 月に 23rd ACM Symposium on Operating Systems Principles (SOSP) で発表された、Windows Azure ストレージサービスに関する論文 (PDF 1.45MB)
kyrt @takekazuomi 24
![Page 24: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/24.jpg)
パフォーマンスターゲット
Storage Account単位に性能目標がある Blob, Table ,Queueのpartition
⇨ Blobは、URL毎、Tableは、 partition key、Queueはqueue毎で別のpartition
partitionのパフォーマンスターゲット⇨ 2,000 tran/s(queue/table)
⇨ 480Mbps/s (blob)
アカウント全体⇨ 20,000 tran/s(table,queue)
⇨ 受信 – LRS 10GBps, GRS 5GBps (米国 20GBps)⇨ 送信 – LRS 15GBps, GRS 10GBps (米国 30GBps)
http://msdn.microsoft.com/ja-jp/library/azure/dn249410.aspx
25
![Page 25: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/25.jpg)
Partition Azure Storageは分散ストレージデータはPartitionに分割して処理される実際にpartitionと物理マシンの分散は負荷で変わる(consistent hashingのvirtual nodeの考えと似てる)
Partitionを跨いだ処理は一貫性が保証されない(分散トランザクションはサポートしてない、読み取り一貫性も無い)
内部的にIDC内で3重化、GEO-REPLICATIONで複製を選択すると6重に保存される
kyrt @takekazuomi 26
![Page 26: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/26.jpg)
Azure Storageのアーキテクチャーコンポーネント
s
front end
partition layer
stream layer
storage stamp
VIP
s
front end
partition layer
stream layer
storage stamp
VIPDNS
ロケーションサービス
アカウント管理
DNS参照
blob, table, queueへのアクセス
stamp間リプリケーション
stamp内リプリケーションstamp内リプリケーション
27
非同期
同期
![Page 27: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/27.jpg)
小まとめ
Azure Storageは、分散ストレージ
多重化されてる⇨stamp内(=リージョン内)は同期
⇨ リージョン間は非同期
リトライアブルなエラーという概念⇨クラスター内のインスタンス障害、ロードバランス時、スロットリングのエラーは再試行で成功する
28
![Page 28: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/28.jpg)
地理冗長 AZURE STORAGE
2014/2/26 29
![Page 29: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/29.jpg)
柔軟な冗長構成
Azure Storageの大きな特徴4つ
LRS:ローカル冗長ストレージ
ZRS:ゾーン冗長ストレージ
GRS:地理冗長ストレージ
RA-GRS:読み取りアクセス地理冗長ストレージ
30
http://msdn.microsoft.com/ja-jp/library/azure/dn727290.aspx
![Page 30: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/30.jpg)
LRSとZRS
ローカル冗長ストレージ (LRS=Locally Redundant Storage)
⇨データセンター内の同一施設内に3箇所、同期
ゾーン冗長ストレージ (ZRS)⇨1 つのリージョン内、あるいは2 つのリージョンに跨がり、2 あるいは3 か所の施設に 3 回レプリケート
31
![Page 31: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/31.jpg)
GRSとRA-GRS
地理冗長ストレージ (GRS=Geo Redundant Storage)⇨地理的に離れた場所への複製(Local 3箇所+リモート3箇所)、リモートは非同期、フェイルオーバー
読み取りアクセス地理冗長ストレージ (RA-GRS=Read Access - Geo Redundant Storage)⇨地理的に離れた場所にあるデータのRO参照
32
![Page 32: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/32.jpg)
33
スタンプを別のリージョンに置く
ジオ・リプリケーション(GRS)
![Page 33: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/33.jpg)
34http://channel9.msdn.com/Events/Microsoft-Azure/Level-Up-Azure-IaaS-for-IT-Pros/View-from-the-CTO-Mark-Russinovich-Chief-Technology-Office-Azure
データセンターのビルディングはフットボールフィールドと同じぐらい約5,400㎡ぐらい、ジュンク堂書店池袋本店の総売り場面積が、6,614 ㎡
![Page 34: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/34.jpg)
35
リージョンに16棟のビルディング、最大600,000台のサーバー
![Page 35: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/35.jpg)
注意
GRS, RA-GRS
⇨リージョン間のリプリケーションは非同期
⇨リージョンのセットは決まっている
⇨トランザクションの一貫性単位はローカルと同じ
⇨ジオフェイルオーバー·プロセスでは最大15分のデータロスト想定
36
http://blogs.msdn.com/b/windowsazurestorage/archive/2013/12/11/introducing-read-access-geo-replicated-
storage-ra-grs-for-windows-azure-storage.aspx
![Page 36: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/36.jpg)
IAAS DISKS
37
![Page 37: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/37.jpg)
Azure上でのディスク
Cloud Service
⇨Drive -永続化されるDisk
Websites
⇨複数インスタンス間で共有
仮想マシン(IaaS)⇨Temporary Disk
⇨Disk - Virtual Disk
38
![Page 38: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/38.jpg)
39
OS Disk
• Drive C:
• 永続化ありTemporary Disk
• Drive D:
• 永続化なしData Disk
• 任意• 永続化あり
![Page 39: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/39.jpg)
Disks
OS/Data Disk
⇨永続化される
⇨VHDはBlobにStore=Blobの冗長設定が有効
Temporary Disk
⇨永続化されない=消えることがある
⇨ローカルディスクなので速い
40
![Page 40: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/40.jpg)
Disks (IaaS)
41
Hypervisor
Hardware
Host
OS
Gest OS
Driver Driver
App
NIC
Microsoft Azure
Storage
Page
Blob
http://blogs.msdn.com/b/windowsazurestorage/archive/2012/06/28/exploring-windows-azure-drives-disks-and-images.aspx
Files
![Page 41: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/41.jpg)
利点
Hypervisorが DISKを提供するため、ゲストOSに異存しない=Linuxでも使える
ゲストOSのNICを使わずに、ハードウェアのNICを使う(ハードウェアを生かせる)
OSからはDISKに見えるので、OSの諸々の機能が使える(Soft RAIDとか)
42
![Page 42: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/42.jpg)
パフォーマンス
DISKあたりで500IOPS
⇨15,000 rpm SAS drives、HDD ~175-210 IOPS
SAS(http://en.wikipedia.org/wiki/IOPS)
性能向上にはSoft RAIDを使う
⇨Windows では Storage Pool
⇨Linuxでは、md
43
![Page 43: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/43.jpg)
Temporary Disk
消えても良いものは積極的に使うべき?⇨ “D シリーズの Virtual Machines (VM) を使用してい
る場合に限り、D ドライブに tempdbまたはバッファープール拡張を格納してください”• 参照:Azure Virtual Machines における SQL Server のパフォーマンスに関するベストプラクティス
⇨Disk集中型のワークロードで永続化不要な場合でも「 D シリーズ」以外はあまりメリット無い
44
![Page 44: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/44.jpg)
OS/Data Diskの注意
Diskのパフォーマンスが必要なら仮想マシンのサイズに注意
I/Oに合わせてCacheを選択⇨SQL ServerのようなI/O最適化されやアプリでは
NO Cacheが有効
ディスクストライピング(Soft RAID 0)の利用⇨GRをOffに
45
![Page 45: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/45.jpg)
GRとRAID0構成の注意
複数のDiskをまとめて使った場合に、書込の一貫性が保証されない⇒GRはOffにする
46
DiskA
BlobA
DiskB
BlobB
DiskC
BlobC
DiskA
BlobA
DiskB
BlobB
DiskC
BlobC
非同期
リージョン A リージョン B
![Page 46: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/46.jpg)
RAID0
RAID0
⇨Windows は、Storage Pool
⇨Linux は、何でも (個人的にはmd)
どうして0?⇨既に3重にリプリケーションされている
Storage Poolの時は、Virtual DiskのColum数⇨SEの雑記を読め
47
![Page 47: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/47.jpg)
インスタンサイズの制限DISKの最大数
⇨サイズによって違う(DISKの数)• A1:2, A2:4, A3:8, A4:16, A5:4, A6:8, A7:16, A8:16, A9:16
• D1:2, D2:4, D3:8, D4:16, D11:4, D12:8, D13:16, D14:32
StandardとBasic⇨ Standard:500 IOPS, Basic:300IOPS
Azure の仮想マシンおよびクラウドサービスのサイズ(http://msdn.microsoft.com/ja-jp/library/dn197896.aspx)
48
![Page 48: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/48.jpg)
Linuxでの注意点
noatime
IO scheduler
⇨ https://github.com/Azure/azure-content/blob/master/articles/virtual-machines-linux-configure-raid.md
Azure Storage secrets and Linux I/O optimizations
⇨ http://blogs.msdn.com/b/igorpag/archive/2014/10/23/azure-storage-secrets-and-linux-i-o-optimizations.aspx
49
![Page 49: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/49.jpg)
まとめ
50
![Page 50: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/50.jpg)
Azure Storage
Azure Storageは永続化共通プラットフォーム
Storageの実装は分散ストレージ
柔軟な冗長構成が可
リージョン間は非同期
仮想Diskの下回りはBlob
51
![Page 51: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/51.jpg)
VM Disk
500 IOPS
RAID0で使う⇨GRが利用出来ない
5,000 IOPS⇨ Premium Storage
⇨ http://azure.microsoft.com/blog/2014/12/11/introducing-premium-storage-high-performance-storage-for-azure-virtual-machine-workloads/
DISK集約的なケースでは、Dシリーズがお勧め
52
![Page 52: Persistence on Azure - Microsoft Azure の永続化](https://reader031.fdocuments.us/reader031/viewer/2022012306/55a695761a28abe1208b45d9/html5/thumbnails/52.jpg)
54
ありがとうございました
※この資料は 2015/01/16時点の情報を元にしてます