How do I find out which DNS is being used, or which is the optimal one to speed up website response

I have a server which hosts a website and also multiple API's. Lately when we try to access the website there is a delay that lasts a few seconds before actually loading. I have a good suspicion that this is due to some DNS setting. Is there a way to find out which DNS the server is actually using?

My /etc/resolv.conf file looks like this:

nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 212.227.123.16
nameserver 212.227.123.17

I know the first 2 are from google, and the remaining are from ionos, strangely enough, one of our websites seem to throw an error if the last two entries (ionos) are not on that resolv.conf.


DNS timeout use to be something like 10-15 seconds. To test domain resolution, you can access your server and execute nslookup:

nslookup yourdomain.com 8.8.8.8
nslookup yourdomain.com 8.8.4.4
nslookup yourdomain.com 1.1.1.1

so you can check how much time does it take to resolve DNS via different name server, and confirm if any of them are slowing it down or not answering