Definition of Service Discovery
Service discovery is the automatic discovery of services in a computer network. It describes how the services find each other to be able to communicate with each other. Two groups of service discovery protocols (SDP) are differentiated:
- Services register with a central service (a registry). Here you use the central service to find the target service.
- Services query the entire network via broadcasting for a specific service and the service they are looking for, or a registry responds.
Service Registry
The Service Registry is a central infrastructure service and contains a directory of available services. It implements methods for registering and deregistering services as well as methods for finding services. New services register with their current network address in the directory; other services query the registry to find a specific service. In addition, services update their registration periodically. In consequence, if the service terminates, then the update remains off. As a result, the directory automatically removes the entry. There are only active services in the directory.
There are several ways to register a service in the service registry. A frequently used method is self-registration by the service itself. In such a case, the service registers itself in the directory and performs the periodic update. Another option is third-party registration by the service manager. Here, the service manager updates the service status at startup and shutdown. The additional operational monitoring detects the failure or crashes and updates the service status accordingly. Either way, the recorded service status is always up to date.
Enterprise Service Bus
The enterprise service bus is a gateway and a facade in front of the services. Services are accessible to applications via this gateway, the service bus. Applications use the gateway for service access and enable application communication with fixed and well-known addresses. Thus, applications always communicate with the service bus while the bus delegates request the services it knows.
The service bus is often operated together with facade integration services:
- The transformation service transforms data into a general data model. As an illustration, it transforms different data formats in services into a general data model. Here, the application work with one data model instead of service-specific data models.
- The routing service receives a message and forwards it to the correct recipient according to predefined rules. In other words, it distributes requests among services or service groups. Alternatively, the routing can distribute load across multiple service instances, concrete machines, or data centers. In the same way, the Service may include expertise in interconnected services in routing.
The service bus does not have to be operated on a central node and connect all available services. Instead, several nodes may distribute the functionality among nodes, or a single node can bundle certain specialized services. In practice, distribution often takes place with a view to the infrastructure and specialist-dependent services.
DNS
The Domain Name System (DNS) is one of the essential services in IP-based networks. Its main task is to answer name resolution requests. Of course, the DNS is a globally distributed hierarchical directory service. With this in mind, a single DNS server takes over the administration of a domain. Here, it contributes with its knowledge to the worldwide address resolution. Often companies operate a DNS server for a data center or a subnet.
In this context, DNS is a means of service discovery. Infrastructure services register with their name and IP address in the DNS directory service and are thus discoverable by other services. Here, services can thus be found under a defined name, regardless of which technical IP address they use.
Service Mesh
A service mesh is a dedicated infrastructure layer in the software architecture and coordinates the communication between services. The mesh or its control plane controls data inputs and outputs (network sockets) to and from the application. Here, the control plane allows the mesh to redirect any data communication:
- So-called sidecars are proxies managed by the mesh and interpose between the network communication of the application or Service and the infrastructure around it.
- The network destination can be changed transparently by the mesh for the application. Instead of changing the application configuration or setting the DNS entry to a different destination, this task now falls to the mesh.
- The mesh can do the configuration of TLS and SSL certificates. That way, it instruments a non-SSL communicating application with SSL transparently and without changes to the source code.
- The mesh takes control of and can influence routing between services.
In the context of service discovery, the mesh takes control of data communication between services. It is responsible for routing to the correct target service. In addition to service discovery, the service mesh performs many other tasks not discussed here.
Conclusion
There are many different ways to perform service discovery. In practice, you find many of the described approaches. While some implementations are only very rudimentary, others are very sophisticated. However, to understand a software architecture, it is essential to understand the principle of the service discovery used.
This article belongs to the Software Architecture section.
0 Comments