DNS Server Role

As we learned earlier, a software product can be represented as a set of independent microservices located on a local network and/or on the Internet:

A diagram of a software layer

AI-generated content may be incorrect.

The question is: how can independent microservices interact if independence means that each microservice does not know about the existence of the other microservice? DNS Server is the answer to this question.

A DNS server is a store of pairs of transition handler keys and their corresponding URLs. For example, the following DNS server table contains three entries for transition handlers that are part of the “BPP” product, belong to the “Person” use case, and handle the “Searching” transition that starts from the “Initial” state. Each transition handler is in a different application logic layer: “BL” (Business Logic Layer), “DPL” (Data Processing Logic Layer), and “DAL” (Data Access Logic Layer). Each transition handler key has a corresponding URL that provides information about the address of the microservice where the transition handler is located:

Request Handler Key

URL

BPP_Person_BL_Initial_Searching

http://localhost:5076

BPP_Person_DPL_Initial_Searching

http://localhost:5077

BPP_Person_DAL_Initial_Searching

http://localhost:5078

When any microservice starts, it sends information about all the transition handlers it hosts to the DNS server. The DNS server performs CRUD operations on this table, synchronizing information from the microservice with the records in this table.

The following diagram explains the call to the remote transition handler:

When a microservice that hosts, say, a “Searching” transition handler that is part of the business logic layer wants to forward a request to a “Searching” transition handler that is part of the data processing logic layer, it tries to find the transition handler locally, and if it can't find it, it sends the transition handler key to the DNS server, asking for its URL (step number 1), and sends the request to another microservice that is listening on that URL and contains the required transition handler (step number 2)

The microservice does not contact the DNS server every time it tries to send a request to the same remote transition handler next time. Once the microservice receives the URL for the remote transition handler from the DNS server, it caches the received URL and uses it for subsequent requests until it is restarted.

Thus, the DNS server is the core of a software product deployed as a set of microservices and must always be available.

 

Table of Content Software Architecture Previous: Non-functional Architecture Next: Assemblies Architecture