Slow initial Connection and TTFB
Hi, I am trying to troubleshoot an issue with a slow webpage load. My initial connection is slow and TTFB is slow.
The two webpages I am working on is https://websites4.me/index.html (all it contains is Hello World) and my actual page https://websites4.me/index.php
I am seeing a 400 ms and 800 ms (desktop and mobile) for index.html and 1.2 seconds and 4.2 seconds (desktop and mobile) for index.php.
Locally the pages load fast.
https://websites4.me/index.html
curl -s -w 'Testing Website Response Time for :%{url_effective}\n\nLookup Time:\t\t%{time_namelookup}\nConnect Time:\t\t%{time_connect}\nPre-transfer Time:\t%{time_pretransfer}\nStart-transfer Time:\t%{time_starttransfer}\n\nTotal Time:\t\t%{time_total}\n' -o /dev/null https://websites4.me/index.html
Testing Website Response Time for :https://websites4.me/index.html
Lookup Time: 0.001245
Connect Time: 0.002473
Pre-transfer Time: 0.014100
Start-transfer Time: 0.015330
Total Time: 0.015372
https://websites4.me/index.php
curl -s -w 'Testing Website Response Time for :%{url_effective}\n\nLookup Time:\t\t%{time_namelookup}\nConnect Time:\t\t%{time_connect}\nPre-transfer Time:\t%{time_pretransfer}\nStart-transfer Time:\t%{time_starttransfer}\n\nTotal Time:\t\t%{time_total}\n' -o /dev/null https://websites4.me/index.php
Testing Website Response Time for :https://websites4.me/index.php
Lookup Time: 0.000987
Connect Time: 0.004234
Pre-transfer Time: 0.015156
Start-transfer Time: 0.054611
Total Time: 0.057658
I am testing with https://pagespeed.web.dev/ + https://gtmetrix.com/ + https://www.webpagetest.org/
Any help would be appreciated.
Azure Virtual Machines
Azure Virtual Network
-
ChaitanyaNaykodi-MSFT 24,681 Reputation points • Microsoft Employee
2022-02-25T18:57:59.68+00:00 Hello @Adam Domoney , Welcome to Microsoft Q&A forum.
If I understand correctly, you are experiencing slow response times for your website hosted on Azure. Can you please elaborate more on the set-up of your website? and which Azure services you are using? so that we can redirect this question to the appropriate team. Thank you! -
Adam Domoney 1 Reputation point
2022-02-25T19:45:36.707+00:00 Yes, I am using a Virtual Machine. The website is using apache2, on ubuntu 20.04. The one page is nothing more then an index.htmll file with "hello world" in it. The other page is my website page. I included the local Curl testing of the page to show that its not VM, or my configuration relatied.
-
ChaitanyaNaykodi-MSFT 24,681 Reputation points • Microsoft Employee
2022-02-25T22:32:46.73+00:00 Hello @Adam Domoney , thank you for a quick reply. As mentioned by you, the curl testing shows that the issue is not due to the VM and website configuration. To check if the issue is related to network latency, have you tested this scenario using different geographic regions? You can also test your VM network latency by following this documentation.
Another approach here to reduce latency might be to use Azure CDN as your index.php page consists of multiple images you can have those cached which will help reduce latency.
Just in case if not already explored, you can also use Azure App services to host websites on Azure. -
Adam Domoney 1 Reputation point
2022-02-25T23:13:44.053+00:00 None of these solutions resolves the issue of 350 ms to serve Hello World. A CDN will not work because I am running a website builder + hosting. Most of the images are delivered by unsplash, which I believe is already behind a CDN, not even loaded off the server. These are just work arounds instead of identifying the problem and fixing it, and it is a huge problem.
Part of running a website builder + hosting is running DNS servers. A delay to the machine multiplies very fast when its dealing with DNS, SSL, mutliple files (javascript, css, images), plus the main file of the page. I hope you understand the importance of this.
Not to mention the increased cost of running a CDN for every website built with my website buidler? This is not financially sound. This is why the other website builders don't give you CDN delivery of content. They have decent servers that respond in an appropriate amount of time.
Also a CDN does not solve the issue of getting the first file, which in this example is index.html, and is taking almost 400 ms, upwards of 500 ms at times. Half a second to even start receiving a single byte of a website was acceptable in 1995, not 2022.
-
Adam Domoney 1 Reputation point
2022-02-25T23:16:12.94+00:00 Also I have caching enabled, I have tested the ping time to the machine and its a non issue. I have run a throughput test using sockperf from another cloud provider and this is not an issue. It seems almost like someone has put a delay on http, https, and DNS traffic when headed to that ip address.
-
Adam Domoney 1 Reputation point
2022-02-25T23:19:40.087+00:00 How about I perform a test against my laptop, running on shared wifi, behind a broadband connection, using windows 10 and xampp through a VPN, and compare it to the virtual machine thats in a datacenter connected directly to the backbone, running ubuntu 20.04 and apache2? Could do a linkedin poll, get in touch with some technical writers/journalists, share it on reddit and linkedin and see which one can serve hello world faster. Currently the Azure instance is at .4 seconds for desktop and .8 seconds for mobile. According to https://pagespeed.web.dev/
If this poll would interest you, please check out my existing one against my AWS EC2 Instance.
https://www.linkedin.com/posts/adomoney_aws-awscloud-amazon-activity-6903082424171933696-v4L_ -
ChaitanyaNaykodi-MSFT 24,681 Reputation points • Microsoft Employee
2022-02-26T00:31:34.087+00:00 Hello @Adam Domoney , thank you for providing additional details. To troubleshoot the exact issue, I think we will need a specialized 1:1 session, where a support engineer can have a screen share session to pinpoint the issue. If you have a support plan you may file a support ticket. If you do not have a support plan I can help you with a one-time free support case, please refer to my private message which I will make here shortly. Thank you!
-
Adam Domoney 1 Reputation point
2022-02-26T01:33:40.323+00:00 Thank you for helping. Instead of a screen share though you could test the page with https://gtmetrix.com/ - page https://websites4.me/index.html
You can check the page only contains "Hello World"
Here is the curl results for loading that page on the instance.
curl -s -w 'Testing Website Response Time for :%{url_effective}\n\nLookup Time:\t\t%{time_namelookup}\nConnect Time:\t\t%{time_connect}\nPre-transfer Time:\t%{time_pretransfer}\nStart-transfer Time:\t%{time_starttransfer}\n\nTotal Time:\t\t%{time_total}\n' -o /dev/null https://websites4.me/index.html
Testing Website Response Time for :https://websites4.me/index.htmlLookup Time: 0.000979
Connect Time: 0.002121
Pre-transfer Time: 0.012210
Start-transfer Time: 0.013343Total Time: 0.013380
Check the waterfall on Gtmetrix.com, 123 ms connecting, 63 ms ssl, 60 ms waiting. Even the favicon has 60 ms of waiting time on it. This test gave me a fully loaded time of 279 ms. Now that seems somewhat okay, until you think about serving additional files, images, css, javascript files. Its so bad my main page is taking 1.2 seconds to load. Time to First Byte (TTFB)
197ms
This is longer then a static site should take to load, let alone a "hello world".I have included a picture of the waterfall showing everything here.
-
Adam Domoney 1 Reputation point
2022-02-26T01:39:41.52+00:00 Also here is a test from another cloud instance
curl -s -w 'Testing Website Response Time for :%{url_effective}\n\nLookup Time:\t\t%{time_namelookup}\nConnect Time:\t\t%{time_connect}\nPre-transfer Time:\t%{time_pretransfer}\nStart-transfer Time:\t%{time_starttransfer}\n\nTotal Time:\t\t%{time_total}\n' -o /dev/null https://websites4.me/index.html
Testing Website Response Time for :https://websites4.me/index.htmlLookup Time: 0.001642
Connect Time: 0.006538
Pre-transfer Time: 0.021249
Start-transfer Time: 0.026635Total Time: 0.026682
root@websitesfor:/home/ubuntu# ping websites4.me
PING websites4.me (52.229.98.124) 56(84) bytes of data.
64 bytes from 52.229.98.124 (52.229.98.124): icmp_seq=1 ttl=45 time=4.58 ms
64 bytes from 52.229.98.124 (52.229.98.124): icmp_seq=2 ttl=45 time=4.76 msThe problem exists on the network to get to my cloud server, almost like someone has implemented a http, https slowdown if headed to that ip address. I do not know how else to explain it. The ping times I have checked are perfectly fine headed to that ip as well.
From my laptop behind a shared wifi, broadband connection.
(the test data I have provided is not from my connection, but other backbone connected testing services)
c:\>ping websites4.mePinging websites4.me [52.229.98.124] with 32 bytes of data:
Reply from 52.229.98.124: bytes=32 time=100ms TTL=47
Reply from 52.229.98.124: bytes=32 time=144ms TTL=47
Reply from 52.229.98.124: bytes=32 time=168ms TTL=47
Reply from 52.229.98.124: bytes=32 time=129ms TTL=47 -
Adam Domoney 1 Reputation point
2022-02-26T05:31:25.163+00:00 Not sure where to find the private request - but in a nut shell this is the problem - file is https://websites4.me/index.html - contains 278 bytes "Hello World", takes 412 ms to load.
-
Adam Domoney 1 Reputation point
2022-02-26T06:37:57.39+00:00 Setup another test server, this is getting crazy, but this is how a website should load.
Both files are "Hello World" running as index.html under https with dnsAzure instance takes 464.72 ms
https://websites4.me/images/Example-azure4-9cd13667.pngAnd other cloud computer takes 157.93 ms
https://websites4.me/images/Example-azure5-75d3eb04.png -
ChaitanyaNaykodi-MSFT 24,681 Reputation points • Microsoft Employee
2022-02-28T20:36:52.897+00:00 Hello @Adam Domoney , a support request will be helpful here because a support engineer can take a deeper look at your set-up and determine if any additional steps can be taken to improve the performance.
I am not sure why you are unable to view the private message, I will try and post it here once again. Apologies about this.
Thank you! -
ChaitanyaNaykodi-MSFT 24,681 Reputation points • Microsoft Employee
2022-02-28T20:39:17.34+00:00 Hello @Adam Domoney , I have made a private message just above this comment. Please let me know if you are still unable to view it. Thank you!
-
Adam Domoney 1 Reputation point
2022-02-28T22:06:17.953+00:00 As shown by the local curl test it is not a local issue. Locally my page delivers in 10 ms non https, and 22 ms https. Its only on the network that its impaired. But you can stop worrying about it. I have migrated to a cloud provider that doesn't take 450 ms to deliver "Hello World". As shown in the previous two screenshots. The 157 ms one is my new provider that doesn't have some random 300 ms delay on their network. Which in my opinion is unacceptable.
Sign in to comment