Dormeto

Docs

Waking

An asleep workload’s first request wakes it: the waker answers, the backends start, the route comes back.

4 min read

A request wakes the workload unless a filter, a rule or the wake mode keeps it. Each timeline replays one wake.

Amazon Web ServicesAWS

Elapsed

  1. your load balancerthe wakerA visitor’s request reaches the waker. It passes the filters and wins the wake: the state turns waking.
  2. the wakerthe controllerThe waker invokes the controller, then holds the request, up to 60 s.
  3. the controlleryour instancesThe controller starts the instances, after the workload’s databases.
  4. the controlleryour load balancerA target is healthy, read every 3 s. The controller switches your rules back: the workload is awake.
  5. the controllerthe manager’s busThe router puts the change and the wake’s duration on the manager’s bus.
  6. the wakerAfter 15 s more, the waker answers the held request with a 307 to the same URL.
  7. your load balanceryour instancesThe browser follows it, and your application answers.
The first answer, at 38 s, is within an EC2 instance’s measured wake: 35 to 42 s. The healthy target’s second is an example.

Google Cloud

Elapsed

  1. your load balancerthe wakerA visitor’s request gets the waiting page at once: the error response fetches it from the waker.
  2. your load balancerthe wakerThe page’s probe asks the waker for the wake: the state turns waking.
  3. the wakerthe controllerA Cloud Tasks task carries the wake to the controller.
  4. the controlleryour VMsThe controller resumes or starts the VMs, after the Cloud SQL companions.
  5. the controlleryour URL mapA VM is healthy, read every 2 s: the workload is awake. The controller removes the error response.
  6. the controllerthe manager’s busThe router puts the change and the wake’s duration on the manager’s bus.
  7. your load balanceryour VMsThe page reloads by itself, and your application answers.
Behind a global load balancer. Its seconds are an example: a wake’s time depends on your VMs and their health check.

The steps

  1. The waker lets the first request past the filters win the wake; the others wait for it.
  2. The waker asks the controller for the wake, and answers the visitor.
  3. The controller starts the databases and waits for them, then starts the application’s backends.
  4. The controller reads the backends’ health until one is healthy: one is enough.
  5. The controller gives the load balancer its route to the application back.
  6. Awake, the router reports the change and the wake’s duration to the manager.
  7. A wake that outlasts its Wake timeout fails, and says why.

Amazon Web ServicesAWS

  • The waker invokes the controller, then holds the request for the Hold.
  • Others get the waiting page, a 503 with Retry-After: 3; it reloads by itself.
  • The controller reads the target group’s health every 3 s, then switches your rules back.
  • 15 s after the switch, a held request gets a 307 to its URL.

Google Cloud

  • The waker holds nothing: the visitor gets the waiting page at once. Behind a global load balancer, the page’s probe wakes the workload.
  • The wake reaches the controller through a Cloud Tasks queue.
  • The controller reads the backend service’s health every 2 s.
  • Behind a global load balancer, the controller then removes the nap’s error response. Behind the others, it swaps the map back and waits first.

The URL map’s wait Google Cloud only

A nap and a wake change your URL map, then wait for the load balancer to see it.

  • global: 5 minutes at a nap, for the error response; none at a wake.
  • regional: 100 s.
  • classic: 250 s.
  • internal: 30 s.
  • cross-region-internal: 150 s.

Behind a swap, the wake’s wait counts in its time: the Wake timeout’s floor holds it.

Parts and permissions

Each part calls with its own role, which Roles lists.

ComponentAWSGoogle CloudWhat it does
The wakerAWS LambdaLambda, as the waker roleCloud RunCloud Run, as the router’s accountAnswers the visitor, asks for the wake.
The wake’s wayAWS LambdaAn invoke of the controllerCloud TasksA Cloud Tasks queueCarries the wake to the controller.
The controllerAWS LambdaLambda, as the controller roleCloud RunCloud Run, as dormetoRouterStarts the backends, reads their health, gives the route back.
Your backendsTagged dormeto:workloadTagged dormeto=managed, as dormetoRouterBackendsStarted, resumed or scaled back.
Their healthElastic Load BalancingThe target group’s health checksCloud Load BalancingThe backend service’s health checksSays when a backend serves.
The managerAmazon EventBridgeIts event busAmazon EventBridgeIts event bus, with credentials from its APITakes each change of state (Architecture).

What can go wrong

  • Bots, HEAD requests, scanners and No-wake rules never wake it: they get the waiting page.
  • A failed wake says why on the workload’s page and the waiting page: Workloads.
  • A start refused for capacity is tried again, then on the fallback types: Router.
  • A nap window holds wakes off: Scheduler.