Hi Guys,
I would really appreciate any help you could offer regarding this matter.
We have recently taken a modx evolution driven website live to replace an old and outdated we used to have. The site new works great however under even low visitor load 50-90 visitors modx seems to be eating the server and causing site-wide slow downs across all users to the point that the entire site is rendered unusable.
Via server monitoring it seems that the mysql process spikes to 800% CPU usage at times and is consistently going over 200/300% even with this low amount of traffic!!
The server runs Centos 6 with Apache in Fast CGI mode.
The site makes use of the following plugins:
YAMS (
http://modx.com/extras/package/yams)
Easy Gallery (
http://modx.com/extras/package/easy2gallery)
From the mysql slow logs only the following SQL statement crops up:
# Time: 130622 12:38:15
# User@Host: newbetat_beta[newbetat_beta] @ localhost []
# Query_time: 8.318775 Lock_time: 0.037026 Rows_sent: 256 Rows_examined: 1968694
SET timestamp=1371901095;
(SELECT sc.id AS docid, st.name AS name, IF(stc.value != '',stc.value,st.default_text) AS value, st.display AS display, st.display_params AS display_params, st.type AS$
# Time: 130622 12:38:17
# User@Host: newbetat_beta[newbetat_beta] @ localhost []
# Query_time: 8.088842 Lock_time: 0.024015 Rows_sent: 256 Rows_examined: 1968694
SET timestamp=1371901097;
(SELECT sc.id AS docid, st.name AS name, IF(stc.value != '',stc.value,st.default_text) AS value, st.display AS display, st.display_params AS display_params, st.type AS$
# Time: 130622 12:38:18
# User@Host: newbetat_beta[newbetat_beta] @ localhost []
# Query_time: 7.981864 Lock_time: 0.028773 Rows_sent: 256 Rows_examined: 1968694
SET timestamp=1371901098;
(SELECT sc.id AS docid, st.name AS name, IF(stc.value != '',stc.value,st.default_text) AS value, st.display AS display, st.display_params AS display_params, st.type AS$
As you can see the query time is through the roof.
The server error logs show a lot of the following:
[warn] [client 54.224.71.248] mod_fcgid: read data timeout in 45 seconds, referer:
[error] [client 54.224.71.248] Premature end of script headers: index.php, referer:
The site itself is highly ajax driven and pulls a lot of various sections via ajax pages at regular intervals.
The ajax pages also make use of ModX in API mode. The following is an extract of the php code used to initialize the ModX class in the ajax pages:
<?php
header('Content-Type: text/html; charset=UTF-8');
// Setup the MODx API
define('MODX_API_MODE', true);
define('MODX_BASE_URL', '/');
define('MODX_SITE_URL', '/');
include_once($_SERVER['DOCUMENT_ROOT'].'/index.php');
if ($modx instanceof DocumentParser)
{
//Rest of php code goes in here with access to the $modx class.
}
?>