the future of stream processing

44
#ctonight

Upload: mitsuharu-hamba

Post on 15-Apr-2017

1.167 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: The future of stream processing

  #ctonight

Page 2: The future of stream processing

The Future of Stream Processingアマゾンウェブサービスジャパン株式会社半場光晴

Page 3: The future of stream processing

Stream processingしてますか?

Page 4: The future of stream processing

Stream processingで何しましょう

Page 5: The future of stream processing

ニアリアルタイムな何か(Near Realtime)

Page 6: The future of stream processing

Stream processing でニアリアルタイムを体験してみましょう

Page 7: The future of stream processing

デモClick stream

http://goo.gl/xxxxxx

Page 8: The future of stream processing

http://goo.gl/xxxxxx

Page 9: The future of stream processing

デモのアーキテクチャ

Page 10: The future of stream processing

AmazonS3

Amazon API Gateway

Amazon API Gateway

Amazon Kinesis

Amazon EMR

AmazonDynamoDB

AWSLambda

AmazonS3

Page 11: The future of stream processing

AmazonS3

Amazon API Gateway

Amazon API Gateway

Amazon Kinesis

Amazon EMR

AmazonDynamoDB

AWSLambda

AmazonS3

ここが Stream processingData Source > Collection > Process > Store

Page 12: The future of stream processing

AmazonS3

Amazon API Gateway

Amazon API Gateway

Amazon Kinesis

Amazon EMR

AmazonDynamoDB

AWSLambda

AmazonS3

Amazon S3Static Website HostingHighly scalableDesigned for 99.99% availability

Page 13: The future of stream processing

AmazonS3

Amazon API Gateway

Amazon API Gateway

Amazon Kinesis

Amazon EMR

AmazonDynamoDB

AWSLambda

AmazonS3

Amazon API GatewayFully managed serviceConfigured as an AWS proxy

Page 14: The future of stream processing

AmazonS3

Amazon API Gateway

Amazon API Gateway

Amazon Kinesis

Amazon EMR

AmazonDynamoDB

AWSLambda

AmazonS3

Amazon Kinesis StreamsManages the infrastructure, storage, networking, and configuration needed to stream your data at the level of your data throughput.

Page 15: The future of stream processing

AmazonS3

Amazon API Gateway

Amazon API Gateway

Amazon Kinesis

Amazon EMR

AmazonDynamoDB

AWSLambda

AmazonS3

Amazon Elastic MapReduceEnables you to instantly provisionas much or as little capacity as you like to perform.

Page 16: The future of stream processing

AmazonS3

Amazon API Gateway

Amazon API Gateway

Amazon Kinesis

Amazon EMR

AmazonDynamoDB

AWSLambda

AmazonS3

Amazon DynamoDBFully managed NoSQL database serviceFast and predictable performancewith seamless scalability

Page 17: The future of stream processing

AmazonS3

Amazon API Gateway

Amazon API Gateway

Amazon Kinesis

Amazon EMR

AmazonDynamoDB

AWSLambda

AmazonS3

Amazon LambdaLets you run code without provisioning/managing serversTakes care of everything required to runand scale your code with high availability

Page 18: The future of stream processing

AmazonS3

Amazon API Gateway

Amazon API Gateway

Amazon Kinesis

Amazon EMR

AmazonDynamoDB

AWSLambda

AmazonS3

http://spark.apache.org/docs/latest/streaming-programming-guide.html

例 Windowed computations今回のデモの場合、毎秒、クリック回数を算出して、直近 3 秒間の合計を、2 秒ずつスライドしながら計算し続ける

Page 19: The future of stream processing

AmazonS3

Amazon API Gateway

Amazon API Gateway

Amazon Kinesis

Amazon EMR

AmazonDynamoDB

AWSLambda

AmazonS3

これで完成形でしょうか?

Page 20: The future of stream processing

AmazonS3

Amazon API Gateway

Amazon API Gateway

Amazon Kinesis

Amazon EMR

AmazonDynamoDB

AWSLambda

AmazonS3

完成形に向かって、どこを目指すべきでしょうか?

Page 21: The future of stream processing

これ系のスゴイ方々の言動から学ぶ

Page 22: The future of stream processing

キーワード「 Reactive 」

http://www.reactive-streams.org/http://www.reactivemanifesto.org/

Page 23: The future of stream processing

Reactive のマニフェスト

http://www.reactive-streams.org/http://www.reactivemanifesto.org/

Page 24: The future of stream processing

Responsive可能な限り速やかに応答を返し続けるシステムに問題が発生しても、速やかに検知して効率的に対処する早く一定した応答時間を保ち、十分な上限を満たすことで、一定のサービス品質を維持する

http://www.reactive-streams.org/http://www.reactivemanifesto.org/

Page 25: The future of stream processing

Resilient予期せぬ障害が発生してもResponsive を維持する

ReplicationIsolationDelegation ( 委譲 )

障害の影響範囲をコンポーネントの中に閉じる

http://www.reactive-streams.org/http://www.reactivemanifesto.org/

Page 26: The future of stream processing

Elastic多様な負荷状況でもResponsive を維持する競合やボトルネックがない

Shard や Replication で負荷を散らすことができる

負荷状況に応じてスケールできる

http://www.reactive-streams.org/http://www.reactivemanifesto.org/

Page 27: The future of stream processing

Message Driven非同期であるイベントキューではなくメッセージを受け渡すノンブロッキングであるバックプレッシャーの仕組みを持つ

http://www.reactive-streams.org/http://www.reactivemanifesto.org/

Page 28: The future of stream processing

Reactive のマニフェスト

Replication

Isolation

Delegation

Asynchronous

Back-pressure Non-blocking

Scalable

Failure-handling

http://www.reactive-streams.org/http://www.reactivemanifesto.org/

Page 29: The future of stream processing

AmazonS3

Amazon API Gateway

Amazon API Gateway

Amazon Kinesis

Amazon EMR

AmazonDynamoDB

AWSLambda

AmazonS3

このアーキテクチャはReactive でしょうか?

Page 30: The future of stream processing

AmazonS3

Amazon API Gateway

Amazon API Gateway

Amazon Kinesis

Amazon EMR

AmazonDynamoDB

AWSLambda

AmazonS3

最大のボトルネックはここ

Page 31: The future of stream processing

AmazonS3

Amazon API Gateway

Amazon API Gateway

Amazon Kinesis

Amazon EMR

AmazonDynamoDB

AWSLambda

AmazonS3

Click stream の急伸で、Kinesis への書き込みが失敗すると、

データが失われる

Page 32: The future of stream processing

書き込みに失敗したら、別のコンポーネントに書き込みを委譲する

SQS に入れておき、 Lambda で定期的に捌く

AmazonS3

Amazon API Gateway

Amazon API Gateway

Amazon Kinesis

Amazon EMR

AmazonDynamoDB

AWSLambda

AWSLambda

AmazonS3

AmazonSQS

Amazon CloudWatch

AmazonSNS

AWSLambda

Scheduled event

AWSLambda

Page 33: The future of stream processing

書き込みに失敗したら、別のコンポーネントに書き込みを委譲する

SQS に入れておき、 SNS からLambda を実行して、再帰的に捌く

AmazonS3

Amazon API Gateway

Amazon API Gateway

Amazon Kinesis

Amazon EMR

AmazonDynamoDB

AWSLambda

AWSLambda

AWSLambda

AmazonS3

AmazonSQS

Amazon CloudWatch

AmazonSNS

AWSLambda

AmazonSNS

Page 34: The future of stream processing

AmazonS3

Amazon API Gateway

Amazon API Gateway

Amazon Kinesis

Amazon EMR

AmazonDynamoDB

AWSLambda

AWSLambda

AWSLambda

AmazonS3

AmazonSQS

Amazon CloudWatch

AmazonSNS

AWSLambda

AmazonSNS

負荷に連動して、適宜 Kinesisの Reshard も実施する

Page 35: The future of stream processing

AmazonS3

Amazon API Gateway

Amazon API Gateway

Amazon Kinesis

Amazon EMR

AmazonDynamoDB

AWSLambda

AmazonS3

他は問題ないでしょうか?

Page 36: The future of stream processing

AmazonS3

Amazon API Gateway

Amazon API Gateway

Amazon Kinesis

Amazon EMR

AmazonDynamoDB

AWSLambda

AmazonS3

Spark で Back pressure が働いても、 Kinesis に一定期間保持でき

る また、負荷に連動して、適宜 EMR クラスターの Resize を実施する

Page 37: The future of stream processing

AmazonS3

Amazon API Gateway

Amazon API Gateway

Amazon Kinesis

Amazon EMR

AmazonDynamoDB

AWSLambda

AmazonS3

EMR で適切に処理すれば、 Write の負荷を軽減できる

また、負荷に連動して、適宜 DynamoDB の Write スループットの変更を実施する

Page 38: The future of stream processing

AmazonS3

Amazon API Gateway

Amazon API Gateway

Amazon Kinesis

Amazon EMR

AmazonDynamoDB

AWSLambda

AmazonS3

Lambda でキャッシュすれば、Read の負荷を軽減できる

また、負荷に連動して、適宜 DynamoDB の Read スループットの変更を実施する

Page 39: The future of stream processing

おさらい

Page 40: The future of stream processing

AmazonS3

Amazon API Gateway

Amazon API Gateway

Amazon Kinesis

Amazon EMR

AmazonDynamoDB

AWSLambda

AmazonS3

AWS サービスを活用しよう

Page 41: The future of stream processing

Reactive

AmazonS3

Amazon API Gateway

Amazon API Gateway

Amazon Kinesis

Amazon EMR

AmazonDynamoDB

AWSLambda

AWSLambda

AWSLambda

AmazonS3

AmazonSQS

Amazon CloudWatch

AmazonSNS

AWSLambda

AmazonSNS

Page 42: The future of stream processing

AmazonS3

Amazon API Gateway

Amazon API Gateway

Amazon Kinesis

Amazon EMR

AmazonDynamoDB

AWSLambda

AWSLambda

AWSLambda

AmazonS3

AmazonSQS

Amazon CloudWatch

AmazonSNS

AWSLambda

AmazonSNS

非同期ノンブロッキングバックプレッシャー

Page 43: The future of stream processing
Page 44: The future of stream processing

  #ctonight