Skip to content

Instantly share code, notes, and snippets.

@igor47
Created October 31, 2013 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igor47/7256216 to your computer and use it in GitHub Desktop.
Save igor47/7256216 to your computer and use it in GitHub Desktop.
services guide from airbnb

Smart Stack

We connect our REST services together using smartstack. Smartstack is mainly the combination of nerve and synapse. Nerve lets your service be discovered by other services, and synapse lets you discover services you yourself need.

Resources

In order to play well with smartstack, you need to define two special resources in your service. Both should return Content-type: text/plain.

/health

The check-check endpoint should return status code 200 and body OK. It should only do this if the service is actually healthy.

A service is NOT healthy unless it can talk to its data stores and perform most of its API functions. Your health check should strive to be as comprehensive as possible.

A nerve process running locally on your node will periodically (usually every 1-5 seconds) hit /health. If the check fails (returns anything other than 200) that service instance will be de-registered and undiscoverable until the health check recovers.

/ping

This endpoint should always just return status 200 and body PONG. Synapse, running throughout the infrastructure on any machine which requires your service, will hit this endpoint every 30-60 seconds. Because the number of machines may be large, you should strive to make the /ping check as lightweight as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment