1
SMPnet
Acct. Suspended: Too many resources
  • 2010/4/29 16:41

  • SMPnet

  • Just popping in

  • Posts: 5

  • Since: 2010/4/29


Hey everyone, I've got a bit of a problem I'm trying to figure out. I've got quite an active Xoops site which was pulled offline, "because my database was using too many resources on the server."

I was emailed the "details" which were as follows:

Quote:

It has come to our attention that your hosting account, specifically the database is causing the resources to be over-utilized.

We have disabled your database to return the server to normal usage. To re-enable your database, you will need to correct the following query:

SELECT t.*, p.post_time as last_post_time, p.poster_name as
last_poster_name, p.icon, p.post_id, p.uid FROM xoops_bb_topics t LEFT
JOIN xoops_bb_posts p ON p.post_id = t.topic_last_post_id LEFT JOIN
xoops_bb_reads_topic r ON r.read_item = t.topic_id WHERE p.post_time
> 0 AND (r.read_id IS NULL OR r.post_id < t.topic_last_post_id)
AND t.forum_id IN
(1,12,11,21,26,13,2,6,16,15,20,7,25,17,18,35,9,34,5,36,14,8,24,22,10,27)
AND t.approved = 1 AND p.approved = 1 ORDER BY p.post_time DESC LIMIT
0, 35

EXPLAIN:
id| select_type| table| type|
possible_keys| key| key_len| ref| rows|
Extra
1| SIMPLE| t| range|
forum_id,topic_last_post_id,approved| forum_id| 4| |
14007| Using where; Using temporary; Using filesort
1|
SIMPLE| p| eq_ref| PRIMARY,approved,post_time|
PRIMARY| 4| smxoops2.t.topic_last_post_id| 1|
Using where
1| SIMPLE| r| ALL| | |
| | 9038| Using where

This query examines
126595266 rows, which is unacceptable on this server.


This is a 2.4.4 install and within the past month I upgraded CBB 3.07 -> 3.08 as well as upgraded to 2.4.4 itself.

XOOPS Version - XOOPS 2.4.4
PHP Version - 4.3.11
MySQL Version - 4.1.22-max-log
Server API Version - cgi-fcgi
OS Version - Linux

safe_mode - Off
register_globals - Off
magic_quotes_gpc - On
allow_url_fopen - Off
fsockopen - On
allow_call_time_pass_reference - On
post_max_size - 8M
max_input_time - 60
output_buffering - 0
max_execution_time - 30
memory_limit -
file_uploads - On
upload_max_filesize - 2M

If anyone could lend a hand I'd really appreciate it. The Db should be re-enabled and I should be able to go in very shortly.

Anything more I can provide, please let me know. Thanks!!


2
kaotik
Re: Acct. Suspended: Too many resources
  • 2010/4/29 21:58

  • kaotik

  • Just can't stay away

  • Posts: 861

  • Since: 2004/2/19


Do you have a block on your main page that displays the latest forum topics?

If so you should consider caching that block. Even a 5 minute cache will do wonders in terms of database load.

3
ghia
Re: Acct. Suspended: Too many resources
  • 2010/4/29 22:50

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Try by modificating the query from
ORDER BY p.post_time DESC
to
ORDER BY t.topic_last_post_id DESC

4
SMPnet
Re: Acct. Suspended: Too many resources
  • 2010/4/29 23:38

  • SMPnet

  • Just popping in

  • Posts: 5

  • Since: 2010/4/29


On the front page, the very first displayed is "Recently Replied Topics". The fact that it updates immediately and shows which threads have latest posts makes it a favorite. I have been running it this way since 2004, do you believe that is the problem? The site has many, many, MANY threads and posts. It sees about 10K/mo in traffic so it is displayed quite often.

4-10-10 was the update to CBB 3.08 from 3.07 if that makes any difference. Switched to CK editor at that time also.

I'm also not sure "which" file is the offender. I have access to me Db again, but have the site "off" until I can figure this out. Too many times and the host is going to get angry.

Thanks for reading

5
ghia
Re: Acct. Suspended: Too many resources
  • 2010/4/30 6:08

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


You can put debug on, which will give a list of the queires and their timing.
You can try them and alternatives in phpMyAdmin (remember to add the table prefix).

Yes, I saw the number: 120 million. Is that a correct record count? (I can imaging that newbb (and maybe MySQL either) were designed to operate on this scale.) Are these still all relevant?
Anyway, I can see the hosters' problems/fears.

6
SMPnet
Re: Acct. Suspended: Too many resources
  • 2010/5/1 16:02

  • SMPnet

  • Just popping in

  • Posts: 5

  • Since: 2010/4/29


Just to let everyone know, I never really figured it out. The queries (even the one they mention) take .4xxx seconds to execute which looks on par with the other queries. I personally never noticed any slow down or long load times.

I don't think 120 million is a correct figure. We've got a DB which is about 1GB in size (thanks to forum posts) but there's only a few hundred-thousand posts. Not millions.

The site originally ran Xoops 2.0.6 and has been kept up with upgrades until the current 2.4.4. I suppose maybe all the updates over the years caused some issue.

I ended up just doing a fresh 2.4.4 install with latest modules and just copied over the tables needed to salvage user accounts/posts/PMs, etc and started from scratch with everything else. I went from MySQL 4.1 to 5 so the DB structure had to be tweaked slightly but everything is working well and the host confirms everything is alright with them now.

I am a long-time Xoops user and really enjoy the software. I like much better the direction Xoops is going now. Keep up the great work!

Thanks for all the comments!

7
ghia
Re: Acct. Suspended: Too many resources
  • 2010/5/2 0:43

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Quote:
I went from MySQL 4.1 to 5
Probably, this was the real step forward in the improvement (and perhaps together with the reload of the tables).

Login

Who's Online

225 user(s) are online (145 user(s) are browsing Support Forums)


Members: 0


Guests: 225


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits