This repo contains the various materials used as part of the "Reliability Nirvana" presentation.
Contents:
./svc- idempotent sample service./example1- bare-bones sample producer & consumer./docker-compose.yaml- rabbitmq, etcd and statsd + graphite (for demo visualization)docker-compose.yaml up -d- to bring up all- or
docker-compose up -d $specific-dependency
./assets- config files for graphite, screenshots for this repo
Once docker-compose is finished, you should be able to view the graphite UI by pointing
your browser at http://localhost:80 and see something like this:
The orders and notify services will emit the following metrics:
$service_new_order_ok- Emitted by service when an event is processed successfully
$service_new_order_skipped- Emitted by service when an event is skipped
These metrics can be found under the path: Metrics/stats_counts/$service_new_order_*
- Bring up dependencies
docker-compose up -d
- Verify dependencies are up
- Bing up services
cd svc && SERVICE_NAME=order go run *.go- In another terminal:
cd svc && SERVICE_NAME=notify go run *.go
- Publish an event
plumber write rabbit --exchange-name events --input '{"type":"new_order","id":"123"}' --routing-key=foo
- Observe services consume the event
orders_new_order_okmetric will increase in Graphite UI (http://localhost:80)notify_new_order_okmetric will increase
- Bring down
notifyservice (viactrl-c) - Publish another event
- Observe service
ordersconsume the eventorders_new_order_okmetric will increasenotify_new_order_okmetric will not increase
- Bring up "notify" service
cd svc && SERVICE_NAME=notify go run *.go
- See it consume the event
notify_new_order_okmetric will increase on its own
- Publish several events via
plumber ordersandnotifyservices will both consume and process the messages each timeorders_processedandnotifications_sentmetrics will increase...- ^ But this is incorrect - it's the same event - we shouldn't be processing duplicate events
- Enable etcd usage by restarting services and setting an ENV var:
cd svc && ENABLE_ETCD=true SERVICE_NAME=orders go run *.gocd svc && ENABLE_ETCD=true SERVICE_NAME=notify go run *.go
- Publish a single event
- Watch services consume the event
orders_new_order_ok¬ify_new_order_okwill increase
- Publish an event once more
- Both services will skip the event because the message id has been seen
orders_new_order_skipped¬ify_new_order_skippedmetrics will be populated
- Restart the services and re-emit events
- Services will instantly skip the message (due to initial cache import)
