Cloud Design Pattern – Ambassador

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

  1. Legacy application which cannot implement such non-functional feature;
  2. Share non-functional feature in different application;

Implementation

There are some tools which can role as ambassador, some representives as below:

  1. Envoy
  2. 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:

  1. The Distributed System ToolKit: Patterns for Composite Containers, Kubernetes Blog
    https://kubernetes.io/blog/2015/06/the-distributed-system-toolkit-patterns/
  2. Ambassador pattern, Microsoft Learn
    https://learn.microsoft.com/en-us/azure/architecture/patterns/ambassador
About C.H. Ling 262 Articles
a .net / Java developer from Hong Kong and currently located in United Kingdom. Thanks for Google because it solve many technical problems so I build this blog as return. Besides coding and trying advance technology, hiking and traveling is other favorite to me, so I will write down something what I see and what I feel during it. Happy reading!!!

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.