Ambassador is one of the Separation of Concern (SoC) implementation. In cloud platform, functional features (e.g. Business logic) and non-functional features (e.g. retry / queue / etc) are implement in multi-containers: main application and proxy.
Problem
Most microservices might require non-functional feature such as queueing and retry, but it will become complicate when number of microservices increase and changes.
Also, some of the application might cannot be change (e.g. legacy / source code missing / external application) so it cannot be add these non-functional feature in application itself.
Solution
Setup the Ambassador proxy to handle non-functional feature, main applications are require to get request / send response via Ambassador.
Use Case
- Legacy application which cannot implement such non-functional feature;
- Share non-functional feature in different application;
Implementation
There are some tools which can role as ambassador, some representives as below:
- Envoy
- Nginx
Consideration
Compare with Sidecar
Sidecar is for each microservices and Ambassador can for group of microservices. As result, it is complex on manage each sidecar. For example, using Istio to centralize mange Envoy for each sidecar.
Compare with Adaptor
Adaptor is transform request / response between microservices and caller. Majorly it is for legacy application but it do not provide additional non-functional feature.
Reference:
- The Distributed System ToolKit: Patterns for Composite Containers, Kubernetes Blog
https://kubernetes.io/blog/2015/06/the-distributed-system-toolkit-patterns/ - Ambassador pattern, Microsoft Learn
https://learn.microsoft.com/en-us/azure/architecture/patterns/ambassador
Leave a Reply