Why is apache much slower with naked domain?
I’m running a droplet with apache and wordpress installed on it.
Basic load testing with the ab tool shows that the requests per second are much lower when the naked domain is used.
ab -kc 10 -n 100 https://example.com/
results in an average connection time of >2000ms and
ab -kc 10 -n 100 https://www.example.com/
would result in an average connection time of ~700ms. Also htop shows that the cpu is at 100% for the test with the naked domain and for the www. domain the cpu stays relatively low all the time.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.