简体   繁体   English

如何查看正在减慢页面速度的内容?

[英]How to check what's slowing down a page?

I'm working on a website that can be found here: http://odesktestanswers2013.com/Metareviewer 我正在一个可以在这里找到的网站: http : //odesktestanswers2013.com/Metareviewer

The index appears to be unusually slow (slowing down the browser as it loads) even though Yslow doesn't seem to see anything particularly wrong with it and that my php microtime returns a fine value. 索引似乎异常慢(加载时降低浏览器速度),即使Yslow似乎没有发现任何特别错误,并且我的php microtime返回了一个很好的值。

What's the other things I should be looking into ? 我还应该考虑什么?

Using Chrome Developer Tools, the network tab shows this: 使用Chrome开发者工具,网络标签显示以下内容:

在此处输入图片说明

... a timeline of what's loading in your page. ...页面上正在加载的内容的时间表。

There are also plenty of good practices that aren't being made here. 这里也没有很多好的做法。 Some of these can also be flagged up by using Google Chrome's Audit tool (F12 menu), but in my opinion the most important are: 使用Google Chrome浏览器的审核工具(F12菜单),也可以标记其中一些,但我认为最重要的是:

  • Use a CDN for serving common library code. 使用CDN来提供公共库代码。 Do you really need to host Jquery yourself? 您真的需要自己托管Jquery吗? (side-rant, do you really need jquery at all?) (旁白,您真的真的需要jquery吗?)
  • Your JavaScript files are taking a long time to load, because they are all served as separate HTTP calls. 您的JavaScript文件需要很长时间才能加载,因为它们均作为单独的HTTP调用提供服务。 You can combine them into a single JavaScript file, and also minify them to save lots of bandwidth. 您可以将它们组合到一个JavaScript文件中,也可以将它们缩小以节省大量带宽。
  • Foundation.css is very large - not that there's a problem with large CSS files, but it looks like there are over 2000 rules in the CSS file that aren't being used on your site. Foundation.css 非常大-并不是说CSS文件很大,但是看起来CSS文件中有2000多个规则没有在您的网站上使用。 Do you need this file? 需要这个档案吗?
  • CACHE ALL THE THINGS - there are 26 HTTP requests that are made, that are uncached , meaning that everyone who clicks on your site will have to download everything, every request. 缓存所有内容 -发出了26个未缓存的 HTTP请求,这意味着单击您网站的每个人都必须下载所有内容,每个请求。
  • The whole bandwidth can be reduced by about two thirds if you enabled gzip compression on your server (or even better, implement SPDY, but that's a newer technology with less of a community). 如果在服务器上启用gzip压缩,则整个带宽可以减少大约三分之二(或者更好的是,实现SPDY,但这是一种社区较少的新技术)。
  • Take a look on http://caniuse.com - there are a lot of CSS technologies that are supported in modern browsers without the need for -webkit or -moz , which could save a fortune of kebabbobytes. 看看http ://caniuse.com- 现代浏览器支持很多CSS技术, 而无需-webkit或-moz ,这可以节省大量的kebabbobytes。

If I could change one thing on your site... 如果我能在您的网站上更改一件事...

Saying all of that, each point above will make a very small (but accumulative) difference to the speed of your site, but it's probably a good idea to attack the worst offender first. 综上所述,上面的每一点都会对您的网站速度产生很小的(但是累积的)差异,但是最好先攻击最严重的违规者是一个好主意。

Look at the network graph. 查看网络图。 While all that JavaScript is downloaded, it is blocking the rest of the site to download. 在下载所有JavaScript的同时,它阻止了网站的其余部分下载。

If you're lazy , just move it all to the end of the document body. 如果您很懒 ,只需将其全部移至文档正文的末尾即可。 That way, the rest of the page will download before the JavaScript has to, but this could harm the execution of your scripts if they are programmed in particular styles. 这样,页面的其余部分将在JavaScript之前下载,但是如果以特定样式编程的脚本可能会损害脚本的执行。

Hope this helps. 希望这可以帮助。

You should also consider using http://www.webpagetest.org/ 您还应该考虑使用http://www.webpagetest.org/

It's one of the best tools when it comes to benchmarking your site's performance. 在基准测试网站性能时,它是最好的工具之一。

You can use this site ( http://gtmetrix.com/ ) to analyze the causes and to fix them them 您可以使用此网站( http://gtmetrix.com/ )分析原因并解决问题 在此处输入图片说明 .The site provides the reasons as well as solutions like js and css in optimized formats. 该网站提供了原因以及优化格式的解决方案,例如js和css。

As per this site's report, you need to optimize images and minify js and css files. 根据此站点的报告,您需要优化图像并最小化js和css文件。 The optimized images and js and css files can be downloaded from this site. 可以从该站点下载优化的图像以及js和css文件。

Use Google Chrome -> F12 -> Network and check the connect, send, receive and etc. time for each resource, used in your page. 使用Google Chrome-> F12->网络并检查页面中使用的每种资源的连接,发送,接收等时间。

It looks like your CSS and JS scripts have a very long conntect and wait times. 看来您的CSS和JS脚本具有很长的连接时间和等待时间。

you can use best add-one available for both chrome and firefox 您可以使用适用于chrome和firefox的最佳附加组件

YSlow analyzes web pages and suggests ways to improve their performance based on a set of rules for high performance web pages. YSlow分析网页,并根据一组高性能网页的规则,提出改善网页性能的方法。

above is link for firefox add-one you can also search chrome and is freely available. 上面是firefox插件的链接,您也可以搜索chrome,并且可以免费获得。

Yslow gives you details about your website's front end. Yslow为您提供有关网站前端的详细信息。 Most likely you have a script that is looping one to many times in the background. 您最有可能拥有一个在后台循环执行多次的脚本。

If you suspect that a sequence of code is hanging server side then you need to do a stack trace to pinpoint exactly where the overhead is taking place. 如果您怀疑有一系列代码挂在服务器端,则需要执行堆栈跟踪以准确确定发生开销的位置。

I recommend using New Relic . 我建议使用New Relic

Try to use Opera. 尝试使用Opera。 Right click -> Inspect element -> Profiler. 右键单击->检查元素->探查器。 Look to Inspect element -> Errors. 查看检查元素->错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM