Hi. The performance of my (Drupal 5.7) site has been degrading a lot in the last few days.

Given that the only changes have been core and module upgrades, and the reader traffic has actually decreased, from more than 150.000 unique users a month down to around 130.000 users, I guess there's some problem with the code itself.

Another symptom is that the number of connected users (according to Drupal) keeps growing to previously unknown levels, while the site gets slower and slower until the DB finally times out and Drupal displays the dreaded 'Unable to connect to database' screen with a warning about 'too many connections'. Most content posting operations get broken uncompleted, with user sessions disconnected.

Of course, Drupal caching is enabled, as is throttle for most of the modules.

My hosting support have said:

currently your server is executing 210+ mysql queries per second. I just checked one shared server hosting 500+ sites and found it getting ~20 mysql queries per second only

and they have given up.

I have noticed several PHP, DB-related entries in the watchdog, but I'm unable to identify their source:

Lost connection to MySQL server during query query: SELECT sid FROM sessions WHERE sid = '5bfb6670512c7ad8a2f11ebf7389b4ef' in line 173 of file /home/MYSITE/public_html/includes/database.mysql.inc.

Line 173 says:

trigger_error(check_plain(mysql_error($active_db) ."\nquery: ". $query), E_USER_WARNING);
    return FALSE;

Another error:

mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/MYSITE/public_html/includes/database.mysql.inc on line 189.

Line 189 says:

return mysql_fetch_object($result);

Another error:

Table 'temp_search_sids' already exists query: CREATE TEMPORARY TABLE temp_search_sids SELECT i.type, i.sid, SUM(i.score * t.count) AS relevance, COUNT(*) AS matches FROM search_index i INNER JOIN search_total t ON i.word = t.word INNER JOIN node n ON n.nid = i.sid LEFT JOIN i18n_node i18n ON n.nid = i18n.nid INNER JOIN users u ON n.uid = u.uid WHERE n.status = 1 AND (i18n.language ='es' OR i18n.language ='' OR i18n.language IS NULL) AND (i.word = 'ipaq') AND i.type = 'node' GROUP BY i.type, i.sid HAVING COUNT(*) >= 1 en la línea 173 del archivo /home/MYSITE/public_html/includes/database.mysql.inc.

Yet another one:

mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/MYSITE/public_html/includes/database.mysql.inc on line 219.

Line 219 says:

return mysql_num_rows($result);

And so on. Can somebody here help in cleaning things up? Any assistance will be much appreciated.

Thanks in advance
--
Albert

Comments

gpk’s picture

>currently your server is executing 210+ mysql queries per second
It is quite possible for a single Drupal page request to generate more queries than that. My first thought is that your server is simply not up to the job of running a serious Drupal site and that your host is really only optimised for handling sites which largely consist of static HTML files, rather than DB based CMSs. There is probably some MySQL tuning that the host could do on the server to help your issues but that's not an area I know much about.

This probably isn't the answer you were looking for but Drupal does run fine with many hosts, and it doesn't have to cost a fortune. You may want to ask friends etc. for recommendations. But certainly there *are* a lot of cheap hosts out there that can't really cope!

gpk
----
www.alexoria.co.uk

albertc’s picture

gpk, thanks for your reply, but I don't think it is the case:

1. I'm using a dedicated server
2. As explained, the site had been running fine for months with more traffic that it is getting now. The performance has degraded with less traffic

Thanks anyway. Let's hope somebody else can help.
--
Albert

gpk’s picture

>I'm using a dedicated server
Ahhhhhhh well then yes it looks like a MySQL/server tuning problem. paulnem makes some good suggestions - worth checking in detail.

A pity that your host does not seem interested - 200 queries per second does not seem excessive to me. But the proportion that hit the cache will be worth checking (have a look at admin/logs/status/sql). On our (shared) server it is almost 80%. MIght also be worth checking if you are running out of free RAM somewhere in the system - could cause disk thrashing and hence severe DB degradation. Also worth optimizing your tables.

gpk
----
www.alexoria.co.uk

paulnem’s picture

Hi

I can't provide a specific answer to your question, or anything amazing but you may want to check a few things.

1. Is cron running correctly? Logs being purged etc?
2. Check /admin/reports/status for any obvious errors.
3. Check /admin/reports/updates that you don't have any unsupported releases or dev modules recently updated (that have a stable release).

If it is a performance issue only you may like to look at :

1. http://drupal.org/node/2601 <-- General performance tuning
2. http://drupal.org/node/51263 <-- MySQL performance tuning

albertc’s picture

Thanks for your reply, paulnem. Actually, I jave just noticed a steep increase in 'cron timed out' messages in the watchdog. How can I find out what is happening?