I have been using navigation timing api to collect actual user data about my site performance. Basically, every time a user visits the site, I send this data back to server and store it in the db.
Now that I analyze this data, I am finding that domainLookupStart
is abnormally high even when there are no redirects happening. On average, over 3 months of data, its as high as ~400ms. This is making up for majority of my "Time to first byte".
I was wondering if someone has a better understanding of what work happens before the browser fires the domainLookupStart navigation timing event. And is there something I can do to bring this time down?
It can sometimes be the unload event on the previous page. The unload event allow some JavaScript execution before the page is closed, and it's often used by tracking scripts to save the time spent on the page by users. I've even seen a script sending a synchronous ajax requests here!
It could be on your page or on a third party page that drives users to your website.
You can use Chrome DevTool's Performance tab (previously called "Timeline") to record what's going on during unload and maybe you'll find something.