Why does my 'dns' lookup and 'connect' take over 2 seconds (57% of page load time)?

Kamilski81 picture Kamilski81 · Jun 14, 2012 · Viewed 15.8k times · Source

enter image description here

I also found that it takes about 2 seconds for the page to display a single thing (I'm assuming its cause its the lookup that is taking the longest) http://www.webpagetest.org/result/120613_QC_833b06d5bbdf38bafcff8ed2777be8ac/

How could I improve this, or get rid of the 2 second lag?

I am hosting this on Heroku, and DNS is setup in GoDaddy.

Answer

igrigorik picture igrigorik · Jun 14, 2012

DNS is not your problem.

Take a closer look at your network waterfall chart. Your application.js file is your first performance culprit. If you can:

  • make it smaller
  • if you can, move the script tag to the bottom of the page
  • even better, if you're not doing any document.write's in your script, mark it as "async"

With that out of the way, your background is your next biggest problem - it's massive. Perhaps its worth reconsidering if it should be there if you're really concerned about speed.