繁体   English   中英

WordPress的千类崩溃网站

[英]Wordpress thousand of categories crashing site

我有一个大型网站,目前每天大约有1万个唯一身份访问者,我有2000个类别,12k个标签,36k个自定义分类法。

这不是设计缺陷,因为我使用它作为观看在线电影的网站,还列出了Seasons类别以及类似内容,自定义分类法是Actor,regizor等。

问题是我的主机一直在使用100%处理器崩溃,资源不会成为问题,因为我有自己的服务器,带有4xXeon,64 GB内存。

我已经隔离了问题,例如由于查询速度非常慢,我有什么选择?

 # Time: 160830 17:01:20 # User@Host: razvypp[razvypp] @ localhost [] # Query_time: 9.159090 Lock_time: 0.001680 Rows_sent: 30 Rows_examined: 420117 SET timestamp=1472565680; SELECT wphn_posts.ID FROM wphn_posts INNER JOIN wphn_term_relationships ON (wphn_posts.ID = wphn_term_relationships.object_id) WHERE 1=1 AND ( wphn_term_relationships.term_taxonomy_id IN (3630, 4955,4956,4957,4958,4959,4960,4961,4962,4963,4964,4965, 4966,4967,4968,4969,4970,4971,4972,4973,4974,4975,4976, 4977,4978,4979,4980,4981,4982,4983,4984,4985,4986,4987, 4988,4989,4990,4991,4992,4993,4994,4995,4996,4997,4998, 4999,5000,5001,5002,5003,5004,5005,5006,5007,5008,5009, 5010,5011,5012, ... (hundreds of numbers) ...,49740,49779) 

这是表的转储

 -- phpMyAdmin SQL Dump -- version 4.4.15 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: 30 Aug 2016 la 15:17 -- Versiune server: 5.5.51-log -- PHP Version: 5.5.37 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `trolio` -- -- -------------------------------------------------------- -- -- Structura de tabel pentru tabelul `wphn_posts` -- CREATE TABLE IF NOT EXISTS `wphn_posts` ( `ID` bigint(20) unsigned NOT NULL, `movie_type` int(2) NOT NULL, `post_author` bigint(20) unsigned NOT NULL DEFAULT '0', `post_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `post_date_gmt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `post_content` longtext NOT NULL, `post_title` text NOT NULL, `post_excerpt` text NOT NULL, `post_status` varchar(20) NOT NULL DEFAULT 'publish', `comment_status` varchar(20) NOT NULL DEFAULT 'open', `ping_status` varchar(20) NOT NULL DEFAULT 'open', `post_password` varchar(20) NOT NULL DEFAULT '', `post_name` varchar(200) NOT NULL DEFAULT '', `to_ping` text NOT NULL, `pinged` text NOT NULL, `post_modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `post_modified_gmt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `post_content_filtered` longtext NOT NULL, `post_parent` int(20) unsigned NOT NULL DEFAULT '0', `guid` varchar(255) NOT NULL DEFAULT '', `menu_order` int(11) NOT NULL DEFAULT '0', `post_type` varchar(20) NOT NULL DEFAULT 'post', `post_mime_type` varchar(100) NOT NULL DEFAULT '', `comment_count` bigint(20) NOT NULL DEFAULT '0', `views` int(99) NOT NULL, `views_this_week` int(5) NOT NULL, `imdb` double NOT NULL, `imdb_votes` float NOT NULL, `imdb_id` varchar(20) NOT NULL, `fb_shares_root` int(5) NOT NULL, `movie_name` varchar(140) NOT NULL, `season` int(2) NOT NULL, `episode` int(5) NOT NULL, `serial_id` int(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Structura de tabel pentru tabelul `wphn_term_relationships` -- CREATE TABLE IF NOT EXISTS `wphn_term_relationships` ( `object_id` bigint(20) unsigned NOT NULL DEFAULT '0', `term_taxonomy_id` bigint(20) unsigned NOT NULL DEFAULT '0', `term_order` int(11) NOT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Structura de tabel pentru tabelul `wphn_term_taxonomy` -- CREATE TABLE IF NOT EXISTS `wphn_term_taxonomy` ( `term_taxonomy_id` bigint(20) unsigned NOT NULL, `term_id` bigint(20) unsigned NOT NULL DEFAULT '0', `taxonomy` varchar(32) NOT NULL DEFAULT '', `description` longtext NOT NULL, `parent` bigint(20) unsigned NOT NULL DEFAULT '0', `count` bigint(20) NOT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Indexes for dumped tables -- -- -- Indexes for table `wphn_posts` -- ALTER TABLE `wphn_posts` ADD PRIMARY KEY (`ID`), ADD KEY `post_name` (`post_name`(191)), ADD KEY `type_status_date` (`post_type`,`post_status`,`post_date`,`ID`), ADD KEY `post_parent` (`post_parent`), ADD KEY `post_author` (`post_author`), ADD KEY `serial_id` (`serial_id`), ADD KEY `episode` (`episode`), ADD KEY `season` (`season`), ADD KEY `movie_name` (`movie_name`); -- -- Indexes for table `wphn_term_relationships` -- ALTER TABLE `wphn_term_relationships` ADD PRIMARY KEY (`object_id`,`term_taxonomy_id`), ADD KEY `term_taxonomy_id` (`term_taxonomy_id`), ADD KEY `term_order` (`term_order`); -- -- Indexes for table `wphn_term_taxonomy` -- ALTER TABLE `wphn_term_taxonomy` ADD PRIMARY KEY (`term_taxonomy_id`), ADD UNIQUE KEY `term_id_taxonomy` (`term_id`,`taxonomy`), ADD KEY `taxonomy` (`taxonomy`), ADD KEY `parent` (`parent`), ADD KEY `count` (`count`), ADD KEY `term_id` (`term_id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `wphn_posts` -- ALTER TABLE `wphn_posts` MODIFY `ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `wphn_term_taxonomy` -- ALTER TABLE `wphn_term_taxonomy` MODIFY `term_taxonomy_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 

“行检查” = 420K-缺少索引。

可能丢失:

INDEX(term_taxonomy_id, object_id)

请提供两个表的SHOW CREATE TABLE

innodb_buffer_pool_size的值是innodb_buffer_pool_size

暂无
暂无

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

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