Can someone explain to me in simple terms what is the architectural concept of an Ambassador in cluster computing? What are the benefits of implementing it in a microservice architecture patterns?
I've been studying docker and docker-swarm lately and I've been seen this term mentioned repeatedly across articles or repos. For example in this amazing project, they have a repository called docker-ambasssador. Or this other project called ctlc-docker-ambassador.
One of the main benefits of Microservices in general is the ability to switch out underlying component pieces without the rest of the app/ecosystem having awareness of a change. The ambassador pattern allows for pieces to move and change while consuming code continues to connect to a single location. One of the links you provided had a great explanation/example:
Rather than hardcoding network links between a service consumer and provider, Docker encourages service portability, for example instead of:
(consumer) --> (redis) Requiring you to restart the consumer to attach it to a different redis service, you can add ambassadors:
(consumer) --> (redis-ambassador) --> (redis) Or
(consumer) --> (redis-ambassador) ---network---> (redis-ambassador) --> (redis) When you need to rewire your consumer to talk to a different Redis server, you can just restart the redis-ambassador container that the consumer is connected to.
In this instance the underlying component (redis) can be moved or updated without the code that uses redis knowing. It would even allow one to switch from redis to another kv store if the code were a bit more clever.