I'm trying to wrap my head around this article on OSS service discovery and I'm having a tough time seeing the forest through the trees.In that article, the author poses the main problem for service discovery:The problem seems simple at first: How do clients determine the IP and port for a service that exist on multiple hosts?But I'm not even sure what this means/implies. When talking about service discovery, what exactly are we talking about here? Is this like, if we want to connect to a database, we might need a host and port number defined somewhere, like:host=mydatabase01.example.comport=9300??? Is this what the author is talking about, and is what is implied by service discovery?If so, wouldn't the (obvious) solution be to just put a web service in front of everything? That way, clients don't care about what specific host/port they're connecting to, they just make RESTful calls to, say, http://my-data-service.example.com.It can't be this simple, as that article goes on to talk about things like ZooKeeper and Eureka, which seem to be very complex beasts. I'm clearly missing something; if so, can someone provide a specific, concrete use case of what is meant when we talk about service discovery?
Open Source Service Discovery
web services
This article is discussing distributed services. A popular example is a peer-to-peer (P2P) file sharing network. Nodes connect to a swarm to share data and may drop out at any time.The article discusses several open-source registries which allow clients to connect to the network and announce their presence so they may use the services on the network. Potentially, depending on the application, the client itself may become a network resource as well. In this context, network means a finite number of client systems that are communicating. They may be on different physical networks: this is similar to a P2P distributed system. They may on the same physical network: this is similar to a corporate intranet.How do these clients know about each other? If I sit at my desk and say I would really like to print to printer X, or share files with computer Y how do I get from staring at my cup of coffee to actually performing those actions? In a traditional corporate environment there will be network domain servers that handle this. Maybe MIS tells me an IP address. But what if those systems are not on a corporate or home network? Somewhere out there, in the ephemeral Internet, is a computer to which I want to connect. This is the problem the author is trying to solve: how do I find and connect to those clients?Service discovery may occur in one of several ways, and this is by no means an exhaustive list. Each protocol is different, and new protocols are invented on a regular basis (check the ACM Digital Library if it is available to you, there is a lot of info on this in there)Rely on a central server to manage connections and disconnections. This is similar to a P2P tracker file or Kerberos, and is close to the example you provided in the question.Broadcast on a subnet looking at a specific port. If you use SMB or CIFS for home file sharing, it is similar to this.Preconfigure other client IP addresses to talk to. Those clients may give you other clients that they are attached to.Rely on another protocol such as DNS to provide IP addresses.Once connected to such a network, there is a wealth of follow-on questions that are beyond the scope of this question, but if you find this interesting, you might want to dig into. Check out distributed computing.ReferencesHere are some of the papers I read that might help understand this topic a bit more. Note that you will need access to the ACM Digital Library:Managing update conflicts in Bayou, a weakly connected replicated storage systemDisconnected Operation in the Coda File SystemFlexible, Wide-Area Storage for Distributed Systems with WheelFS