wordpress 大网站

tech2022-12-30  108

wordpress 大网站

This article was sponsored by GoDaddy. Thank you for supporting the companies who make SitePoint possible!

本文由GoDaddy赞助。 感谢您对使SitePoint成为可能的公司的支持!

As one of the top user experience factors, website performance is more important than ever. Website speed and performance on mobile devices is particularly important, with a rapidly growing number of visitors accessing the web via smartphones and tablets.

作为最重要的用户体验因素之一,网站性能比以往任何时候都更为重要。 随着越来越多的访问者通过智能手机和平板电脑访问网络,移动设备上的网站速度和性能尤为重要。

While WordPress is very easy to get up and running, making your site speedy requires a bit more work, and is an ongoing process. In this article we’ll cover why speed matters, and offer some practical advice for how to speed up WordPress.

尽管WordPress非常易于启动和运行,但要使您的网站快速运行还需要做更多的工作,并且这是一个持续的过程。 在本文中,我们将介绍速度为何如此重要,并提供一些有关如何加快WordPress速度的实用建议。

Improving performance takes a lot of trial and error, but it’s great fun!

改善性能需要大量的尝试和错误,但这非常有趣!

为什么网站速度很重要 (Why Website Speed Matters)

First impressions count. The benefits of a faster website are numerous, but the three main advantages are:

第一印象很重要。 更快的网站有很多好处,但是三个主要优点是:

1)更好的用户体验 (1) Better User Experience)

It’s well documented: people love fast websites and despise the slow. So, if you care about your users, you should care about the speed of your website. Slow website loading times are one of the largest contributing factors to website abandonment. According to KISSmetrics, 47% of consumers expect a website page to load within two seconds. If it doesn’t, they’re not likely to hang around.

有据可查:人们喜欢快速的网站,而鄙视缓慢的网站。 因此,如果您关心用户,则应该关注网站的速度。 网站加载速度缓慢是造成网站放弃的最大因素之一。 根据KISSmetrics的调查 ,47%的消费者希望网站页面在两秒钟内加载。 如果不是这样,他们就不会闲逛。

2)提升搜索引擎排名 (2) Improved Search Engine Rankings)

Google hinted at the importance of site speed to search ranking many years ago, and in 2010, announced that site speed was a ranking factor. Fast-forward four years and Google’s obsession with speed has increased. Google now heads an initiative called Make the Web Faster, offering a wide range of tools and resources designed to help developers and webmasters build faster websites.

Google于多年前就暗示了网站速度对搜索排名的重要性,并于2010年宣布网站速度是排名因素 。 快进的四年和Google对速度的痴迷增加了。 Google现在领导一项名为“使网络更快”的计划 ,该计划提供了广泛的工具和资源,旨在帮助开发人员和网站管理员建立更快的网站。

Yahoo! has also been a long time advocate of a faster web, and maintain extensive resources for web performance optimization at the Yahoo! Developer Network.

雅虎! 也得到了更快的网络长时间的倡导者,并保持对网络的性能广泛的资源在雅虎优化 开发人员网络。

3)更高的转化率 (3) Higher Conversion Rates)

There has been a considerable amount of research conducted into the impact of site speed on companies’ bottom line. The most well known statistic is from Amazon, who reported an increase of 1% revenue for every 100 millisecond improvement in page speed.

关于站点速度对公司利润的影响已经进行了大量研究。 最著名的统计数据来自亚马逊,该公司报告页面速度每提高100毫秒,收入就会增加1%。

Similarly, Mozilla published data revealing that Firefox downloads increased by 15.4%, as a direct result of reducing the average page load time by 2.2 seconds.

同样, Mozilla发布的数据显示,Firefox的下载量增加了15.4%,这直接是因为平均页面加载时间减少了2.2秒。

运行自己的网站速度测试 (Running Your Own Website Speed Test)

Before making any changes to your site, it is a good idea to run a page speed test, to establish a baseline. There is plenty of speed testing tools available, ranging from web services to browser extensions. The most popular tools include:

在对网站进行任何更改之前,最好进行页面速度测试以建立基准。 有许多速度测试工具可用,从Web服务到浏览器扩展。 最受欢迎的工具包括:

Google PageSpeed Insights

Google PageSpeed见解

WebPagetest.org

WebPagetest.org

Pingdom Website Speed Test

Pingdom网站速度测试

YSlow browser extension

YSlow浏览器扩展

All of these tools have similar features and give you both measurements and scores, as well as a list of suggested areas for improvement. PageSpeed Insights also gives you mobile statistics.

所有这些工具都具有相似的功能,并为您提供度量和分数,以及建议的改进区域列表。 PageSpeed Insights还为您提供移动统计信息。

查看WordPress性能问题 (Reviewing WordPress Performance Issues)

Aside from standard page speed tests, you may want to take a closer look at WordPress itself. Once you’ve acquired solid baseline data on the performance of your site and identified any issues, you can try isolating the problem. This can be achieved by disabling or enabling plugins, activating a different theme or commenting out custom code. Alternatively, use the following tools to analyze WordPress specific performance.

除了标准页面速度测试之外,您可能还需要仔细研究WordPress本身。 一旦获得了有关网站性能的可靠基准数据并确定了任何问题,就可以尝试找出问题所在。 这可以通过禁用或启用插件,激活其他主题或注释掉自定义代码来实现。 或者,使用以下工具来分析WordPress的特定性能。

P3 (Plugin Performance Profiler)

P3(插件性能分析器)

NewRelic

新遗物

P3 is an incredibly handy WordPress plugin that provides a detailed breakdown of your plugins’ impact on load time. It’s a very easy way to diagnose potential problems and identify resource hogs.

P3是一个非常方便的WordPress插件,它详细介绍了您的插件对加载时间的影响。 这是诊断潜在问题和识别资源消耗的一种非常简单的方法。

NewRelic also provides in-depth analysis of web application performance. If you’re running your own server, and need greater visibility when it comes to your application, investigate NewRelic.

NewRelic还提供对Web应用程序性能的深入分析。 如果您正在运行自己的服务器,并且在应用程序方面需要更高的可见性,请调查NewRelic。

WordPress性能因素 (WordPress Performance Factors)

A long list of factors can impact on the speed of your site, including DNS, hosting, server resources and configuration, as well as theme, plugins and even content.

众多因​​素会影响您网站的速度,包括DNS,托管,服务器资源和配置以及主题,插件甚至内容。

您的托管服务提供商或服务器配置 (Your Hosting Provider or Server Configuration)

When it comes to hosting, cheaper is not always better. If you’re serious about the performance of your website, make sure you choose the right hosting provider. If you prefer a more hands-on approach, there are plenty of guides to building your own optimized server. Otherwise, there are many hosting services available.

说到托管,便宜并不总是更好。 如果您对网站的性能很认真,请确保选择正确的托管服务提供商。 如果您更喜欢动手操作方法,则有很多指南来构建自己的优化服务器。 否则,有许多托管服务可用。

Keep in mind that it’s not uncommon for WordPress to hit memory limits if you’re using resource-hungry plugins, especially on shared hosting. Server-level optimization is well worth exploring if you’re managing your own servers.

请记住,如果您使用的是资源匮乏的插件,尤其是在共享主机上,WordPress达到内存限制的情况并不少见。 如果您要管理自己的服务器,则服务器级别的优化非常值得探索。

专门的WordPress托管 (Specialized WordPress Hosting)

Managed WordPress hosting has come a long way in the past few years. Some of the biggest players, like GoDaddy, offer WordPress optimized hosting that includes daily backups, automatic core updates, comment spam filtering, built in caching, DDoS protection, and malware scanning.

在过去的几年中,托管WordPress托管已经走了很长一段路。 一些最大的公司(例如GoDaddy )提供WordPress优化的托管服务,其中包括每日备份,自动核心更新,垃圾邮件过滤,内置缓存,DDoS保护和恶意软件扫描。

For a long time, a popular myth has prevailed: shared hosting just isn’t worth looking at. But, in reality, it really does depend upon the host you choose. Some modern hosting companies purpose-build their hosting platform for optimum performance. As a result, most hosting platforms are fast, and can handle an insane amount of traffic. Just be sure to do your own research and testing before you lock in a shared hosting platform. You might want to start with Tech Void’s recent comparison of WordPress hosting platforms (check out the original benchmark at ReviewSignal.com).

长期以来,一个流行的神话盛行:共享托管根本不值得关注。 但是,实际上,它确实取决于您选择的主机。 一些现代托管公司专门构建其托管平台以获得最佳性能。 结果,大多数托管平台速度很快,并且可以处理疯狂的流量。 在锁定共享托管平台之前,请务必进行自己的研究和测试。 您可能想从Tech Void最近对WordPress托管平台进行比较开始(请查看ReviewSignal.com上的原始基准 )。

There are also several managed WordPress hosting services, including:

还有几种托管的WordPress托管服务,包括:

Media Temple

媒体寺

WP Engine

WP引擎

Pagely

每页

Synthesis

合成

WordPress.com VIP

WordPress.com VIP

Kinsta

金斯塔

主题选择 (Choice of Theme)

Choosing the right theme plays a major role in the speed of your WordPress site. A high quality theme isn’t about how it looks; it’s about how well it has been built and how well it conforms to the WordPress Theme Development Standards. Look for actively developed, well supported themes.

选择正确的主题对WordPress网站的速度起着重要作用。 高质量的主题与外观无关。 这是关于它的构建程度以及它与WordPress主题开发标准的符合程度。 寻找积极发展,良好支持的主题。

A theme with solid functionality is also paramount, as this will reduce the need for plugins (leading us nicely into our next point).

具有可靠功能的主题也至关重要,因为这将减少对插件的需求(将我们引向下一个重点)。

WPMU Dev have put together a list of the top 10 fastest WordPress themes.

WPMU开发人员汇总了WordPress最快的10个主题 。

插件数量 (Number of Plugins)

At the time of writing, there are 31,539 plugins with 672,957,182 downloads in the WordPress Plugin Directory. This is great if you’re a WordPress developer or user looking for specific website functionality, but there is a temptation to just install one more plugin.

在撰写本文时,WordPress插件目录中有31,539个插件,其中有672,957,182个下载。 如果您是WordPress开发人员或正在寻找特定网站功能的用户,那么这很棒,但是如果您只想再安装一个插件 ,则有一种诱惑。

Well-built WordPress sites usually have minimal plugins installed. While it can be tempting to include all the bells and whistles, ask yourself whether it is critical to install that extra plugin. Remember, WordPress out-of-the-box is extremely powerful. It doesn’t require dozens of plugins. So, if in doubt, don’t install it!

精心打造的WordPress网站通常安装的插件最少。 虽然可能会很吸引人,但请问问自己,安装该额外插件是否至关重要。 请记住,即用的WordPress非常强大。 它不需要数十个插件。 因此,如有疑问,请勿安装!

插件类型 (Types of Plugins)

When you’re selecting a plugin, spend a few extra minutes researching the best option available. The WordPress Plugin Directory displays a few useful pieces of information, designed to make the selection process easier:

选择插件时,请花几分钟的时间研究可用的最佳选项。 WordPress插件目录显示了一些有用的信息,旨在简化选择过程:

Star ratings (from 0-5 stars)

星级(0-5星) Notification if the plugin hasn’t been updated in two years

两年内未更新插件的通知 Number of downloads

下载次数 Link to support forums

链接到支持论坛 User feedback

用户反馈

Install only the highest quality plugins: those that have high ratings, lots of downloads, and that are actively developed and supported.

仅安装最高质量的插件:具有高评分,大量下载以及积极开发和支持的插件。

保持网站精益和清洁 (Keeping Your Site Lean and Clean)

Good housekeeping improves overall site performance; always run updates and fix any broken links. It’s also very important to regularly monitor your web server error logs.

良好的内务管理可以改善站点的整体性能; 始终运行更新并修复任何损坏的链接。 定期监视您的Web服务器错误日志也很重要。

Comment (and trackback/pingback) spam is a common black hat SEO tactic. Bots crawl websites that accept comments and then post spammy links for a perceived SEO benefit. Unless you manage this, your site will be constantly hit by bots, exhausting your server resources very quickly. It is not uncommon for websites that have fallen prey to comment spam, to rack up thousands of comments.

评论(和引用/回复)垃圾邮件是一种常见的黑帽SEO策略。 僵尸程序会爬网接受评论的网站,然后发布垃圾链接以实现SEO优势。 除非您对此进行管理,否则您的站点将不断受到僵尸程序的攻击,从而非常快地耗尽服务器资源。 对于那些沦为垃圾邮件评论,堆积成千上万评论的网站来说,这种情况并不罕见。

The answer: disable comments if you don’t need them, if you do, use the Akismet plugin (comes as a default) or a service to help manage spam.

答案:如果不需要,请禁用评论,如果需要,请使用Akismet插件(默认情况下使用)或服务来帮助管理垃圾邮件。

If your website has already been hit with comment spam, there are several plugins that can help you get back on track, including:

如果您的网站已被垃圾评论打中,那么有几个插件可以帮助您重回正轨,包括:

Delete All Comments

删除所有评论

WP DBManager

WP DB管理器

WP-Optimize

WP优化

最小化和合并资产 (Minifying and Combining Assets)

JavaScript, CSS and Web Fonts have given us a better looking and more usable web, but they do increase the weight of a page. As you can see in the chart below from HTTP Archive the average transfer size of all responses from June 2013 – June 2014 has increased, while the number of requests has remained the same.

JavaScript,CSS和Web字体为我们提供了更好的外观和更实用的Web,但确实增加了页面的重量。 从HTTP存档的下表中可以看到,从2013年6月至2014年6月,所有响应的平均传输大小已增加,而请求的数量保持不变。

Minification is the process of stripping whitespace from HTML, CSS and JavaScript files. It reduces the size of files that need to be downloaded.

缩小是从HTML,CSS和JavaScript文件中删除空格的过程。 它减少了需要下载的文件的大小。

Files can also be combined, reducing the number of requests that your site has to make to the server during loading. The result: quicker loading time. There are many options for minifying and combining assets in WordPress, including:

文件也可以合并,从而减少了站点在加载期间必须向服务器发出的请求数。 结果:更快的加载时间。 在WordPress中有许多用于缩小和合并资产的选项,包括:

Better WordPress Minify

更好的WordPress缩小

Autoptimize

自动优化

影像压缩 (Image Compression)

High quality content will always set your site apart from the rest, but you need to ensure this content is in the appropriate format and is compressed (where possible).

高品质的内容将始终使您的网站与其他网站区分开,但是您需要确保此内容采用适当的格式并已压缩(在可能的情况下)。

There are a few handy plugins that compress existing, and new, images in your Media Library:

有一些方便的插件可以压缩媒体库中的现有图像和新图像:

WP Smush.it

WP Smush.it

Bulk Resize Media

批量调整大小的媒体

Kraken Image Optimizer

KrakenD图像优化器

EWWW Image Optimizer

EWWW图像优化器

Most compression plugins only apply to files in your Media Library. So make sure anything outside of the Media Library is manually compressed. If you’re using lots of icons, to reduce requests, consider using sprites or an icon font.

大多数压缩插件仅适用于媒体库中的文件。 因此,请确保手动压缩媒体库之外的所有内容。 如果使用大量图标,为减少请求,请考虑使用精灵或图标字体。

Infinite scroll/lazy loading and preloading techniques can also give the illusion of speed, and are worth investigating if you’re running an image heavy site.

无限滚动/延迟加载和预加载技术也可以带来速度的幻觉,如果您正在运行图像繁重的站点,则值得进行调查。

快取 (Caching)

Caching can make a huge difference to website loading time and is easily implemented by installing a caching plugin.

缓存可以大大缩短网站的加载时间,并且可以通过安装缓存插件轻松实现。

WordPress caching plugins generate static HTML files that are then served to visitors, rather than executing PHP and making database calls. They also enable other optimization options, such as compression and preloading. Caching also helps your site handle a higher volume of traffic. There are quite a few dedicated caching plugins, the most popular are:

WordPress缓存插件会生成静态HTML文件,然后将其提供给访问者,而不是执行PHP和进行数据库调用。 它们还启用其他优化选项,例如压缩和预加载。 缓存还可以帮助您的站点处理更大的流量。 有很多专用的缓存插件,最受欢迎的是:

WP Super Cache

WP超级缓存

W3 Total Cache

W3总缓存

WP Rocket

WP火箭

It’s also worth mentioning that even security plugins such as WordFence now includes caching capabilities.

还值得一提的是,甚至安全插件(如WordFence) 现在都具有缓存功能 。

You can simulate load and measure performance on your site with tools like:

您可以使用以下工具在网站上模拟负载并衡量性能:

ab Apache HTTP server benchmarking tool

ab Apache HTTP服务器基准测试工具

blitz.io

闪电战

loader.io

loader.io

A simple test using ab to make 100 requests (5 concurrent connections) would look like:

使用ab发出100个请求(5个并发连接)的简单测试如下所示:

$ ab -n 100 -c 5 http://example.com/

$ ab -n 100 -c 5 http://example.com/

内容交付网络(CDN) (Content Delivery Networks (CDNs))

If your site receives a reasonable amount of traffic, and you are considering taking the next step in website performance, a Content Delivery Network (CDN) might be just the ticket.

如果您的网站获得了合理的访问量,并且您正在考虑采取下一步的网站性能措施,那么内容交付网络(CDN)可能只是问题所在。

CDNs store static assets such as images, CSS and JavaScript files at multiple points around the web, usually at a geographic location closer to your website visitor than your web server. Historically, CDNs were quite pricey, but they are now quite affordable and worth the extra gain if you have a large or global audience, or lots of static assets. Popular CDNs include:

CDN将静态资产(例如图像,CSS和JavaScript文件)存储在网络上的多个位置,通常位于比网站服务器更靠近网站访问者的地理位置。 从历史上看,CDN的价格非常昂贵,但是现在您可以负担得起,并且如果您有大量的或全球的受众群体或大量的静态资产,则值得额外收益。 流行的CDN包括:

MaxCDN

最大CDN

CloudFlare

CloudFlare

Amazon CloudFront

亚马逊CloudFront

Configuring WordPress to use a CDN is quite easy; your caching plugin will have a section where you enter your account details.

配置WordPress以使用CDN非常容易。 您的缓存插件将在一个部分中输入您的帐户详细信息。

结论 (Conclusion)

As you can see, there are many factors that can impact on website performance. Performance tuning is a constant process of monitoring and improvement; it is vital that you constantly test and measure.

如您所见,有许多因素会影响网站性能。 性能调优是不断进行监视和改进的过程; 不断测试和衡量至关重要。

To recap:

回顾一下:

Choose quality hosting

选择优质的托管 Choose quality themes and plugins

选择优质的主题和插件 Run a speed test and identify performance issues

运行速度测试并确定性能问题 Minimize the number of plugins

减少插件数量 Compress, minify and combine

压缩,最小化和结合 Keep your site lean

保持网站简洁 Use caching and CDNs

使用缓存和CDN

If you’re looking for more information on web performance in general, take a look at Planet Performance and the official WordPress Codex page on WordPress Optimization.

如果您通常需要有关Web性能的更多信息,请查看Planet Performance和WordPress Optimization上的官方WordPress Codex页面 。

This article is also available in Korean on Web Actually

这篇文章在网络上也可以用韩文找到

翻译自: https://www.sitepoint.com/speed-wordpress/

wordpress 大网站

最新回复(0)