- The server receives a HTTP request
- Send the requests to RabbitMQ exchange (Persistent, Fanout)
- The exchange replicates the requests into three queues
nameq, logq, accq
- The workers dequeues the requests from the corresponding queue
- All the workers are scalable horizontally and the requests are distributed in round robin fashion
- Fault Tolerance is guaranteeed by using the ACK/ NACK mechanism in rabbitmq queues. The request is removed from the queue only when it receives a ACK from the worker
- Distributed locks are maintained as a key in Redis (WATCH and SET mechanism)
Install RabbitMQ, PostgreSQL, Redis, MongoDB and start the servers
godep get github.com/arvindram03/asynch-workers/account_aggregator
go run account_aggregator.go
godep get github.com/arvindram03/asynch-workers/event_aggregator
go run event_aggregator.go
godep get github.com/arvindram03/asynch-workers/log_aggregator
go run log_aggregator.go
godep get github.com/arvindram03/asynch-workers
go run main.go
and open http://localhost:6055/
Post the metric concurrently to the following url http://localhost:6055/metric
{ "username": "kodingbot", "count": 10, "metric": "byte_call" }