14 Decoupling your infrastructure: Elastic Load Balancing and Simple Queue Service

 

This chapter covers

  • The reasons for decoupling a system
  • Synchronous decoupling with load balancers to distribute requests
  • Hiding your backend from users and message producers
  • Asynchronous decoupling with message queues to buffer message peaks

Imagine that you want some advice from us about using AWS, and therefore, we plan to meet in a café. To make this meeting successful, we must:

  • Be available at the same time
  • Be at the same place
  • Find each other at the café

The problem with making our meeting happing is that it’s tightly coupled to a location. We live in Germany; you probably don’t. We can solve that problem by decoupling our meeting from the location. So, we change plans and schedule a Google Hangout session. Now we must:

  • Be available at the same time
  • Find each other in Google Hangouts

Google Hangouts (and other video/voice chat services) does synchronous decoupling. It removes the need to be at the same place, while still requiring us to meet at the same time.

We can even decouple from time by using email. Now we must:

  • Find each other via email

Email does asynchronous decoupling. You can send an email when the recipient is asleep, and they can respond later when they’re awake.

14.1 Synchronous decoupling with load balancers

14.1.1 Setting up a load balancer with virtual machines

14.2 Asynchronous decoupling with message queues

14.2.1 Turning a synchronous process into an asynchronous one

14.2.2 Architecture of the URL2PNG application

14.2.3 Setting up a message queue