Tools for testing all aspects of service speed
If you suspect a DNS issue, get yourself a free Grafana Cloud account, set up a Grafana instance, configure "Synthetic Monitoring" with HTTP checks from different locations, wait a few minutes, get performance metrics:
In this case it took 10.1ms to resolve the hostname, 31.5ms to establish a tcp connection, 49.1ms for the tls handshake, 34.8ms for the server to generate a response and 159 microseconds to fetch the response body over the network.
If you got docker at hand, the prometheus blackbox_exporter basically does the same job, even from inside your private network:
docker run -d --rm -p 9115:9115 prom/blackbox-exporter
watch "curl -s 'localhost:9115/probe?target=yourwebsite.com&module=http_2xx' | grep probe_http_duration_seconds"
which should generate output like this:
# HELP probe_http_duration_seconds Duration of http request by phase, summed over all redirects
# TYPE probe_http_duration_seconds gauge
probe_http_duration_seconds{phase="connect"} 0.046065283
probe_http_duration_seconds{phase="processing"} 0.051462184
probe_http_duration_seconds{phase="resolve"} 0.0028130639999999997
probe_http_duration_seconds{phase="tls"} 0.051232243999999996
probe_http_duration_seconds{phase="transfer"} 0.000227759
I recommend investing some time to get to know Grafana and Prometheus since they are powerful tools, very well documented and there are lots of examples, guides and ready-to-use dashboards to be found on the internet. You can even fetch detailed metrics about the webserver (apache_exporter), host (node_exporter) and database (mysqld_exporter) to get the whole picture and find your bottleneck.