Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Jakub Wójciak with Tim Bray
07/13/2017
Decouple ...
Modern Apps
Compute Database
Messaging
Modern Apps
Compute Database
Messaging
Message
JSON Message
{
"bookingId": "456ab773-dccb-4bc9-87b7-322ff5c29eab",
"bookingNumber": "CDG-64453",
"locationId": "563890",
...
XML Message
<booking>
<bookingId>456ab773-dccb-4bc9-87b7-322ff5c29eab</bookingId>
<bookingNumber>CDG-64453</bookingNumber>...
Payload and Attributes
 Key/value pairs
 With business meaning:
 CustomerId=6445
 MessageType=NewBooking
 With techni...
Queues
Amazon Simple Queue Service (Amazon SQS):
Standard Queue
4
3
3
5
2
1
Amazon Simple Queue Service (Amazon SQS):
Standard Queue
4
3
3
5
2
1
Amazon Simple Queue Service (Amazon SQS):
Standard Queue
4
3
3
5
2
1
Amazon Simple Queue Service (Amazon SQS):
Standard Queue
4
3
3
5
2
1
Amazon Simple Queue Service (Amazon SQS):
FIFO Queue
4
C
3
B
2 1
A
IV III II I
Pub/Sub Messaging
Amazon Simple Notification Service
(Amazon SNS)
Publisher
Lambda
SQS
HTTP
Subscriber
SNS Topic
Streams
Amazon Kinesis
Service to Service Communication
Internet Load balancer Web servers
Service to Service Communication
Internet Load balancer Load balancerWeb servers Booking service
Service to Service Communication
Internet Load balancer Load balancerWeb servers Booking service Database
Capacity Imbalance
Internet Load balancer Load balancerWeb servers Booking service Database
Overload
Internet Load balancer Load balancerWeb servers Booking service Database
Queue as a Safe and Fast Buffer
Internet Load balancer Booking queueWeb servers Booking service Database
Demo
Improving Synchronous Latency
Booking takes up to 3 seconds, it’s too slow!
Improving Synchronous Latency
Booking takes up to 3 seconds, it’s too slow!
Let’s break it down:
Change status in database...
Use Background Thread
Synchronous:
Background thread:
Change status in database 30 ms
Notify external booking supplier 800...
Use Background Thread
Synchronous:
Background thread:
Work can get lost!
Change status in database 30 ms
Notify external b...
Safe Asynchronous Tasks
Synchronous:
Background poller:
Change status in database 30 ms
Store task in queue 10 ms
Get next...
Private Task Queues
Task queuesBooking service
Shared Task Queue
Task queueBooking service
Microservices
Booking service
Email notification service
External partner integration service
Financial ledger queue
Payme...
Notify Everyone!
Booking service
Email notification service
External partner integration service
Financial ledger queue
Pa...
Notify Everyone!
Booking service
Email notification service
External partner integration service
Financial ledger queue
Pa...
Decouple by Publishing Event through SNS
Booking service Booking topic
Email notification service
External partner integra...
Decouple by Publishing Event through SNS
Booking service Booking topic
Email notification service
External partner integra...
Decouple by Publishing Event through SNS
Booking service Booking topic
Email notification service
External partner integra...
There’s more! Queues in SQS
Long polling:
instant push
deliveries of
messages
There’s more! Queues in SQS
Long polling:
instant push
deliveries of
messages
Server side
encryption
There’s more! Queues in SQS
Long polling:
instant push
deliveries of
messages
Server side
encryption
Dead letter
queues
There’s more! Queues in SQS
Long polling:
instant push
deliveries of
messages
Server side
encryption
Dead letter
queues
Ea...
There’s more! Queues in SQS
Long polling:
instant push
deliveries of
messages
Server side
encryption
Dead letter
queues
Ea...
There’s more! Pub/Sub messaging in SNS
Multiple
transports
There’s more! Pub/Sub messaging in SNS
Multiple
transports
Customizable
delivery retries for
HTTP
There’s more! Pub/Sub messaging in SNS
Multiple
transports
Customizable
delivery retries for
HTTP
Failure
notifications
There’s more! Pub/Sub messaging in SNS
Multiple
transports
Customizable
delivery retries for
HTTP
Failure
notifications
Ea...
There’s more! Pub/Sub messaging in SNS
Multiple
transports
Customizable
delivery retries for
HTTP
Failure
notifications
Ea...
Enterprises using Amazon SQS and SNS
BMW
Johnson &
Johnson Nordstrom
For more information
www.aws.amazon.com/sqs
www.aws.amazon.com/sns
Thank you!
Upcoming SlideShare
Loading in …5
×

Decouple and Scale Applications Using Amazon SQS and Amazon SNS - July 2017 AWS Online Tech Talks

2,388 views

Published on

Learning Objectives:
- Understand key messaging use cases, including service-to-service communication, asynchronous work item backlog, and state change notifications
- Learn how to get started using message queues and topics with just a few simple APIs, and quickly integrate with other AWS services
- Hear how customers, like Capital One, are benefiting from migrating applications to a fully managed messaging solution in the cloud

Small startups to the biggest global enterprises are designing applications using microservices and distributed architecture to improve resiliency and scale faster. AWS messaging services and Amazon Simple Queue Service (SQS) and Amazon Simple Notification Service (SNS) and make it easy to decouple communication between software components and build modern applications that are fault-tolerant and easy to scale. Messaging is a key part of Amazon’s own e-commerce platform architecture, and used in mission-critical backend systems such as Amazon Retail Ordering workflow. In this session, we will show how you can use Amazon SQS and Amazon SNS fully managed messaging to decouple your application architecture, enable asynchronous communication between different services, and eliminate the pain associated with operating dedicated messaging software and infrastructure. We will demonstrate common messaging design patterns for building reliable and scalable applications in the cloud.

Published in: Technology

Decouple and Scale Applications Using Amazon SQS and Amazon SNS - July 2017 AWS Online Tech Talks

  1. 1. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Jakub Wójciak with Tim Bray 07/13/2017 Decouple and Scale Applications Using Amazon SQS and Amazon SNS
  2. 2. Modern Apps Compute Database Messaging
  3. 3. Modern Apps Compute Database Messaging
  4. 4. Message
  5. 5. JSON Message { "bookingId": "456ab773-dccb-4bc9-87b7-322ff5c29eab", "bookingNumber": "CDG-64453", "locationId": "563890", "customer": { "id": "8943", "email": "jacque@gmail.com" }, "stayStart": "2017-09-04", "stayEnd": "2017-09-06", "price": { "amount": "67.80", "currency": "EUR" } }
  6. 6. XML Message <booking> <bookingId>456ab773-dccb-4bc9-87b7-322ff5c29eab</bookingId> <bookingNumber>CDG-64453</bookingNumber> <locationId>563890</locationId> <customer> <id>8943</id> <email>jacque@gmail.com</email> </customer> <stayStart>2017-09-04</stayStart> <stayEnd>2017-09-06</stayEnd> <price> <amount>67.80</amount> <currency>EUR</currency> </price> </booking>
  7. 7. Payload and Attributes  Key/value pairs  With business meaning:  CustomerId=6445  MessageType=NewBooking  With technical meaning:  SourceHost=ip-12-34-56-78.us-west-2.compute.internal  ProgramName=WebServer-PID:9989
  8. 8. Queues
  9. 9. Amazon Simple Queue Service (Amazon SQS): Standard Queue 4 3 3 5 2 1
  10. 10. Amazon Simple Queue Service (Amazon SQS): Standard Queue 4 3 3 5 2 1
  11. 11. Amazon Simple Queue Service (Amazon SQS): Standard Queue 4 3 3 5 2 1
  12. 12. Amazon Simple Queue Service (Amazon SQS): Standard Queue 4 3 3 5 2 1
  13. 13. Amazon Simple Queue Service (Amazon SQS): FIFO Queue 4 C 3 B 2 1 A IV III II I
  14. 14. Pub/Sub Messaging
  15. 15. Amazon Simple Notification Service (Amazon SNS) Publisher Lambda SQS HTTP Subscriber SNS Topic
  16. 16. Streams
  17. 17. Amazon Kinesis
  18. 18. Service to Service Communication Internet Load balancer Web servers
  19. 19. Service to Service Communication Internet Load balancer Load balancerWeb servers Booking service
  20. 20. Service to Service Communication Internet Load balancer Load balancerWeb servers Booking service Database
  21. 21. Capacity Imbalance Internet Load balancer Load balancerWeb servers Booking service Database
  22. 22. Overload Internet Load balancer Load balancerWeb servers Booking service Database
  23. 23. Queue as a Safe and Fast Buffer Internet Load balancer Booking queueWeb servers Booking service Database
  24. 24. Demo
  25. 25. Improving Synchronous Latency Booking takes up to 3 seconds, it’s too slow!
  26. 26. Improving Synchronous Latency Booking takes up to 3 seconds, it’s too slow! Let’s break it down: Change status in database 30 ms Notify external booking supplier 800 ms Prepare a PDF invoice 900 ms Send a confirmation e-mail with large PDF 500 ms
  27. 27. Use Background Thread Synchronous: Background thread: Change status in database 30 ms Notify external booking supplier 800 ms Prepare a PDF invoice 900 ms Send a confirmation e-mail with large PDF 500 ms
  28. 28. Use Background Thread Synchronous: Background thread: Work can get lost! Change status in database 30 ms Notify external booking supplier 800 ms Prepare a PDF invoice 900 ms Send a confirmation e-mail with large PDF 500 ms
  29. 29. Safe Asynchronous Tasks Synchronous: Background poller: Change status in database 30 ms Store task in queue 10 ms Get next task from queue 10 ms Notify external booking supplier 800 ms Prepare a PDF invoice 900 ms Send a confirmation e-mail with large PDF 500 ms Delete task from queue 10 ms
  30. 30. Private Task Queues Task queuesBooking service
  31. 31. Shared Task Queue Task queueBooking service
  32. 32. Microservices Booking service Email notification service External partner integration service Financial ledger queue Payment processing service
  33. 33. Notify Everyone! Booking service Email notification service External partner integration service Financial ledger queue Payment processing service New booking completed!
  34. 34. Notify Everyone! Booking service Email notification service External partner integration service Financial ledger queue Payment processing service New booking completed!
  35. 35. Decouple by Publishing Event through SNS Booking service Booking topic Email notification service External partner integration service Financial ledger queue Payment processing service
  36. 36. Decouple by Publishing Event through SNS Booking service Booking topic Email notification service External partner integration service Financial ledger queue Payment processing service New booking completed!
  37. 37. Decouple by Publishing Event through SNS Booking service Booking topic Email notification service External partner integration service Financial ledger queue Payment processing service
  38. 38. There’s more! Queues in SQS Long polling: instant push deliveries of messages
  39. 39. There’s more! Queues in SQS Long polling: instant push deliveries of messages Server side encryption
  40. 40. There’s more! Queues in SQS Long polling: instant push deliveries of messages Server side encryption Dead letter queues
  41. 41. There’s more! Queues in SQS Long polling: instant push deliveries of messages Server side encryption Dead letter queues Easy monitoring with CloudWatch, with alarming
  42. 42. There’s more! Queues in SQS Long polling: instant push deliveries of messages Server side encryption Dead letter queues Easy monitoring with CloudWatch, with alarming Integrated with other AWS services as a destination
  43. 43. There’s more! Pub/Sub messaging in SNS Multiple transports
  44. 44. There’s more! Pub/Sub messaging in SNS Multiple transports Customizable delivery retries for HTTP
  45. 45. There’s more! Pub/Sub messaging in SNS Multiple transports Customizable delivery retries for HTTP Failure notifications
  46. 46. There’s more! Pub/Sub messaging in SNS Multiple transports Customizable delivery retries for HTTP Failure notifications Easy monitoring with CloudWatch, with alarming
  47. 47. There’s more! Pub/Sub messaging in SNS Multiple transports Customizable delivery retries for HTTP Failure notifications Easy monitoring with CloudWatch, with alarming Integrated with other AWS services as a destination
  48. 48. Enterprises using Amazon SQS and SNS BMW Johnson & Johnson Nordstrom
  49. 49. For more information www.aws.amazon.com/sqs www.aws.amazon.com/sns
  50. 50. Thank you!

×