Apache taking 750ms just to retrive a simple HTML file

lukam83

Registered
Jul 13, 2020
2
0
1
Spain
cPanel Access Level
Root Administrator
My Apache takes 600ms to 900ms to retrieve an empty HTML file that contains "Hello World", no tags, no css, no js.

Dns resolution (about 8.4ms), SSL negotiation (18 ms), Send request (0.1ms), Receive (0.9ms) are fast and satisfectory. But there is the Waiting between Request and Receive that is between 600ms to 900ms that is driving me insane. It's just a file that contains only "Hello World" and it should not take this long.

This is setup on a fresh development Linode VPS server (32GB ram, 8 cpu cors, 640 GB fast ssd) with WHM/cPanel.Read and tried all the posts on this form and StackOverflow about slow Apache TTFB, but they do not provide a solution.

Apache is using MPM event. There is no network traffic (apart from me), no CPU load (max 0.05). Tests were done on http and https with complete path to index.html, so that Apache did not have to search for index.

How did it tried to fix it unsuccessful:
- Disable swap
- Copied EasyApache profile and Tweak Settings from same spec same datacenter (located in Frankfurt, Germany, European Union) VPS that runs as expected,
- Changing Easy apache MPMs to a minimum of Apache modules
- Disable lookups of Apache HostnameLookups Off, changing Apache log formats changing %h for %a
- Disable cPHulk and CSF firewall, firewalld disabled and masked
- Restarting server
- /etc/recolve.conf adding: options single-request-reopen
- Tweaking Apache config: Start Servers, Spear servers, Start Servers, Max request, Keep alive
- Clean installing server and testing out of the box
- AllowOverride None directive on vhost
- Swapping Apache for Litespeed (and confirmed that it was Litespeed web server running) with the same results.
- Adding Ngnix as Apache proxy
- Made sure no Antivirus is running
- iotop and htop show almost no activity
- disabeling cpanel service

Disk seems to be running very fast and should not be a problem:
/dev/sda:
Timing cached reads: 14548 MB in 1.99 seconds = 7314.42 MB/sec
Timing buffered disk reads: 6370 MB in 3.00 seconds = 2123.19 MB/sec

A couple of times that I managed to mess up cPanel, the Apache Waiting time got consistantly reduced to an expected 45ms (not cached). As I have the same server with cPanel that does this, I am sure this is possible.

I do not wish to change Apache for Litespeed nor Ngnx and I will require PHP & MaridaDB

What am I doing wrong?
 

lukam83

Registered
Jul 13, 2020
2
0
1
Spain
cPanel Access Level
Root Administrator
SOLVED

The problem was that I had domain zone on CloudFlare with proxy enabled.
Disabeling the proxy on CloudFlare and waiting half an hour brought response times 20x faster. So now blank HTML loads in just 40ms.

I hope this helps someone.
 

cPanelLauren

Technical Support Community Manager
Staff member
Nov 14, 2017
13,304
1,247
313
Houston
I am glad you were able to resolve the issue and thank you for adding the cause you identified, I am sure it will help someone else in the future.