• 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細

このWikiはいつでも誰でも編集できます

「WordPress の最適化」の版間の差分

提供: WordPress Codex 日本語版
移動先: 案内検索
(データベースのクリーニング)
(最新版に合わせて更新)
 
34行目: 34行目:
 
=== 複数サーバー ===
 
=== 複数サーバー ===
 
</div>
 
</div>
非常にトラッフィックの多いシチュエーションでは、複数のサーバーが必要になってきます。このレベルでは上記のうち適用できるすべてのテクニックを使っているべきです。
+
非常にトラフィックの多いシチュエーションでは、複数のサーバーが必要になってきます。このレベルでは上記のうち適用できるすべてのテクニックを使っているべきです。
  
 
WordPress データベースは簡単に別サーバーへ移動でき、設定ファイルに少し変更を加えるだけで済みます。同様に、画像などの静的ファイルも代替サーバーに移動できます ([[WordPress の最適化/オフロード|オフロード]]を参照)。
 
WordPress データベースは簡単に別サーバーへ移動でき、設定ファイルに少し変更を加えるだけで済みます。同様に、画像などの静的ファイルも代替サーバーに移動できます ([[WordPress の最適化/オフロード|オフロード]]を参照)。
42行目: 42行目:
 
==== ハードウェアパフォーマンス ====
 
==== ハードウェアパフォーマンス ====
  
ハードウェアの性能はサイトのパフォーマンスの中で巨大な影響があります。プロセッサーの数、プロセッサーのスピード、
+
ハードウェア機能は、サイトのパフォーマンスに大きな影響を与えます。プロセッサーの数、プロセッサーの速度、使用可能なメモリーとディスク容量、ディスク記憶媒体も同様です。ホスティングプロバイダは一般的に、より高い価格でより高いパフォーマンスを提供しています。
可能なメモリーとディスク容量とスペース、ディスク記憶媒体も同じです。ホスティングプロバイダーは一般的に
+
高いパフォーマンスを申し込むと高い価格なります。
+
  
One innovation in hosting is the use of Solid State Drives or SSDs which are faster than traditional magnetic media. [[Installing_WordPress#Installing_WordPress_at_DigitalOcean|Digital Ocean]] offers affordable SSD hosting and Amazon has recently added SSD hosting to its cloud offerings.
+
ホスティングの革新のひとつとして、従来の磁気メディアよりも高速なソリッドステートドライブ (SSD) の使用があります。[[Installing_WordPress#Installing_WordPress_at_DigitalOcean|Digital Ocean]] は手頃な価格の SSD ホスティングを提供しており、Amazon は最近クラウドサービスに SSD ホスティングを追加しました。
  
=== WordPress設定 ===
+
=== WordPress 設定 ===
  
テーマはサイトのパフォーマンスに大きな影響を与えるので、高速で軽量なテーマであるとより効率的に機能します。また、プラグインの数がサイトの影響を与えるので、不要なプラグインは停止や削除しましょう。
+
テーマはサイトのパフォーマンスに大きな影響を与えるので、高速で軽量なテーマであるとより効率的に機能します。
 +
 
 +
また、プラグインの数とその性能も、サイトのパフォーマンスに大きな影響を与えます。不要なプラグインの無効化と削除は、パフォーマンスを向上させるために非常に重要です。
  
 
=== ソフトウェアパフォーマンス ===
 
=== ソフトウェアパフォーマンス ===
  
最新のソフトウェアを使用しているかどうかを確認することも重要です。ソフトウェアのアップグレードは、多くの場合、バグを修正し、パフォーマンスを向上させるようになっています。Linux(または Windows )が、Apache、MySQLサーバと PHP の最新バージョンを実行していることを確認することは非常に重要です。
+
最新のソフトウェアを使用しているかどうかを確認することも重要です。ソフトウェアのアップグレードによってバグが修正され、パフォーマンスが向上することがよくあります。 Linux (または Windows)、Apache、MySQL / MariaDB、および PHP の最新バージョンを実行していることを確認することは非常に重要です。
  
WordPressのアップグレードを続けることもまた重要です。
+
WordPress のアップグレードを続けることもまた重要です。
  
=== Serverのロード ===
+
=== サーバー負荷 ===
  
The amount of traffic on your server and how its configured to handle the load will have a huge impact as well. For example, if you don't use a caching solution, performance will slow to a halt as additional page requests come in and stack up, often crashing your web or database server. If configured properly, most hosting solutions can handle very high traffic. Offloading traffic to other servers can also reduce server load.
+
サーバー上のトラフィック量と、サーバーが負荷を処理するためにどのように構成されているかも大きな影響を与えます。たとえば、キャッシュソリューションを使用しない場合、追加のページリクエストが入ってスタックアップするとパフォーマンスが低下し、Web サーバーやデータベースサーバーがクラッシュすることがあります。適切に設定されている場合、ほとんどのホスティングソリューションは非常に高いトラフィックを処理できます。トラフィックを他のサーバーにオフロードすることで、サーバーの負荷を軽減することもできます。
  
Abusive traffic such as login attacks, image leaking (other sites linking to your image files from high traffic pages) or DoS attacks can also increase server load. Identifying and blocking these attacks is very important.
+
ログイン攻撃、画像漏洩 (高トラフィックページからの画像ファイルへの他のサイトのリンク) DoS 攻撃などの不正トラフィックは、サーバーの負荷を増加させる可能性があります。これらの攻撃を特定してブロックすることは非常に重要です。
  
=== 画像のサイズ ===
+
=== 画像サイズ ===
  
Making sure the images in your posts are optimized for the web can save time, bandwidth and increase your search engine ranking.
+
投稿内の画像を Web 用に最適化することで、時間と帯域幅を節約し、検索エンジンランキングを上昇させることができます。
  
 
=== 地理的な距離 ===
 
=== 地理的な距離 ===
72行目: 72行目:
 
The distance between your server and your website visitors also has an impact on perceived performance. A Content Delivery Network or CDN can mirror static files and images across various geographic regions so that all of your site visitors have optimal performance.
 
The distance between your server and your website visitors also has an impact on perceived performance. A Content Delivery Network or CDN can mirror static files and images across various geographic regions so that all of your site visitors have optimal performance.
  
 +
お使いのサーバーとサイト訪問者との間の距離も、パフォーマンス認識に影響します。コンテンツ配信ネットワーク (CDN) は、さまざまな地域の静的なファイルと画像をミラーリングして、すべてのサイト訪問者に対して最適なパフォーマンスを発揮できるようにします。
  
== 画像・静的ファイルへの CDN 利用 ==
 
 
画像、JavaScritp、CSS、テーマファイルなどの検索・配信を CDN にオフローディングすることで、高速化のみでなく WordPress サーバーのアプリスタック自体への不可を軽減できます。CDN は WordPress キャッシングプラグインと一緒に使うと最も効果的です。詳しくは [[WordPress_の最適化/キャッシング|キャッシングのページ]]をご覧ください。
 
  
 
== パフォーマンスの計測方法 ==
 
== パフォーマンスの計測方法 ==
  
 
* [http://developers.google.com/speed/pagespeed/insights/ Google PageSpeed] is an excellent way to measure your WordPress site's performance and receive clear, specific feedback on how to make improvements.
 
* [http://developers.google.com/speed/pagespeed/insights/ Google PageSpeed] is an excellent way to measure your WordPress site's performance and receive clear, specific feedback on how to make improvements.
* [http://newrelic.com/php/wordpress New Relic] also provides a free library for measuring server performance in PHP and MySQL
+
* [http://newrelic.com/php/wordpress New Relic] also provides a free library for measuring server performance in PHP and MySQL/MariaDB
 
* [http://linuxaria.com/howto/understanding-the-top-command-on-linux Linux Top] provides a dashboard for your server's real time performance.
 
* [http://linuxaria.com/howto/understanding-the-top-command-on-linux Linux Top] provides a dashboard for your server's real time performance.
 
* If using Varnish Cache, [https://www.varnish-cache.org/docs/trunk/reference/varnishstat.html VarnishStat] helps assess the performance aspects of your caching tools.
 
* If using Varnish Cache, [https://www.varnish-cache.org/docs/trunk/reference/varnishstat.html VarnishStat] helps assess the performance aspects of your caching tools.
92行目: 90行目:
 
* [http://tools.pingdom.com/ Pingdom]
 
* [http://tools.pingdom.com/ Pingdom]
 
* [http://www.webpagetest.org/test WebPagetest]
 
* [http://www.webpagetest.org/test WebPagetest]
* [http://www.gomez.com/instant-test-pro/ Gomez Instant Test Pro]
 
 
* [http://redbot.org/ Resource Expert Droid]
 
* [http://redbot.org/ Resource Expert Droid]
 
* [http://www.procata.com/cachetest/ Web Caching Tests]
 
* [http://www.procata.com/cachetest/ Web Caching Tests]
99行目: 96行目:
 
* [http://www.websiteoptimization.com/services/analyze/ Web Page Analyzer]
 
* [http://www.websiteoptimization.com/services/analyze/ Web Page Analyzer]
  
== WordPressのパフォーマンスを向上させるには? ==
+
== WordPress のパフォーマンスを向上させるには ==
  
If you need a '''quick fix now''', go straight to the [[WordPress_Optimization#Caching|Caching section]], you'll get the biggest benefit for the smallest hassle there.
+
もし'''すばやい修正が今すぐ必要'''なら、まっすぐ[[WordPress の最適化/キャッシング|キャッシングページ]]へ向かってください。最低限の努力で最大の効果を得られるでしょう。
  
 
=== WordPress 設定の最適化 ===
 
=== WordPress 設定の最適化 ===
117行目: 114行目:
 
** Are there any unnecessary images? (e.g. Can you replace some of the images with text?)
 
** Are there any unnecessary images? (e.g. Can you replace some of the images with text?)
 
** Make sure all image files are optimized. Choose the correct format (JPG/PNG/GIF) for the type of image.
 
** Make sure all image files are optimized. Choose the correct format (JPG/PNG/GIF) for the type of image.
** [http://developer.yahoo.com/yslow/smushit/ Smush.it] and [http://wordpress.org/extend/plugins/wp-smushit/ WP Smush.it] plugin can also help.
 
  
 
* 合計のファイル数/サイズ
 
* 合計のファイル数/サイズ
123行目: 119行目:
 
** Combine multiple CSS files into a single, optimized file.
 
** Combine multiple CSS files into a single, optimized file.
 
** Minify CSS and JavaScript files.
 
** Minify CSS and JavaScript files.
** If necessary, look into plugins to help this process (e.g. [http://wordpress.org/extend/plugins/head-cleaner/ Head Cleaner] and [http://wordpress.org/extend/plugins/wp-minify/ WP Minify]).
+
** If necessary, look into [https://wordpress.org/plugins/tags/minify plugins to help this process].
  
 
* Query Reduction/Optimization
 
* Query Reduction/Optimization
134行目: 130行目:
 
You can also use [[WordPress Optimization/Offloading|offloading]] to optimize your theme.
 
You can also use [[WordPress Optimization/Offloading|offloading]] to optimize your theme.
  
=== Let Someone Else Do It ===
+
=== 他の人に任せる ===
Using a Managed Hosting solution such as [http://wordpress.com WordPress.com], [http://page.ly Page.ly] or [http://wpengine.com WPEngine] takes advantage of the hard work and expertise of service providers to do the heavy lifting of optimization for you.
+
[http://wordpress.com WordPress.com][https://pagely.com Pagely][http://wpengine.com WPEngine] などのマネージドホスティングソリューションを使うことで、サービスプロバイダの努力と専門知識を活用し、最適化を大幅に強化できます。
  
 
=== ハードウェアのアップグレード ===
 
=== ハードウェアのアップグレード ===
  
Paying more for higher service levels at your hosting provider can be very effective. Increasing memory (RAM) or switching to a host with Solid State Drives (SSD) e.g. Digital Ocean can make a big difference. Increased number of processors and processor speed will also help.
+
お使いのホスティングプロバイダのさらに高いサービスレベルに対してより高い金額を支払うことは非常に効果的になり得ます。ソリッドステートドライブ (SSD) を搭載したホストへのメモリ (RAM) の増設や切り替え (例: Digital Ocean) は大きな違いを生むことができます。プロセッサ数の増加とプロセッサ速度の向上も役立ちます。
  
 
=== ソフトウェアの最適化 ===
 
=== ソフトウェアの最適化 ===
149行目: 145行目:
 
'''Web Server''': Your web server can be configured to increase performance. There are a range of techniques from web server caching to setting cache headers to reduce load per visitor. Search for your specific web server optimizations (for example, search for "apache optimization" for more info). Some web servers have higher speed versions you can pay for such as [http://www.litespeedtech.com/products/litespeed-web-server/features/apache-drop-in-replacement Apache Litespeed]. There are also a number of ways to tune Apache for higher performance based on your particular hosting and site configuration, e.g. Memcache.
 
'''Web Server''': Your web server can be configured to increase performance. There are a range of techniques from web server caching to setting cache headers to reduce load per visitor. Search for your specific web server optimizations (for example, search for "apache optimization" for more info). Some web servers have higher speed versions you can pay for such as [http://www.litespeedtech.com/products/litespeed-web-server/features/apache-drop-in-replacement Apache Litespeed]. There are also a number of ways to tune Apache for higher performance based on your particular hosting and site configuration, e.g. Memcache.
  
'''PHP''': There are various PHP accelerators available which can dramatically improve performance of your PHP files. This will apply to all PHP files, not just your WordPress installation. Search for PHP optimization for more information, f.e. [http://php.net/apc APC]. The W3 Total Cache plugin, described below, offers integrated support for Memcache, APC and other Opcode caching.
+
'''PHP''': There are various PHP accelerators available which can dramatically improve performance of your PHP files. This will apply to all PHP files, not just your WordPress installation. Search for PHP optimization for more information, f.e. [http://php.net/apc APC].
  
'''MySQL''': MySQL optimization is a black art in itself. A few simple changes to the query cache settings can have a dramatic effect on WordPress performance because WordPress repeats a lot of queries on every request. Search for mysql optimization for more.
+
'''MySQL/MariaDB''': MySQL or MariaDB optimization is a black art in itself. A few simple changes to the query cache settings can have a dramatic effect on WordPress performance because WordPress repeats a lot of queries on every request. Search for mysql optimization for more.
  
 
A great example of how WordPress has been optimized was presented by [http://wordpress.tv/2012/09/01/iliya-polihronov-high-performance-wordpress/ Iliya Polihronov at WordCamp San Francisco 2012]. Iliya, among other things, does server optimization for WordPress.com.
 
A great example of how WordPress has been optimized was presented by [http://wordpress.tv/2012/09/01/iliya-polihronov-high-performance-wordpress/ Iliya Polihronov at WordCamp San Francisco 2012]. Iliya, among other things, does server optimization for WordPress.com.
161行目: 157行目:
 
==== キャッシュプラグイン ====
 
==== キャッシュプラグイン ====
  
Plugins like [http://wordpress.org/extend/plugins/w3-total-cache/ W3 Total Cache] or [http://wordpress.org/extend/plugins/wp-super-cache/ WP Super Cache] can be easily installed and will cache your WordPress posts and pages as static files. These static files are then served to users, reducing the processing load on the server. This can improve performance several hundred times over for fairly static pages.
+
[https://wordpress.org/plugins/tags/caching Caching plugins] can be easily installed and will cache your WordPress posts and pages as static files. These static files are then served to users, reducing the processing load on the server. This can improve performance several hundred times over for fairly static pages.
  
 
When combined with a system level page cache such as Varnish, this can be quite powerful. If your posts/pages have a lot of dynamic content configuring caching can be more complex.
 
When combined with a system level page cache such as Varnish, this can be quite powerful. If your posts/pages have a lot of dynamic content configuring caching can be more complex.
 
===== W3 Total Cache =====
 
 
[http://wordpress.org/extend/plugins/w3-total-cache/ W3 Total Cache] (W3TC) is the latest generation in WordPress performance plugins, combining the research of [http://developer.yahoo.com/performance/rules.html web development authorities] to provide an optimal user experience for WordPress sites. These detailed guides walk you through
 
 
W3TC is unique in its ability to optimize server side and client side performance, adding functionality otherwise unavailable natively:
 
 
* Page Caching: W3TC helps to decrease response time by creating static HTML versions of pages, allowing web servers to serve them without invoking PHP. It automatically updates the cache when comments are made or pages are edited.
 
* Minification: Removes unnecessary characters from HTML, CSS and JavaScript files, then respectively combines them before applying HTTP compression on the cached files.
 
* Database Caching: Database queries (objects) are also cached, allowing many sites to reduce the time needed to generate new pages. This is especially useful for sites that receive a lot of comments.
 
* Headers: W3TC manages the headers (entity tag, cache-control, expires) which control the caching of files in web browsers, reducing server load and improving the user's perceived performance.
 
* Content Delivery Network (CDN): Using a CDN allows you to [[WordPress_Optimization#Offloading|Offloading]] resources from your hosting account. W3TC moves the requests for images, CSS, JavaScript and other static files to a network of high performance servers. The server closest to the visitor is automatically used to download the files, providing the fastest downloads possible.
 
 
W3TC can be used to optimize WordPress in both single- and multi-server environments through either shared or dedicated hosting.
 
  
 
===== WP Super Cache =====
 
===== WP Super Cache =====
191行目: 173行目:
 
''Web server caching''' is more complex but is used in very high traffic sites. A wide range of options are available, beyond the scope of this article. The simplest solutions start with the server caching locally while more complex and involved systems may use multiple caching servers (also known as reverse proxy servers) "in front" of web servers where the WordPress application is actually running. Adding an opcode cache like [http://pecl.php.net/package/APC Alternative PHP Cache (APC)] to your server will improve PHP's performance by many times.
 
''Web server caching''' is more complex but is used in very high traffic sites. A wide range of options are available, beyond the scope of this article. The simplest solutions start with the server caching locally while more complex and involved systems may use multiple caching servers (also known as reverse proxy servers) "in front" of web servers where the WordPress application is actually running. Adding an opcode cache like [http://pecl.php.net/package/APC Alternative PHP Cache (APC)] to your server will improve PHP's performance by many times.
  
[https://www.varnish-cache.org/ Varnish Cache] works in concert with W3 Total Cache to store pre-built pages in memory and serve them quickly without requiring execution of the Apache, PHP, WordPress stack.   
+
[https://www.varnish-cache.org/ Varnish Cache] stores pre-built pages in memory and serve them quickly without requiring execution of the Apache, PHP, WordPress stack.   
  
 
As described within, using a plugin for comments such as Disqus instead of native WordPress comments can assist Varnish by not requiring your readers to login to WordPress and increasing the number of page views that Varnish can serve out of the cache.
 
As described within, using a plugin for comments such as Disqus instead of native WordPress comments can assist Varnish by not requiring your readers to login to WordPress and increasing the number of page views that Varnish can serve out of the cache.
200行目: 182行目:
  
 
Look into HTTP Cache-Control (specifically max-age) and Expires headers, as well as [http://en.wikipedia.org/wiki/HTTP_ETag Entity Tags] for more information.
 
Look into HTTP Cache-Control (specifically max-age) and Expires headers, as well as [http://en.wikipedia.org/wiki/HTTP_ETag Entity Tags] for more information.
 
W3 Total Cache integrates support for browser caching and ETags.
 
  
 
====  参考文献====
 
====  参考文献====
  
* [http://dougal.gunters.org/blog/2009/08/26/w3-total-cache-plugin W3 Total Cache Plugin] (by Dougal Campbell)
 
* [http://ocaoimh.ie/wp-super-cache/ Holy Shmoly!: WP Super Cache]
 
 
* [http://developer.yahoo.com/performance/rules.html Best Practices for Speeding Up Your Web Site] - Expires / Cache-Control Header and ETags (by Yahoo! Developer Network)
 
* [http://developer.yahoo.com/performance/rules.html Best Practices for Speeding Up Your Web Site] - Expires / Cache-Control Header and ETags (by Yahoo! Developer Network)
 
* [http://www.websiteoptimization.com/speed/tweak/cache/ WebSiteOptimization.com: Use Server Cache Control to Improve Performance]
 
* [http://www.websiteoptimization.com/speed/tweak/cache/ WebSiteOptimization.com: Use Server Cache Control to Improve Performance]
212行目: 190行目:
 
=== オフロード ===
 
=== オフロード ===
  
==== CDN(content Delivery Network)の使用 ====
+
==== CDN (コンテンツデリバリーネットワーク) の使用 ====
 +
 
 +
Using a CDN can greatly reduce the load on your website. Offloading the searching and delivery of images, javascript, css and theme files to a CDN is not only faster but takes great load off your WordPress server's own app stack. A CDN is most effective if used in conjunction with a [https://wordpress.org/plugins/tags/caching caching plugin].
  
Using a CDN can greatly reduce the load on your website. Offloading the searching and delivery of images, javascript, css and theme files to a CDN is not only faster but takes great load off your WordPress server's own app stack. A CDN is most effective if used in conjunction with a WordPress caching plugin such as W3TC, described above.  
+
Network, which also offers Internet Security services. Plans start from free, but additional features are available for extra costs. Cloudflare is a fixed-cost CDN, meaning they charge by features instead of usage. Cloudflare allows you to route your sites traffic through their network before coming back to your origin host. On Cloudflare's Knowledge Base they have have a guide on how to [https://support.cloudflare.com/hc/en-us/articles/228503147-Speed-Up-WordPress-and-Improve-Performance Speed Up WordPress and Improve Performance] whilst using their service.
  
 
[http://aws.amazon.com/cloudfront/ Amazon Cloudfront] uses the Amazon S3 service to provide Content Delivery Network (CDN) functionality for your static files. A CDN is a service which caches your static files on numerous web servers around the world. Providing faster download performance for your users no matter where they are. It's recommended that you use Cloudfront in tandem with S3 and not only S3 alone; the costs are not significantly different.  
 
[http://aws.amazon.com/cloudfront/ Amazon Cloudfront] uses the Amazon S3 service to provide Content Delivery Network (CDN) functionality for your static files. A CDN is a service which caches your static files on numerous web servers around the world. Providing faster download performance for your users no matter where they are. It's recommended that you use Cloudfront in tandem with S3 and not only S3 alone; the costs are not significantly different.  
 
[http://www.maxcdn.com/ MaxCDN] is a pay-per-usage Content Delivery Network (CDN) similar to Amazon Cloudfront. Among the differences are support for Video-on-demand as well as "mirroring" (no uploading required) of files, although you can upload them if you prefer.  
 
[http://www.maxcdn.com/ MaxCDN] is a pay-per-usage Content Delivery Network (CDN) similar to Amazon Cloudfront. Among the differences are support for Video-on-demand as well as "mirroring" (no uploading required) of files, although you can upload them if you prefer.  
  
Another alternative CDN provider is [https://www.keycdn.com/ KeyCDN]. They provide step-by-step WordPress integration guides on their [https://www.keycdn.com/support support page].
+
There are other CDN providers out there, so do some online searching, and you will more that may suit your needs.
 
+
KeyCDN and MaxCDN are among the most affordable CDN options available, they're able to beat the pricing of competitors like Amazon because they are a division of a much larger CDN Providers.
+
  
 
==== 静的コンテンツ ====
 
==== 静的コンテンツ ====
227行目: 205行目:
 
Any static files can be offloaded to another server. For example, any static images, JavaScript or CSS files can be moved to a different server. This is a common technique in very high performance systems (Google, Flickr, YouTube, etc) but can also be helpful for smaller sites where a single server is struggling. Also, moving this content onto different hostnames can lay the groundwork for multiple servers in the future.
 
Any static files can be offloaded to another server. For example, any static images, JavaScript or CSS files can be moved to a different server. This is a common technique in very high performance systems (Google, Flickr, YouTube, etc) but can also be helpful for smaller sites where a single server is struggling. Also, moving this content onto different hostnames can lay the groundwork for multiple servers in the future.
  
Some web servers are optimized to serve static files and can do so far more efficiently than more complex web servers like Apache, for example [http://en.wikipedia.org/wiki/Publicfile publicfile] or [http://en.wikipedia.org/wiki/Lighttpd lighttpd].
+
Some web servers are optimized to serve static files and can do so far more efficiently than more complex web servers like Apache, for example [http://en.wikipedia.org/wiki/Lighttpd lighttpd].
  
 
[http://aws.amazon.com/s3/ Amazon Simple Storage Service (S3)] is a dedicated static file hosting service on a pay-per-usage basis. With no minimum costs, it might be practical for lower traffic sites which are reaching the peak that a shared or single server can handle.
 
[http://aws.amazon.com/s3/ Amazon Simple Storage Service (S3)] is a dedicated static file hosting service on a pay-per-usage basis. With no minimum costs, it might be practical for lower traffic sites which are reaching the peak that a shared or single server can handle.
255行目: 233行目:
 
==== 参考文献 ====
 
==== 参考文献 ====
  
* Using Amazon S3 / Cloudfront to offload images: [http://www.larre.com/2010/01/24/amazon-s3-and-cloudfront-with-wordpress-and-dreamhost/ Amazon S3 and CloudFront with WordPress], [http://blog.gadodia.net/how-to-make-your-blog-independent-from-your-hosting/ How to make your blog independent from your hosting]
+
* Using Amazon S3 / Cloudfront to offload images: [http://www.larre.com/2010/01/24/amazon-s3-and-cloudfront-with-wordpress-and-dreamhost/ Amazon S3 and CloudFront with WordPress]
* [http://video.google.com/videoplay?docid=-8193919167634099306 Tutorial on Offloading Images from WordPress]
+
 
* [http://www.codinghorror.com/blog/archives/000807.html Reducing Your Website's Bandwidth Usage]
 
* [http://www.codinghorror.com/blog/archives/000807.html Reducing Your Website's Bandwidth Usage]
 
=== 圧縮 ===
 
 
There are a number of ways to compress files and data on your server so that your pages are delivered more quickly to readers' browsers. W3 Total Cache described above integrates support for most of the common approaches to compression.
 
 
W3 Total Cache supports Minify and Tidy to compress and combine your style sheets and javascript files. It also supports output compression such as zlib, see also [http://codex.wordpress.org/Output_Compression Output Compression].
 
 
It's also important to compress your media files - namely images. The [http://wordpress.org/plugins/wp-smushit/ WP Smushit] plugin can help with this.
 
  
 
=== データベースチューニング ===
 
=== データベースチューニング ===
271行目: 240行目:
 
==== データベースのクリーニング ====
 
==== データベースのクリーニング ====
  
[https://ja.wordpress.org/plugins/wp-optimize/ WP Optimize] プラグインはデータベース内の余分なclutterを軽減することができます。
+
多くのプラグインは、データベース内の余計ながらくたを減らすのに役立ちます。
 
+
また、投稿やページの[[Revision_Management|保存するリビジョンの数を最小限にする]] ようWordPressに設定できます。
+
 
+
=== サーバーの追加 ===
+
 
+
While it requires additional expertise, adding servers can be a powerful way to increase performance. I highly recommend reading [http://www.slideshare.net/harishganesan/scaling-wordpress-in-aws-amazon-ec2 Architecting a Highly Scalable WordPress Site in AWS] A guide for building a more expensive, highly scalable AWS implementation using Amazon's Relational Data Store (RDS).
+
 
+
You can use Amazon's Elastic Load Balancer to spread traffic across multiple web servers and you can use [https://wordpress.org/plugins/hyperdb/ HyperDB] or Amazon's RDS to run more scalable or multiple database servers.
+
  
 +
また、投稿やページの[[Revision_Management|保存するリビジョンの数を最小限にする]]よう WordPress を設定できます。
  
 
==== MySQL チューニングの参考文献 ====
 
==== MySQL チューニングの参考文献 ====
296行目: 258行目:
 
=== 参考文献 ===
 
=== 参考文献 ===
 
* [http://codex.wordpress.org/High_Traffic_Tips_For_WordPress High Traffic Tips for WordPress]
 
* [http://codex.wordpress.org/High_Traffic_Tips_For_WordPress High Traffic Tips for WordPress]
 +
* [http://yourescapefrom9to5.com/16-tips-to-improve-wordpress-site-performance-infographic 16 Quick Tips to Improve WordPress Performance – INFOGRAPHIC]
 
* [http://techtage.com/2013/09/speeding-up-wordpress-sites/ 17 Ways to Optimize and Speed Up WordPress Sites]
 
* [http://techtage.com/2013/09/speeding-up-wordpress-sites/ 17 Ways to Optimize and Speed Up WordPress Sites]
 
* [http://www.codeinwp.com/blog/ways-to-speed-up-wordpress/ 11 Ways to Speed Up WordPress]
 
* [http://www.codeinwp.com/blog/ways-to-speed-up-wordpress/ 11 Ways to Speed Up WordPress]
304行目: 267行目:
 
* [http://blog.circlesixdesign.com/2007/01/22/diggproof/ DiggProof your Wordpress]
 
* [http://blog.circlesixdesign.com/2007/01/22/diggproof/ DiggProof your Wordpress]
 
* [http://www.danielesalamina.it/ottimizza-le-prestazioni-del-tuo-blog-con-yslow Vuoi Ottimizzare le Prestazioni del tuo Blog? Prova con YSlow]
 
* [http://www.danielesalamina.it/ottimizza-le-prestazioni-del-tuo-blog-con-yslow Vuoi Ottimizzare le Prestazioni del tuo Blog? Prova con YSlow]
 +
* [https://hostingfacts.com/how-to-speed-up-your-website/ 21 easy tweaks to make your WP site load faster]
 +
* [https://www.mavenecommerce.com/blog/speed-up-wordpress-website-with-image-optimization/ How to Speed Up WordPress Website with Image Optimization]
 +
* [http://startbloggingonline.com/speed-up-wordpress/ Speeding up WordPress load from 4.23s to 1.33s (Case Study)]
 
* [http://www.prelovac.com/vladimir/wordpress-optimization-guide 10 tips for better WordPress optimization]
 
* [http://www.prelovac.com/vladimir/wordpress-optimization-guide 10 tips for better WordPress optimization]
 
* [http://storecrowd.com/blog/wordpress-optimisation/ WordPress 2.8 Optimization Guide - Benchmarking, Server Setup, Caching & reducing Queries]
 
* [http://storecrowd.com/blog/wordpress-optimisation/ WordPress 2.8 Optimization Guide - Benchmarking, Server Setup, Caching & reducing Queries]
321行目: 287行目:
 
{{NeedTrans}}
 
{{NeedTrans}}
  
{{原文|WordPress_Optimization|149447}}<!-- 10:30, 5 February 2015‎ Cardy web 版-->
+
{{原文|WordPress_Optimization|160616}}<!-- 15:09, 24 April 2017‎ RedSand 版-->
  
 
[[Category:上級トピック]]
 
[[Category:上級トピック]]

2017年7月20日 (木) 06:19時点における最新版

トラフィックの多い WordPress インストールを運営している場合は、WordPress とサーバーが出来る限り効率よく動くよう最適化したいと思うことでしょう。この記事ではその際に検討すべき全般的な概要を説明しています。各分野の細かい技術的な解説ではありません。

もしすばやい修正が今すぐ必要なら、まっすぐキャッシングページへ向かってください。最低限の努力で最大の効果を得られるでしょう。

WordPress 最適化へのイントロとしては、チートシートが良いでしょう。最適化関連のすべての記事は、WordPress の最適化カテゴリーで読めます。

高トラフィック WordPress サイト向けのヒントも参照してください。

ホスティングの設定により、使える最適化テクニックが違ってきます。この記事はホスティングサービスの種類によって分割しています。

共有サーバー

多くのユーザーとひとつのサーバーを共有してサイトがホスティングされている、最も一般的なホスティングの種類です。ホスティング会社がサーバーを管理するため、設定などを変更することはほとんどできません。この場合にもっとも意味のあるのは、以下の分野のテクニックです。

この分野も関連してくるかもしれません。

バーチャルホスト (VPS) / 専用サーバー

このホスティング環境では、自分のサーバーをコントロールすることができます。サーバーは専用のハードウェアの時もありますし、物理的にはひとつのハードウェアを共有しているバーチャルサーバーの場合もあります。キーとなるのは、サーバー設定を変更できるということです。上記 (キャッシングWordPress パフォーマンス) に加え、以下のテクニックが参考になるでしょう。

この分野も関連してくるかもしれません。

複数サーバー

非常にトラフィックの多いシチュエーションでは、複数のサーバーが必要になってきます。このレベルでは上記のうち適用できるすべてのテクニックを使っているべきです。

WordPress データベースは簡単に別サーバーへ移動でき、設定ファイルに少し変更を加えるだけで済みます。同様に、画像などの静的ファイルも代替サーバーに移動できます (オフロードを参照)。

複数のデータベースを採用する場合は、HyperDB クラスを標準の WPDB class にそのまま入れ替えることができ、レプリケーションおよびパーティション構造のどちらでも複数のデータベースサーバーに対応できます。

ハードウェアパフォーマンス

ハードウェア機能は、サイトのパフォーマンスに大きな影響を与えます。プロセッサーの数、プロセッサーの速度、使用可能なメモリーとディスク容量、ディスク記憶媒体も同様です。ホスティングプロバイダは一般的に、より高い価格でより高いパフォーマンスを提供しています。

ホスティングの革新のひとつとして、従来の磁気メディアよりも高速なソリッドステートドライブ (SSD) の使用があります。Digital Ocean は手頃な価格の SSD ホスティングを提供しており、Amazon は最近クラウドサービスに SSD ホスティングを追加しました。

WordPress 設定

テーマはサイトのパフォーマンスに大きな影響を与えるので、高速で軽量なテーマであるとより効率的に機能します。

また、プラグインの数とその性能も、サイトのパフォーマンスに大きな影響を与えます。不要なプラグインの無効化と削除は、パフォーマンスを向上させるために非常に重要です。

ソフトウェアパフォーマンス

最新のソフトウェアを使用しているかどうかを確認することも重要です。ソフトウェアのアップグレードによってバグが修正され、パフォーマンスが向上することがよくあります。 Linux (または Windows)、Apache、MySQL / MariaDB、および PHP の最新バージョンを実行していることを確認することは非常に重要です。

WordPress のアップグレードを続けることもまた重要です。

サーバー負荷

サーバー上のトラフィック量と、サーバーが負荷を処理するためにどのように構成されているかも大きな影響を与えます。たとえば、キャッシュソリューションを使用しない場合、追加のページリクエストが入ってスタックアップするとパフォーマンスが低下し、Web サーバーやデータベースサーバーがクラッシュすることがあります。適切に設定されている場合、ほとんどのホスティングソリューションは非常に高いトラフィックを処理できます。トラフィックを他のサーバーにオフロードすることで、サーバーの負荷を軽減することもできます。

ログイン攻撃、画像漏洩 (高トラフィックページからの画像ファイルへの他のサイトのリンク) や DoS 攻撃などの不正トラフィックは、サーバーの負荷を増加させる可能性があります。これらの攻撃を特定してブロックすることは非常に重要です。

画像サイズ

投稿内の画像を Web 用に最適化することで、時間と帯域幅を節約し、検索エンジンランキングを上昇させることができます。

地理的な距離

The distance between your server and your website visitors also has an impact on perceived performance. A Content Delivery Network or CDN can mirror static files and images across various geographic regions so that all of your site visitors have optimal performance.

お使いのサーバーとサイト訪問者との間の距離も、パフォーマンス認識に影響します。コンテンツ配信ネットワーク (CDN) は、さまざまな地域の静的なファイルと画像をミラーリングして、すべてのサイト訪問者に対して最適なパフォーマンスを発揮できるようにします。


パフォーマンスの計測方法

  • Google PageSpeed is an excellent way to measure your WordPress site's performance and receive clear, specific feedback on how to make improvements.
  • New Relic also provides a free library for measuring server performance in PHP and MySQL/MariaDB
  • Linux Top provides a dashboard for your server's real time performance.
  • If using Varnish Cache, VarnishStat helps assess the performance aspects of your caching tools.
  • Zend Server Z-Ray provides X-Ray vision and deep insight into your WordPress PHP application

パフォーマンステストのためのツール

WordPress のパフォーマンスを向上させるには

もしすばやい修正が今すぐ必要なら、まっすぐキャッシングページへ向かってください。最低限の努力で最大の効果を得られるでしょう。

WordPress 設定の最適化

最小化プラグイン

The first and easiest way to improve WordPress performance is plugins. Deactivate and delete any unnecessary plugins. Try selectively disabling plugins to measure server performance. Is one of your plugins significantly affecting your site's performance?

Then you can look at optimizing plugins. Are plugins coded inefficiently? Do they repeat unnecessary database queries? WordPress has its own caching system, so generally speaking, using functions like get_option(), update_option() and so on will be faster than writing SQL.

テーマ

After plugins come theme optimization.

  • 画像ファイル
    • Are there any unnecessary images? (e.g. Can you replace some of the images with text?)
    • Make sure all image files are optimized. Choose the correct format (JPG/PNG/GIF) for the type of image.
  • 合計のファイル数/サイズ
    • Can you reduce the number of files needed to display the average page on your site?
    • Combine multiple CSS files into a single, optimized file.
    • Minify CSS and JavaScript files.
    • If necessary, look into plugins to help this process.
  • Query Reduction/Optimization
    • Can static values be hardcoded into your themes? This will mean you have to edit code every time you make changes, but for generally static areas, this can be a good trade off.
      • For example, your site charset, site title, and so on.
      • Can you hardcode menus that rarely change? Avoiding functions like wp_list_pages() for example.

We have seen themes which put 3x extra load to the server. Turned out it caused 3x more database queries - which is bad in itself. Then we found out that some of the queries are unoptimized. Not good.

You can also use offloading to optimize your theme.

他の人に任せる

WordPress.comPagelyWPEngine などのマネージドホスティングソリューションを使うことで、サービスプロバイダの努力と専門知識を活用し、最適化を大幅に強化できます。

ハードウェアのアップグレード

お使いのホスティングプロバイダのさらに高いサービスレベルに対してより高い金額を支払うことは非常に効果的になり得ます。ソリッドステートドライブ (SSD) を搭載したホストへのメモリ (RAM) の増設や切り替え (例: Digital Ocean) は大きな違いを生むことができます。プロセッサ数の増加とプロセッサ速度の向上も役立ちます。

ソフトウェアの最適化

Make sure you are running the latest operating system version e.g. Linux, Windows and the latest web server e.g. Apache, database e.g. MySQL server and PHP.

DNS: Don't run a DNS on your WordPress server. Use a commercial service for DNS such as Amazon's Route 53 or your domain registrar's free offering. Using a service such as Amazon can also make switching between backup servers during maintenance or emergencies much easier. It also provides a degree of fault tolerance. If you host your DNS on external servers this will reduce the load on your primary web server. It's a simple change, but it will offload some traffic and cpu load.

Web Server: Your web server can be configured to increase performance. There are a range of techniques from web server caching to setting cache headers to reduce load per visitor. Search for your specific web server optimizations (for example, search for "apache optimization" for more info). Some web servers have higher speed versions you can pay for such as Apache Litespeed. There are also a number of ways to tune Apache for higher performance based on your particular hosting and site configuration, e.g. Memcache.

PHP: There are various PHP accelerators available which can dramatically improve performance of your PHP files. This will apply to all PHP files, not just your WordPress installation. Search for PHP optimization for more information, f.e. APC.

MySQL/MariaDB: MySQL or MariaDB optimization is a black art in itself. A few simple changes to the query cache settings can have a dramatic effect on WordPress performance because WordPress repeats a lot of queries on every request. Search for mysql optimization for more.

A great example of how WordPress has been optimized was presented by Iliya Polihronov at WordCamp San Francisco 2012. Iliya, among other things, does server optimization for WordPress.com.

Don't run a mail server on your WordPress server. For your contact form, use something like Contact Form 7 with free Mailgun.

キャッシュ

キャッシュプラグイン

Caching plugins can be easily installed and will cache your WordPress posts and pages as static files. These static files are then served to users, reducing the processing load on the server. This can improve performance several hundred times over for fairly static pages.

When combined with a system level page cache such as Varnish, this can be quite powerful. If your posts/pages have a lot of dynamic content configuring caching can be more complex.

WP Super Cache

WP Super Cache is a static page caching plugin for WordPress. It generates HTML files that are served directly by Apache without processing comparatively heavy PHP scripts, helping you to make significant speed gains on your WordPress blog.

WP Super Cache is a fork of WP Cache by Ricardo Galli Granada. WP Cache also caches your WordPress blog pages and delivers them without accessing the database. However, its use is no longer recommended, as WP Cache still needs the PHP engine to be loaded in order to serve the cached files.

However, WP Super Cache gets around this problem, allowing HTML files to be generated and served without ever invoking a single line of PHP. Using WP Super Cache allows your server to serve cached HTML pages at the same speed it serves regular graphic files. Consider WP Super Cache if your site is struggling to cope with its daily number of visitors, or if it appears on Digg.com, Slashdot.org or any other popular site.

サーバーサイドキャッシュ

Web server caching' is more complex but is used in very high traffic sites. A wide range of options are available, beyond the scope of this article. The simplest solutions start with the server caching locally while more complex and involved systems may use multiple caching servers (also known as reverse proxy servers) "in front" of web servers where the WordPress application is actually running. Adding an opcode cache like Alternative PHP Cache (APC) to your server will improve PHP's performance by many times.

Varnish Cache stores pre-built pages in memory and serve them quickly without requiring execution of the Apache, PHP, WordPress stack.

As described within, using a plugin for comments such as Disqus instead of native WordPress comments can assist Varnish by not requiring your readers to login to WordPress and increasing the number of page views that Varnish can serve out of the cache.

ブラウザーキャッシュ

Browser caching can help to reduce server load by reducing the number of requests per page. For example, by setting the correct file headers on files that don't change (static files like images, CSS, JavaScript etc) browsers will then cache these files on the user's computer. This technique allows the browser to check to see if files have changed, instead of simply requesting them. The result is your web server can answer many more 304 responses, confirming that a file is unchanged, instead of 200 responses, which require the file to be sent.

Look into HTTP Cache-Control (specifically max-age) and Expires headers, as well as Entity Tags for more information.

参考文献

オフロード

CDN (コンテンツデリバリーネットワーク) の使用

Using a CDN can greatly reduce the load on your website. Offloading the searching and delivery of images, javascript, css and theme files to a CDN is not only faster but takes great load off your WordPress server's own app stack. A CDN is most effective if used in conjunction with a caching plugin.

Network, which also offers Internet Security services. Plans start from free, but additional features are available for extra costs. Cloudflare is a fixed-cost CDN, meaning they charge by features instead of usage. Cloudflare allows you to route your sites traffic through their network before coming back to your origin host. On Cloudflare's Knowledge Base they have have a guide on how to Speed Up WordPress and Improve Performance whilst using their service.

Amazon Cloudfront uses the Amazon S3 service to provide Content Delivery Network (CDN) functionality for your static files. A CDN is a service which caches your static files on numerous web servers around the world. Providing faster download performance for your users no matter where they are. It's recommended that you use Cloudfront in tandem with S3 and not only S3 alone; the costs are not significantly different. MaxCDN is a pay-per-usage Content Delivery Network (CDN) similar to Amazon Cloudfront. Among the differences are support for Video-on-demand as well as "mirroring" (no uploading required) of files, although you can upload them if you prefer.

There are other CDN providers out there, so do some online searching, and you will more that may suit your needs.

静的コンテンツ

Any static files can be offloaded to another server. For example, any static images, JavaScript or CSS files can be moved to a different server. This is a common technique in very high performance systems (Google, Flickr, YouTube, etc) but can also be helpful for smaller sites where a single server is struggling. Also, moving this content onto different hostnames can lay the groundwork for multiple servers in the future.

Some web servers are optimized to serve static files and can do so far more efficiently than more complex web servers like Apache, for example lighttpd.

Amazon Simple Storage Service (S3) is a dedicated static file hosting service on a pay-per-usage basis. With no minimum costs, it might be practical for lower traffic sites which are reaching the peak that a shared or single server can handle.

複数のホスト名

There can also be user improvements by splitting static files between multiple hostnames. Most browser will only make 2 simultaneous requests to a server, so if you page requires 16 files they will be requested 2 at a time. If you spread that between 4 host names they will be requested 8 at a time. This can reduce page loading times for the user, but it can increase server load by creating more simultaneous requests. Also, known is "pipelining" can often saturate the visitor's internet connection if overused.

Offloading images is the easiest and simplest place to start. All images files could be evenly split between three hostnames (assets1.yoursite.com, assets2.yoursite.com, assets3.yoursite.com for example). As traffic grows, these hostnames could be moved to your own server. Note: Avoid picking a hostname at random as this will affect browser caching and result in more traffic and may also create excessive DNS lookups which do carry a performance penalty.

Likewise any static JavaScript and CSS files can be offloaded to separate hostnames or servers.

フィード

Your feeds can quite easily be offloaded to an external service. Feed tracking services like Google FeedBurner will do this automatically, the Feedburner servers will handle all the feed traffic and only update the feed from your site every few minutes. This can be a big traffic saver.

Likewise you could offload your own feeds to a separate server (feeds.yoursite.com for example) and then handle your own feed stats / advertising.

無料ホスティングサービス

It may be possible to host some of your files on external servers for free. For example, popular image hosting web sites like Flickr provide image hosting at no cost. Even offloading your most popular images to a free service could significantly reduce the impact on your main server.

However, there is a very important issue to consider when using a free service to offload your images. Since most of the popular services are actually photo sharing sites, copyright becomes a concern. Be sure to read the service disclaimer and decide if it suits you. Moreover, you may not want your images exposed to the users of the photo sharing site.

Consider that free image hosting services are recently becoming a less viable choice since traffic from them is often blocked by corporate networks.

参考文献

データベースチューニング

データベースのクリーニング

多くのプラグインは、データベース内の余計ながらくたを減らすのに役立ちます。

また、投稿やページの保存するリビジョンの数を最小限にするよう WordPress を設定できます。

MySQL チューニングの参考文献

WordPress 向けの MySQL チューニングおよびサーバー設定については以下などを参考にしてください。

参考リンク

参考文献


WordCamp 講演


このページ「WordPress の最適化」は未翻訳です。和訳や日本語情報を加筆してくださる協力者を求めています

最新英語版: WordPress Codex » WordPress_Optimization最新版との差分