网站在加载时会冻结几秒钟

I'm working on a Wordpress-powered website (hasn't gone live yet). Most of the time when I load the home page it's fine. Sometimes, however, it freezes for a second on load, before continuing as normal. How do I debug this issue?

First I would profile your php performance with:

  • xdebug using external tools like cachegrind

Next I would also do some base tests with:

Are you testing it on a server or locally?

I've encountered this while developing on a local server, and it's the database access lag usually.

Chrome has a developer tool that lets you profile the page and see how much time the browser spends on different things. Its located under developer tools and is called timelines.
I think firebug for firefox can do the same but I have never used that.

Big external resources that require a reflow may block content. Look for complex javascripts and embedded fonts in addition to your general performance analysis.