Moodle/MYSQL Performance...

Moodle/MYSQL Performance...

by Jeffrey Peninger -
Number of replies: 1

Recently I installed 1.8.2 with the CPanel of a more well known host, who at this juncture shall go nameless, to protect the innocent and guilty... And had not modified the code in any manner.

I rercieved a notification of the following:

======Start======

We were monitoring the server that hosts your account and while reviewing the logs noticed that your website cahseehelp.org was consuming a very high percentage of the server resources (processors' time and memory usage), thus endangering the overall performance of all the sites on the server. In order to keep the server at normal CPU load , we had to limit the shared server resources your account may use. Please note that this may result in occasional "Resource temporary unavailable" error messages, shown on your website.

We have conducted a detailed investigation of the reason for the high resource consumption and it turned out that your website executes slow queries towards its database, which eventually hogs the server. The server tries to execute your slow queries while making other processes stay in the queue until some memory is freed. While they are waiting however, they stack up and further deteriorate the problem.

The reasons for such slow queries can be several:

1. Large database
2. Not well written scripts
3. Large number of internal links that query the database directly.

Upon further investigation, it turned out that the following queries in your account are slow and heavily consume server resources:

Recent slow queries:

# Time: 071105 13:49:50
# User@Host: cahseehe_mdle1[cahseehe_mdle1] @ localhost []
# Query_time: 2 Lock_time: 0 Rows_sent: 0 Rows_examined: 0
use cahseehe_mdle1;
# administrator command: Init DB;
# Time: 071105 13:49:52
--
# Time: 071105 13:50:55
# User@Host: cahseehe_mdle1[cahseehe_mdle1] @ localhost []
# Query_time: 2 Lock_time: 0 Rows_sent: 0 Rows_examined: 0
use cahseehe_mdle1;
SELECT dc.id AS contentid, dr.id AS recordid, dc.content AS content, d.id AS dataid FROM mdl_data d, mdl_data_fields df, mdl_data_records dr, mdl_data_content dc WHERE (d.course = '3' or d.course = '1')AND d.id = df.dataid AND df.id = dc.fieldid AND d.id = dr.dataid AND dr.id = dc.recordid AND df.type = 'text' AND df.param1 = 1;
# Time: 071105 13:50:57
# User@Host: cahseehe_mdle1[cahseehe_mdle1] @ localhost []
# Query_time: 2 Lock_time: 0 Rows_sent: 0 Rows_examined: 0
SET insert_id=29770;
INSERT INTO mdl_cache_text ( MD5KEY, FORMATTEDTEXT, TIMEMODIFIED ) VALUES ( 'd07c3c54a357b54c466024c129ccd129', 'd. \frac16 ', 1194292255 );
# Time: 071105 13:50:59
# User@Host: cahseehe_mdle1[cahseehe_mdle1] @ localhost []
# Query_time: 2 Lock_time: 0 Rows_sent: 0 Rows_examined: 0
SELECT dc.id AS contentid, dr.id AS recordid, dc.content AS content, d.id AS dataid FROM mdl_data d, mdl_data_fields df, mdl_data_records dr, mdl_data_content dc WHERE (d.course = '3' or d.course = '1')AND d.id = df.dataid AND df.id = dc.fieldid AND d.id = dr.dataid AND dr.id = dc.recordid AND df.type = 'text' AND df.param1 = 1;
--
# Time: 071105 14:01:40
# User@Host: cahseehe_mdle1[cahseehe_mdle1] @ localhost []
# Query_time: 3 Lock_time: 0 Rows_sent: 0 Rows_examined: 0
use cahseehe_mdle1;
SELECT * FROM mdl_message WHERE useridto = '29' AND useridfrom = '16' ORDER BY timecreated;
# Time: 071105 14:02:46
# User@Host: cahseehe_mdle1[cahseehe_mdle1] @ localhost []
# Query_time: 3 Lock_time: 0 Rows_sent: 0 Rows_examined: 0
SELECT * FROM mdl_course WHERE category = '0' LIMIT 1;
--
# Time: 071105 14:05:54
# User@Host: cahseehe_mdle1[cahseehe_mdle1] @ localhost []
# Query_time: 2 Lock_time: 0 Rows_sent: 0 Rows_examined: 0
use cahseehe_mdle1;
# administrator command: Init DB;
# Time: 071105 14:06:01
--
SELECT * FROM livehelp_config;
# User@Host: cahseehe_mdle1[cahseehe_mdle1] @ localhost []
# Query_time: 2 Lock_time: 0 Rows_sent: 0 Rows_examined: 0
use cahseehe_mdle1;
SELECT * FROM mdl_config;
# User@Host: toplistc_blaster[toplistc_blaster] @ localhost []

SQL db size:
15660Kb - cahseehe_mdle1

In order to have the limitations removed, please optimize your script. If this problem with your website is not resolved in 7 days we may need to SUSPEND YOUR ACCOUNT.

======End=======

I ended up upgrading manually to 1.8.3+, then 1.9 - just to make sure I had the latest/greatest -

Is there something other than upgrading the script, and turning on the internal cache with 50 records that I can do to lessen the impact on MYSql?

Jeff

Average of ratings: -
In reply to Jeffrey Peninger

Re: Moodle/MYSQL Performance...

by Jeffrey Peninger -
No, Jeff there isn't...

Apparently 1.8.2 was a little buggy, and your hosting company are not very quick about upgrading their scripts...

It is a wiser move to learn to install your own code, and do not depend on hosting companies to provide with codes that work, they cannot be depended upon to provide the BEST version of any code...

(Pardon the dual personality...)

Jeffrey Peninger