I'm the author of the article.
The context for the post is really around distributed systems and specifically service oriented architectures (SOA). The solutions are usually used at larger software as a service (SaaS) providers where they have many backend services that are used to provide their service offering.
As an example, many SaaS providers have a way to login to their system. In a SOA, you might have an authentication service in the backend that handles login requests. It's fairly common to have a web layer in front of those backend services that actually serves up the login page and handles the login HTTP requests. That layer would delegate the login request to the authentication service. It may also delegate other functions to other services on the backend. Those backends might provide an HTTP based API or something else but it's commonly a service spread across multiple hosts.
Why can't you put a web service in front of everything?
You can and that's commonly done. The service discovery aspect comes in when trying to keep http://my-data-service.example.com
pointing to the right hosts when services are down, failing, being upgraded, scaled up, etc.
If my-data-service.example.com
is just a round-robin DNS entry, and you have three instances providing the service and one goes down, you'll have some failed requests while that host is brought back online. With DNS, you also have TTLs to consider so clients that have cached those entries will continue to try the downed host until the TTLs expire and it refreshes. If you are adding hosts, you'll have to wait for the TTLs to expire as well before it starts to service requests.
An alternative is to point my-data-service-example.com
to a load balancer or have your client applications implement some load balancing themselves.
This presents a new problem:
How do you keep the backend hosts configured in your load balancer up to date?
In an environment like AWS, hosts can be brought up and down frequently and their IPs can change. If you are using docker, IPs and ports are usually different when a new container is started. Trying to keep this configured manually is usually not possible in these kinds of environments... especially when you have multiple services and hundreds or thousands of hosts.
To keep a load balancer automatically up to date, you need some form of dynamic service discovery.
This usually entails having:
- A registry to keep track of what is up/down, it's locations, etc.,
- A registration process to register service locations when they are online
- A discovery process to discover services and keep routing information up to date.
The original article describes how different companies have implemented those components in different ways. There are many other ways to do it as well.
For a more concrete example, I wrote another post showing one way do service discovery with docker using etcd and haproxy. That might be helpful to understand the context of the article.