Real World Microservices: When Services Stop Playing Well and Start Getting Real
Interesting article.  It was initially confusing to me because I wasn&#x27;t able to find what&#x27;s unique about this approach, and how it&#x27;s different from the typical Ambassador pattern that I&#x27;m more familiar with.  That is, what does the word &quot;Routing&quot; even mean in this context?<p>I think the answer is that he&#x27;s doing essentially layer-7 routing, using the HTTP path (and verb?) to decide what backends to route to, rather than doing it on a per-port basis (which is necessary to support non-HTTP services.)<p>Implementations I&#x27;ve run into before seem to fall into a few categories:<p>- A service declares that it needs to talk to, say, 3 other services.  Each of these upstream services is assigned a unique client-side port, and an ambassador proxy is launched alongside each instance, which exposes those 3 ports, routing each to the corresponding 3 backend services.  To keep the ports out of the source code, typically environment variables are automatically assigned, so you just talk to ie. &quot;my-ambassador:${UPSTREAM_PORT_NAME}&quot;<p>- A service is responsible for using a service discovery layer like zookeeper or etcd to find backends on its own.  This is important for things that use raft&#x2F;paxos&#x2F;gossip, where blind routing isn&#x27;t enough, you actually need to keep track of peer instances (although in that case, the service discovery layer is only used for initial discovery).<p>- Service discovery is done with just plain DNS on well-known ports (or even SRV records if you&#x27;re lucky enough to have client software that can tolerate them), and you just hope the right thing happens.  This can be accomplished with things like SkyDNS on top of etcd... a surprising amount of flexibility can be accomplished by putting logical things right in a hostname.<p>This approach seems to be like a more opinionated version of the first approach, but instead of ports, it uses HTTP routes, which is definitely more flexible, but only works with HTTP.  The routes can contain enough information to route more intelligently than just enumerating your dependency services ahead of time and getting static port assignments.<p>It&#x27;s almost like an API gateway distributed as an ambassador to each service.  At least, it looks a lot <i>like</i> an API gateway, in that it presents the whole mesh of services underneath in a single URI namespace, using HTTP to route requests accordingly and handling things like TLS and potentially authentication.  It&#x27;s definitely an interesting approach, and something I&#x27;m curious to try.