TODO finish and refine this page
Run small services that do one thing well.
It is the services equivalent of the 50 year battle-test unix core utils philosophy.
These services communicate with each other via APIs, typically simple HTTPS Rest APIs.
However, while these smaller distributed services reduce monolithic code complexity by decoupling as much as possible, they introduce infrastructure complexity compared to monoliths.
The code of each service may be much simpler, but they simply shift the complexity to the infrastructure, high availability and especially monitoring and tracing what happens to requests as they traverse the many components through the stack.
- run smaller services
- smaller footprint per service
- results in more services, more stacks
- easy to create + move independently by relying on standard TCP/IP networking
- scales more easily as individual components
- lower code complexity by splitting functionality
- higher infrastructure complexity
- especially monitoring & tracing
- Orchestration
- Configuration Management
- Data Persistence
- Monitoring
- Logging
- Tracing
Commonly used technologies in microservices stacks:
- Docker
- Kubernetes
- Consul
- Coordination & Discovery system used to find other service dependencies
- Key-Value store used to store both config and templates, as single source of truth
- ELK stack (logging)
- Cloud services
- Ansible (orchestration) - old - usually only used for VMs and not for modern containerized technologies
- immutable services where possible
- abstract out storage to specialist data services like RBDMS or NoSQL avoid state maintenance on apps
- even Kubernetes components and Mesos masters run as Docker containers
- service discovery (eg. Consul of Kubernetes internal DNS)
- standardize containers or AWS AMIs for lower maintenance
- CI/CD to manage deployments
- logging - all services should log to json
- Cloud logging services:
- AWS CloudWatch Logs
- GCP Cloud Logging
- Azure Monitor Logs
- ELK stack:
- LogStash => Elasticsearch => Kibana
- all services should log to json
- this avoids other services writing logs locally and allows for read-only filesystem immutable Docker containers
- Traffic routing via NginX + PowerDNS, backed by Consul
- Registrator service, hooks in to Dockerdaemon and tells Consul when other services come alive or die
- Docker mounts a directory with the config from Consul
- 11 months from idea to production, bleeding edge but getting better
- Developers can self-provision QA, key part of the process, DevOps only maintain the infrastructure