[awsマイスターシリーズ] amazon sqs / sns

61
© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. AWS マイスターシリーズ Amazon SQS / SNS アマゾン データサービス ジャパン株式会社 ソリューションアーキテクト 橋 徹平 篠原 英治 崎 健治 re:Generate

Upload: amazon-web-services-japan

Post on 26-Jan-2015

142 views

Category:

Technology


0 download

DESCRIPTION

 

TRANSCRIPT

  • 1. re:G ene AWS Amazon SQS / SNSrate 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

2. Agenda ! Amazon SQS SQS SQS! Amazon SNS SNS SNS Mobile Push! SQS/SNS ! ! Appendix2 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 3. ! 3 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 4. Introduction ! by Randy Shoup (eBay) ! 4 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 5. Amazon SQS5 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 6. Amazon SQS (Simple Queue Service) ! ! Queue6 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 7. SQS ! 1 20ms7 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 8. SQS ! 8 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 9. SQS ! 9 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 10. SQS ! 10 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 11. SQS ! 11 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 12. SQS ! 12 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 13. SQS ! 30 Visibility Timeout Inflight Visibility Timeout 13 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 14. SQS ! 14 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 15. SQS ! 30 1 15 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 16. SQS ! A B C 16 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 17. SQS ! A C B 17 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 18. SQS ! C A B 18 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 19. SQS ! 110 x 10 x 10 x 10 19 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 20. SQS ! 110 x 10 x 10 x 10 20 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 21. ! ! ! ! ! SQS ! 4 6014 ! 120,000Inight 120,000OverLimit ! 256KB ! 21 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 22. SQS ! 1 2 ! 22 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 23. SQS23 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 24. SQS Long Polling ! ReceiveMessage 1 ! ! ReceiveMessageWaitTimeSeconds Polling 02024 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 25. Long PollingShort Polling ! Long Polling Polling Polling Polling ! Short Polling RecieveMessage Long Polling PollingPolling 25 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 26. SQS Delay Queue ! 0900 Visibility Timeout26 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 27. SQS Message Timers ! 0 Message TimersDelay Queue Send Message Request Message Timers 60 Delay Queue 30 27 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 28. SQS Dead Letter Queue ! Dead Letter Queue Dead Letter Queue Dead Letter Queue28 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 29. SQS Batch API actions ! 110 SendMessageBatch DeleteMessageBatch ChangeMessageVisibilityBatch! 1256KB SendMessageBatch 256KB29 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 30. Client-side BueringRequest Batching ! Client-side AmazonSQSBueredAsyncClient! SendMessage DeleteMessage ChangeMessageVisibility! 10 ! BatchSQS 30 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 31. SQS ! SQS ! Batch API110 AWSSDK for Java50 MaxConnectionsAmazonSQS sqsClient = new AmazonSQSClient(credentials, new ClientConfiguration().withMaxConnections( producerCount + cousumerCount));31 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 32. SQS ! JSON { "Version":"2012-11-05", "Id":"cd3ad3d9-2776-4ef1-a904-4c229d1642ee", "Statement" : [ { "Sid":"1", "Effect":"Allow", "Principal" : { "aws": "111122223333" }, "Action":["sqs:SendMessage","sqs:ReceiveMessage"], "Resource": "arn:aws:sqs:us-east-1:444455556666:queue2", "Condition" : { "IpAddress" : { "aws:SourceIp":"10.52.176.0/24" }, "DateLessThan" : { "aws:CurrentTime":"2009-06-30T12:00Z" } } } ] AWS SendMessage AWS EC2 32} 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 33. Amazon CloudWatchSQS ! NumberOfMessageSentSentMessageSizeNumberOfMessageReceivedReceiveMessageNumberOfEmptyReceivesReceiveMessageNumberOfMessagesDeletedApproximateNumberOfMessage DelayedDelay Delay QueueDelay ApproximateNumberOfMessage VisibleApproximateNumberOfMessage NotVisible visibility winodwend33 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 34. SQS Best Practice(1) ! 1 10! ! Long Polling 1 2034 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 35. SQS Best Practice(2) ! SQS1! SQS! Polling supervisordpolling 35 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 36. SQS ! ID ID URI! S3SQS 36 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 37. SQS ! 100 ! SQS1000.50 USD 10.0000005 USD ! 0 USD 371GB/ 0 USD 10TB / 0.201 USD GB 40TB /0.158 USD GB 100TB /0.137 USD GB 350TB /0.127 USD GB 350TB SQSEC2 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 38. Amazon SNS38 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 39. Simple Notication Service ! ! ! 2. 1.Topic HTTP(S) Amazon SNS EMAILPublish PublisherTopicSQSMobile Push Subscriber39 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 40. Amazon SNS ! : 100 Email/Email-JSON: 1,000 HTTP/HTTPS: 100,000 Simple Queue ServiceSQS: : 1000.5 USD Email/Email-JSON: 100,0002 USD HTTP/HTTPS: 1000.6 USD Simple Queue ServiceSQS: 0 USD ! SNS(64 KB 1 )! 1GB/ 0 USD 10TB / 0.201 USD GB 40TB /0.158 USD GB 100TB /0.137 USD GB 350TB /0.127 USD GB 350TB SNSEC240 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 41. Amazon SNS ! AWS CloudWatchSESBounce/ComplaintElastic Transcoder/AutoScalingAutoScaling GroupCloudTrail41 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 42. SNS ! 1. Topic ! 2. TopicSubscribe ! 3. TopicPublish! 4. CloudWatch42 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 43. 1. Topic ! Topic Amazon Resource Name(ARN) 43 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 44. 2. TopicSubscribe ! : HTTP(S), Email, SQS, Application! EndpointConrm44 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 45. 3. TopicPublish ! Topicpublish! Email45 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 46. 4. CloudWatch ! AlarmAction46 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 47. 4. CloudWatch ! AlarmEmail47 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 48. Mobile Push (20138) ! PUSH ! Apple DevicesGoogle Devices Amazon SNS Mobile PushAmazon Kindle Fire Devices48 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 49. Mobile Push (20138) ! Amazon SNS http://aws.amazon.com/jp/aws-jp-introduction/49 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 50. SQS/SNS50 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 51. Work ! E PDFAmazon SQS Amazon SNS51 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 52. So-net ! ! ! ! 110GB3.65TB 15TBS3EMR SQS+S3+EMR50 ! 50%52 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 53. ! ! DB ! SQS S3 DynamoDB RDS53 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 54. SQS 54 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 55. DB DataAmazon SQS Queue SQS DBAmazon EC2DB DB55DynamoDB MySQL DB InstanceAmazon RDS 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 56. ! Push Amazon SQS Amazon SNS 56AWS Cloud DynamoDB 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 57. 57 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 58. SQS/SNS ! SQS SQS SQS1 SQS ! SNS 58 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 59. Link ! Amazon SQS Document http://aws.amazon.com/jp/documentation/sqs/! EAI Pattern http://www.eaipatterns.com/! Amazon SNS Document http://aws.amazon.com/jp/documentation/sns/! Amazon SNS Mobile Push http://www.slideshare.net/AmazonWebServicesJapan/ 20130917-aws- meisterregenerateextrasnsmobilepushpublic59 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 60. Appendix60 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc. 61. SQS AWS SDK for Java ! AmazonSQSClient AmazonSQS sqs = new AmazonSQSClient(new PropertiesCredentials(xxx)); sqs.setEndpoint("http://sqs.ap-northeast-1.amazonaws.com");! sqs.sendMessage(new SendMessageRequest(myQueueUrl, "This is my message text."));! List messages = sqs.receiveMessage(new ReceiveMessageRequest(myQueueUrl)).getMessages();61 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.