web-dev-qa-db-ja.com

Wordpress 3.3.1 mySQLの非常に高いCPU使用率

私のホストはこのログを私に与えてくれ、そのmySQLが私のサーバーをオーバーロードしていることを教えてくれます:

| 266976 | db_name | localhost | db_name     | Query   | 30   | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS  wp2_posts.* FROM wp2_posts  INNER JOIN wp2_term_relationships ON (wp2_po |
| 266978 | db_name | localhost | db_name     | Query   | 29   | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS  wp2_posts.* FROM wp2_posts  INNER JOIN wp2_term_relationships ON (wp2_po |
| 266980 | db_name | localhost | db_name     | Query   | 45   | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS  wp2_posts.* FROM wp2_posts  INNER JOIN wp2_term_relationships ON (wp2_po |
| 266996 | db_name | localhost | db_name     | Query   | 43   | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS  wp2_posts.* FROM wp2_posts  INNER JOIN wp2_term_relationships ON (wp2_po |
| 267002 | db_name | localhost | db_name     | Query   | 44   | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS  wp2_posts.* FROM wp2_posts  INNER JOIN wp2_term_relationships ON (wp2_po |
| 267008 | db_name | localhost | db_name     | Query   | 10   | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS  wp2_posts.* FROM wp2_posts  INNER JOIN wp2_term_relationships ON (wp2_po |
| 267011 | db_name | localhost | db_name     | Query   | 30   | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS  wp2_posts.* FROM wp2_posts  INNER JOIN wp2_term_relationships ON (wp2_po |
| 267013 | db_name | localhost | db_name     | Query   | 30   | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS  wp2_posts.* FROM wp2_posts  INNER JOIN wp2_term_relationships ON (wp2_po |
| 267016 | db_name | localhost | db_name     | Query   | 30   | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS  wp2_posts.* FROM wp2_posts  INNER JOIN wp2_term_relationships ON (wp2_po |
| 267018 | db_name | localhost | db_name     | Query   | 13   | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS  wp2_posts.* FROM wp2_posts  INNER JOIN wp2_term_relationships ON (wp2_po |
| 267023 | db_name | localhost | db_name     | Query   | 30   | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS  wp2_posts.* FROM wp2_posts  INNER JOIN wp2_term_relationships ON (wp2_po |
| 267033 | db_name | localhost | db_name     | Query   | 44   | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS  wp2_posts.* FROM wp2_posts  INNER JOIN wp2_term_relationships ON (wp2_po |
| 267034 | db_name | localhost | db_name     | Query   | 44   | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS  wp2_posts.* FROM wp2_posts  INNER JOIN wp2_term_relationships ON (wp2_po |
| 267040 | db_name | localhost | db_name     | Query   | 43   | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS  wp2_posts.* FROM wp2_posts  INNER JOIN wp2_term_relationships ON (wp2_po |
| 267041 | db_name | localhost | db_name     | Query   | 10   | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS  wp2_posts.* FROM wp2_posts  INNER JOIN wp2_term_relationships ON (wp2_po |
| 267050 | db_name | localhost | db_name     | Query   | 42   | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS  wp2_posts.* FROM wp2_posts  INNER JOIN wp2_term_relationships ON (wp2_po |
| 267058 | db_name | localhost | db_name     | Query   | 38   | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS  wp2_posts.* FROM wp2_posts  INNER JOIN wp2_term_relationships ON (wp2_po |
| 267060 | db_name | localhost | db_name     | Query   | 29   | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS  wp2_posts.* FROM wp2_posts  INNER JOIN wp2_term_relationships ON (wp2_po |
| 267062 | db_name | localhost | db_name     | Query   | 30   | Copying to tmp table | SELECT p.* FROM wp2_posts AS p  INNER JOIN wp2_term_relationships AS tr ON p.ID = tr.object_id INNER |
| 267072 | db_name | localhost | db_name     | Query   | 34   | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS  wp2_posts.* FROM wp2_posts  INNER JOIN wp2_term_relationships ON (wp2_po |
| 267075 | db_name | localhost | db_name     | Query   | 34   | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS  wp2_posts.* FROM wp2_posts  INNER JOIN wp2_term_relationships ON (wp2_po |
| 267076 | db_name | localhost | db_name     | Query   | 30   | Copying to tmp table | SELECT p.* FROM wp2_posts AS p  INNER JOIN wp2_term_relationships AS tr ON p.ID = tr.object_id INNER |
| 267084 | db_name | localhost | db_name     | Query   | 19   | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS  wp2_posts.* FROM wp2_posts  INNER JOIN wp2_term_relationships ON (wp2_po |
| 267087 | shonline     | localhost | shonline_sho2011 | Query   | 15   | update               | INSERT INTO accesslog (title, path, url, hostname, uid, sid, timer, timestamp) VALUES ('????         |
| 267088 | db_name | localhost | db_name     | Query   | 2    | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS  wp2_posts.* FROM wp2_posts  INNER JOIN wp2_term_relationships ON (wp2_po |
| 267089 | db_name | localhost | db_name     | Query   | 30   | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS  wp2_posts.* FROM wp2_posts  INNER JOIN wp2_term_relationships ON (wp2_po |

サーバーは、Xeonクアッドコア、4GB RAM、2Mビットのアップ/ダウン帯域幅です。毎月200万人の訪問者。 Apacheを500に同時設定し、SQLを250に設定しました。

プラグイン:Adrotate/Contact Form 7/Disqus/Events/Jetpack/Really Simple Captcha/Use Google Libraries/WebsiteDefender/Wordpress.com Popular Posts/WP-Page Navi/WP-Print/WP-Minify/WP-Super Cache

どうすれば修正できますか?

2
Nders

Copying to tmp tableが表示される場合、それは多くの場合、実行に時間がかかる悪いクエリを作成したことを示しています。投稿には、実行に45秒以上かかっているものがいくつか表示されています。実行に時間がかかるクエリを特定します。

インデックスを適切に使用するには、これらのクエリを変更する必要があります。それには、どのプラグインがそれらを開始しているのかを知る必要があるかもしれません。

1
Jeff Ferland

「現在の訪問者」には興味がありませんが、同時訪問者の数には興味があります。 wordpressには、同時ユーザーの数をカウントできるプラグインはありません。確認すべきことがいくつかあります。

  • スーパーキャッシュが機能していると確信していますか?
  • 問題がmysqlデータベースにあると確信していますか(スーパーキャッシュが機能している場合、mysqlデータベースではなく、サーバーとおそらくサーバーへのネットワーク速度に問題があるはずです)
  • 共有ホスティングを使用している場合、その数のユーザーを獲得できれば、必ずそこから移動する必要があります:)
  • 配信する写真や静的コンテンツが多すぎる場合は、CDNを検討する必要があります。
0
user4589