Based on what I learned from CS50x, each computer on the internet has its own unique public IP address. Some computers are used on the client-side to access websites, while other computers are used as servers that respond to requests (by providing data from their computers' databases, or more generally, fulfilling some "service(s)" for the client). When a client visits a website, they must make a request through their address bar for the specific server whose service they want to access, which they typically do by typing in a domain name (which was created for the purpose of not having to make users remember the IP addresses of websites that they visit). However, the domain name must then be "converted" to an IP address for the request to be processed, which the DNS is responsible for. Up until this point, there is one point that confuses me:
Why is it necessary for the domain names to be converted to IP addresses for a server to be accessed by the client? My hypothesis is that it has to do with the fact that a single domain name can "map to" multiple computers and hence IP addresses and so it is necessary to identify each computer separately. Also, perhaps it allows for "nodes" (computer networks) on the "global" network to be identified in a more standardized way (as computers that do not act as web servers do not have domain names). In any case, a more thorough explanation would be much appreciated.
Now, I also learned that some websites cannot be hosted on a single computer, as they have too much traffic, which would make them too slow to run on only one computer. This implies that the website would have multiple IP addresses used to host it. In that case, how would DNS convert a domain name into an IP address? If DNS chooses to return one IP address over another when the domain name is given to it, how would the client obtain access to the part of the website that is not "on that particular computer server"? What I mean by that is let's say we're considering a website with a huge database such as Yahoo Finance. There is likely more than one computer server hosting the website. Let's say that each computer stores a chunk of the database (as the database is too large for one computer to store in its entirety). Then, if a client makes a request to the server using a domain name, how would the DNS know to return the IP address of the particular computer that contains the information that a user is looking for?