A microservice is an architectural style with small services which are
- works on a single concern.
- Own their own data
- Lightweight communication usually with HTTP Restful API
- Built around business capabilities/domain, example below
- Independently deployable by automated means
- Right tech for right problem – each microservice can be implemented on its own tech
- Language independent as conform to HTTP Restful
- Individual team for each microservice
- Fault tolerance
- Container friendly (docker, kubernete)
- Fast iteration for adding code
- small development teams,
- shorter development cycles
- flexibility in language selection
- enhanced service scalability
- Complex interactions – System + Operational
- Overhead of communication across databases and servers
- Resource and nw overhead
- Complex authentication and authorization scheme in the Microservices
- Cross-cutting: microservices need not deal with details regarding problems outside their specific scope.
- Data sharing is hard. Microservices tend to favor per-service or per-group databases that can be updated directly.
- Availability: Microservices, by virtue of being isolated and independent, need to be monitored to detect failures.
- Evolution: Microservices tend to evolve fast. Old versions are usually available as long as there are clients who need to consume data from them. Newer versions are exposed in an application-specific way. For instance, with an HTTP/REST API, the version of the microservice may be part of a custom header, or be embedded in the returned data. Account for this.
- Automated deployment: The whole reason that microservices are so convenient nowadays is that it is so easy to deploy a new service from a completely clean environment.
- Interdependencies: Keep them to a minimum.
- Transport and data format: Microservices are fit for any transport and data format; however, they are usually exposed publicly through a RESTful API over HTTP. Any data format fit for your information works. HTTP + JSON is very popular these days, but there is nothing stopping you from using protocol-buffers over AMQP, for instance.
microservices are developed almost in isolation. Cross-cutting concerns are dealt with by upper layers in the software stack