Hi @AllenChou, Now I got your point more clearly.
Without roaming around, let’s get to the point directly. The answer to your query is DNS, the Domain Name System.
The Domain Name System-DNS is the phonebook of the Internet. When users type domain names such as google.com
or nytimes.com
into web browsers, DNS is responsible for finding the correct IP address for those sites. Browsers then use those addresses to communicate with origin servers to access website information. This all happens thanks to DNS servers (machines dedicated to answering DNS queries).
So by definition, Domain name system, commonly known as DNS, is a system that averts the need to remember long IP addresses to visit a website by mapping easy-to-remember domain names to IP addresses.
So mean to say that there is no need to implement logic to resolve or find the right resource. It is already done by our DNS that is a part of the World Wide Web (WWW)
The remaining part of the question is, HOW the address within a domain name is resolved by DNS? Answering it here will go way long. An amazing course is available on the Educative
platform with the title Web Application and Software Architecture 101
. It would be best if you considered it. Read its Chapter # 6: Load Balancing
. It has complete detail of how DNS works.