cloud design pattern #3 compensating transaction_エンジニア勉強会20140917

12
Copyright © 2014 by S-cubism Technology Inc. All rights reserved. Copyright © 2014 by S-cubism Technology Inc. All rights reserved. Cloud Design Pattern #3 Compensating Transaction 2014/9/5 http://azure.microsoft.com/ja-jp/

Upload: -

Post on 19-Jun-2015

153 views

Category:

Technology


5 download

DESCRIPTION

2014/9/5 エスキュービズム社内勉強会時に使用した資料になります。

TRANSCRIPT

Page 1: Cloud Design Pattern #3 Compensating Transaction_エンジニア勉強会20140917

Copyright © 2014 by S-cubism Technology Inc. All rights reserved.Copyright © 2014 by S-cubism Technology Inc. All rights reserved.

Cloud Design Pattern#3 Compensating Transaction

2014/9/5

http://azure.microsoft.com/ja-jp/

Page 2: Cloud Design Pattern #3 Compensating Transaction_エンジニア勉強会20140917

Copyright © 2014 by S-cubism Technology Inc. All rights reserved.

Microsoft Azure Seminer行ってきました。

• みんなSurface Pro 3持ってた

• まだ発展途上感が強い

• あんまり商用利用じゃないのか?社内

システムのリプレースとか向け???

• 行き詰ったら、PowerShell

• 行き詰ったら、構成ファイルDL⇒メモ

帳書き換え⇒インポートhttp://azure.microsoft.com/ja-jp/

Page 3: Cloud Design Pattern #3 Compensating Transaction_エンジニア勉強会20140917

Copyright © 2014 by S-cubism Technology Inc. All rights reserved.

カテゴリ

可用性

データ管理

設計および実装

メッセージング

管理および監視

パフォーマンスおよびスケーラビリティ

回復性

セキュリティ

Page 4: Cloud Design Pattern #3 Compensating Transaction_エンジニア勉強会20140917

Copyright © 2014 by S-cubism Technology Inc. All rights reserved.

概要

順繰りトランザクション

Compensate = 相殺する、埋め合わせる

Powered by

Page 5: Cloud Design Pattern #3 Compensating Transaction_エンジニア勉強会20140917

Copyright © 2014 by S-cubism Technology Inc. All rights reserved.

概要

結果整合性、保ちます(ましょう)。

結果整合性(英: eventual consistency)は、並列プログラミングの分野、例えば、分散共有メモリ、分散トランザクション、楽観的レプリケーション、において用いられるデータの一貫性に関するモデルのひとつ。

これは厳密な一貫性を要求する考え方ではなく、結果的に一貫性が保たれればよいという考え方。長い間、データの更新がなければ、結果的に、全ての更新処理が反映され、全てのレプリケーションを含めたデータの一貫性が保たれる、とする。

Powered by

Page 6: Cloud Design Pattern #3 Compensating Transaction_エンジニア勉強会20140917

Copyright © 2014 by S-cubism Technology Inc. All rights reserved.

結果整合性

どんなケースで結果整合性を求められるか?

http://www.mongodb.org/

http://www.mongodb.org/

http://hbase.apache.org/

http://cloud.nifty.com/

Page 7: Cloud Design Pattern #3 Compensating Transaction_エンジニア勉強会20140917

Copyright © 2014 by S-cubism Technology Inc. All rights reserved.

背景と課題

単純なトランザクションだけでは、結果整合性を保てないケースがある。

単純なトランザクション

受注受注詳細配送

Page 8: Cloud Design Pattern #3 Compensating Transaction_エンジニア勉強会20140917

Copyright © 2014 by S-cubism Technology Inc. All rights reserved.

背景と課題

複雑なトランザクション

受注受注詳細配送

MySQL on EC-Orange

Some Tables

Other DataStores on

Other Systems

Some TablesSome Tables

???!

http://msdn.microsoft.com/en-us/library/dn600223.aspx

Page 9: Cloud Design Pattern #3 Compensating Transaction_エンジニア勉強会20140917

Copyright © 2014 by S-cubism Technology Inc. All rights reserved.

解決策

受注受注詳細配送

MySQL on EC-Orange

Some Tables

Other DataStores on

Other Systems

Some TablesSome Tables

異種データストア、システムに対して順次補正アクセスをかける

http://hiro2matome.seesaa.net/article/401763234.html

http://msdn.microsoft.com/en-us/library/dn600223.aspx

Page 10: Cloud Design Pattern #3 Compensating Transaction_エンジニア勉強会20140917

Copyright © 2014 by S-cubism Technology Inc. All rights reserved.

具体例(旅行システムの場合)

http://msdn.microsoft.com/en-us/library/dn600223.aspx

Page 11: Cloud Design Pattern #3 Compensating Transaction_エンジニア勉強会20140917

Copyright © 2014 by S-cubism Technology Inc. All rights reserved.

実装(あくまでイメージ)

補正手順

障害発生!補正手順ある??!

http://hiro2matome.seesaa.net/article/401763234.html

https://igor.io/2013/08/28/stack-machines-fundamentals.html

Page 12: Cloud Design Pattern #3 Compensating Transaction_エンジニア勉強会20140917

Copyright © 2014 by S-cubism Technology Inc. All rights reserved.

留意事項

1.いつ失敗したか、というのは簡単には分からない。即時のものとも限らない(ブロッキングされる)

ので、タイムアウトのメカニズムが必要。

2.補正ロジックは、簡単にはかけない。アプリ固有なので。

3.補正ロジックはべき等なコマンドであるべき。失敗しても再実行できるように。