Upgrade to Pro — share decks privately, control downloads, hide ads and more …

全部教えます!サーバレスアプリのアンチパターンとチューニング

 全部教えます!サーバレスアプリのアンチパターンとチューニング

AWS Summit Tokyo 2017のServerless Evolution Dayでの講演資料です。

Keisuke69

June 08, 2017
Tweet

More Decks by Keisuke69

Other Decks in Technology

Transcript

  1. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Keisuke Nishitani (@Keisuke69), Specialist SA, Serverless Jun 2, 2017 d i t e t ct
  2. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Who am I Specialist Solutions Architect, Serverless Amazon Web Service Japan K.K @Keisuke69 Keisuke69 Keisuke69 Keisuke69 Keisuke69x
  3. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. u nt AWS Lambda s q e W S
  4. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. is k Lambda ” c • H X q H qc ww qw
  5. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. t t • q W q • CPU • q • W WH W H qc m a W W a H W W
  6. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Lambdah t nt 1. OENI P 2. 3. ” 4. ” 5. I 6. / • VPC • 10 30 • Duration q w
  7. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Lambdah t nt 1. OENI P 2. 3. ” 4. ” 5. I 6. / • e • S3 “ ZIP • Duration q w
  8. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Lambdah t nt 1. OENI P 2. 3. ” 4. ” 5. I 6. / • • • Duration q w
  9. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Lambdah t nt 1. OENI P 2. 3. ” 4. ” 5. I 6. / • e / • Duration q
  10. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Lambdah t nt 1. OENI P 2. 3. ” 4. ” 5. I 6. / W
  11. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Lambdah t nt 1. OENI P 2. 3. ” 4. ” 5. I 6. /
  12. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Lambdah t nt 1. OENI P 2. 3. ” 4. ” 5. I 6. / W
  13. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Lambdah t nt 1. OENI P 2. 3. ” 4. ” 5. I 6. / W O“ P
  14. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. b a S H W • c c 1 W • X W e • H e • H c w q X
  15. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. b a S H W • c c 1 W • X W e • H e • H c w q X W rH q m
  16. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. b a 0 q • c • L • c c H q X q w e X rHc AWS Lambdaq q wT H
  17. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. b a • T • TrAWS Lambda aHJVM q • e H w SW
  18. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. b a ” • W X sZip W • q • • ” q y • Javaq W • Java ProGuard m S • q
  19. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. b a VPCq • S qVPC mS W X • VPC 10 30 W X q • VPC W r • RDBMS W rDynamoDB Streams AWS Lambda
  20. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. b a Java q • POJO q S • JSON q W H JSON e – https://github.com/FasterXML/jackson-jr – http://docs.aws.amazon.com/lambda/latest/dg/java-handler-io-type- stream.html • S Java8 OlambdaH H mP
  21. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. b a W S import boto3 client = None def my_handler(event, context): global client if not client: client = boto3.client("s3") # process
  22. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Invoke w W • s H e H • s H e Te W wS • q X Invoke W q • c H • Amazon API Gateway x b HPUT AWS Lambda q H Amazon SQSHAmazon Kinesis m
  23. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. API Gateway is “ 41 / = E 5 2 : 5 0 4 5
  24. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. API Gateway is “ 41 / = E 5 2 : 5 0 4 5 Lambda s
  25. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Think Parallel • AWS Lambda q S 1 e b S • 1 Invoke b q H Lambda Invoke • Lambda W H
  26. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. A A A A (A ) = A= ) A = = F G
  27. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Limit Increase q1000H W X • Throttle mS • Throttle mq • m qH HSA Limit Increase W • H e e • c c W H q
  28. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. AWS LambdaFRDBMS AWS Lambda + RDBMSW • • AWS Lambdaq eyH q • AWS LambdaW H w W e H DBt W H T W • VPC • VPC W H 10 • Amazon DynamoDB S • RDBMS W qDynamoDB Streams AWS Lambda
  29. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. IP N Amazon API Gateway AWS Lambda API IP e m X • IP S q W AWS Lambda qVPC NAT S S q W… • VPC • NAT Hc H H W
  30. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. d r W H W10 1 • q W q • W eyH q W WH W mqc • H T W • S H I W W X S X q w S
  31. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Serverless != Monitorless q • H • CloudWatch OErrors, ThrottlesP • CloudWatch • CloudWatch Logst
  32. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. • • Dead Letter Queue O P q W • AWS Lambda q 1 1 q • Lambda W2 Ww • Amazon DynamoDB m S
  33. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Wrap-up AWS Lambda W • • • • • c d S q X w S
  34. © 2017, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. AWS Lambda u 2017 6 9 3,240 O P Amazon http://amzn.asia/ew2WWPm AWS Summit Expo H • w • “ Xw