Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 编辑一篇文章,99%的CPU?_Php_Mysql_Wordpress - Fatal编程技术网

Php 编辑一篇文章,99%的CPU?

Php 编辑一篇文章,99%的CPU?,php,mysql,wordpress,Php,Mysql,Wordpress,我有一个博客,有大约15k篇文章,数据库大小为14.4米 该网站从前端开始运行速度极快,但后期编辑和后期列表屏幕挂起——要么部分加载,要么根本不加载 更糟糕的是,整个服务器在尝试后陷入困境 检查流程管理器时发现/public\u html/wp admin/edit.php或/public\u html/wp admin/post.php(分别为post list和post edit-是的,我知道它们似乎是反向的)消耗了99%的CPU 我在第三层Bluehost VPS上遇到了这个问题,因此我升

我有一个博客,有大约15k篇文章,数据库大小为14.4米

该网站从前端开始运行速度极快,但后期编辑和后期列表屏幕挂起——要么部分加载,要么根本不加载

更糟糕的是,整个服务器在尝试后陷入困境

检查流程管理器时发现
/public\u html/wp admin/edit.php
/public\u html/wp admin/post.php
(分别为post list和post edit-是的,我知道它们似乎是反向的)消耗了99%的CPU

我在第三层Bluehost VPS上遇到了这个问题,因此我升级到了Heart Internet Hybrid 250(12core,28gb ram)以尝试缓解这个问题-没有风险:/

非常感谢为解决此问题提供的任何帮助-告诉客户他们必须通过phpMyAdmin编辑页面是不可取的:)

编辑:关于悬挂过程的澄清

edit2:运行MySQL进程:

Id      User    Host        db  Command     Time    State   Info

338     leech.. localhost   leech.. Sleep   1959            NULL
426     tmhp_.. localhost   tmhp_.. Sleep   581             NULL
433     root    localhost   NULL    Sleep   132             NULL
441     root    localhost   NULL    Query   0       NULL    SHOW PROCESSLIST
流程示例:

Pid     Owner   Priority    CPU %   Memory %    Command
29447   tmhp        0       99.8    0.6         /usr/bin/php /home/tmhp/public_html/wp-admin/edit.php
Edit3:这可能是相关的:在“添加新页面”或“编辑后页面”上加载标题并可编辑,但内容编辑器加载一半。此外,文本显示为白色,仅在高亮显示时可见

Edit4:用户tmhp的MySQL进程在杀死导致问题的挂起(99%)进程后消失。。。。我想我们可能发现了什么

Edit5:此对话已转移到

如果有足够的时间(~3-5分钟),编辑后页面将完全加载,并且过程将终止。然而,这种情况似乎不会发生在post列表页面上

此外,我已经将编辑后页面上的问题缩小到页面属性元框

作为一种短期补救措施,我创建了一个插件,该插件具有以下功能:

//Remove some features of pages so editing is faster
if (is_admin()) :
function my_remove_meta_boxes() {
    remove_meta_box('pageparentdiv', 'page', 'side');
}
add_action( 'admin_menu', 'my_remove_meta_boxes' );
endif;

function remove_page_attribute_support() {
    remove_post_type_support('page','page-attributes');
}

add_action( 'init', 'remove_page_attribute_support' );


// Remove the Posts and Pages menus from the admin screen
function custom_admincss() {
   echo '<style type="text/css">
           #menu-pages{display:none !important}
           #menu-posts{display:none !important}
         </style>';
}

add_action('admin_head', 'custom_admincss');
//删除页面的某些功能,以便更快地进行编辑
如果(is_admin()):
函数my_remove_meta_box(){
移除“元”框(“pageparentdiv”、“page”、“side”);
}
添加操作(“管理”菜单、“我的”删除元框”);
endif;
函数删除\页面\属性\支持(){
删除帖子类型支持('page','page-attributes');
}
添加操作('init','remove_page_attribute_support');
//从管理屏幕中删除帖子和页面菜单
函数自定义_admincss(){
回声'
#菜单页面{显示:无!重要}
#菜单帖子{显示:无!重要}
';
}
添加动作(“管理员头部”、“自定义管理员”);

我将其固定到

层次结构

(布尔值)(可选)帖子类型是否为层次结构(例如页面)

允许指定父项。“supports”参数应包含“page attributes”,以在编辑器页面上显示父选择框

默认值:false

注意:此参数计划用于页面。在为自定义帖子类型选择它时要小心——如果您计划有许多条目(比如超过100条),您将遇到内存问题。当此参数设置为true时,WordPress将在您的帖子类型的每个管理页面加载上获取该特定帖子类型的所有条目以及所有元数据


现在,你知道如何在不覆盖核心的情况下删除对页面的分层支持吗?

在你试图加载的页面上加载了多少篇文章?和但首先,禁用所有插件并将主题切换到Twenty11/12/1399%procent关闭PHP应用程序/网站性能问题是由错误的查询(最有可能是没有索引)引起的。。。因此,您需要查看MySQL中的SHOW FULL PROCESS(显示完整进程)以查看是否存在长时间运行的查询,并使用EXPLAIN语句对其进行分析。@matthewpavkov登录后页面现在可以显示所有页面,但仍然会导致服务器挂起(即使登录页面关闭,99%的CPU仍会保持)@brasofilo谢谢,我现在正在阅读那些资源。这是一个全新的安装,没有插件运行-主题设置为2012我只是想了解Wordpress如何处理分层页面。我不敢相信它会选择所有页面(和所有字段)来创建分页列表。这太疯狂了。我知道,制作一个类似于树的列表是很复杂的,解决方法之一就是用类似的方法来做。但是,获取页面内容的目的是什么?