Hello world, here are two patches that improve Drupal's performance. Both need work. I was hoping someone could take a look at those ... both are fairly straightforward. http://drupal.org/node/42463 http://drupal.org/node/73045 Thanks, -- Dries Buytaert :: http://www.buytaert.net/
Hi,
Well, the second one is very straightforward and i think it is ready to be committed. But this reminds me: have anybody ever tried to do some complex MySQL tweaking as logging queries slower than for example 0.3 sec and analysing them? i could try on one of my sites which takes about a second to generate, but i don't have any with thousands of nodes... Jakub Suchy
On Jul 10, 2006, at 5:10 PM, Jakub Suchy wrote:
i could try on one of my sites which takes about a second to generate, but i don't have any with thousands of nodes...
Jakub Suchy
You can create a test site and populate it with as many nodes as you need using the generate-content.php script that ships with devel.module. There are other scripts in there for creating users, taxonomy terms and even path aliases. Devel module is also great for timing db queries. http://drupal.org/project/devel Matt Westgate www.lullabot.com
You can create a test site and populate it with as many nodes as you need using the generate-content.php script that ships with devel.module. There are other scripts in there for creating users, taxonomy terms and even path aliases. Devel module is also great for timing db queries.
Hi, i started debugging one of my sites using Drupal 4.6, which is taking about 1second to generate, which is probably slow (using few modules and 18n for 6 languages). I found this query is not using index: SELECT locale, name FROM locales_meta WHERE enabled = 1 ORDER BY isdefault DESC, name ASC; This may be fixed using: ALTER TABLE locales_meta ADD INDEX(enabled); But i am not experienced in developing Drupal core yet, so could somebody adopt this issue and add it to CVS please? This query is executed more than 11 times every time: SELECT s.lid, t.translation FROM locales_source s INNER JOIN locales_target t ON s.lid = t.lid WHERE s.source = '' AND t.locale = 'cs' I don't understand where may appear empty locale string and can't imagine how to debug this, can anybody help? I also found devel.module measuring very unreliable in my opinion. The slow queries are logged on random basis, query A executes in 50ms first time and in 1ms second time... Jakub Suchy
I also found devel.module measuring very unreliable in my opinion. The slow queries are logged on random basis, query A executes in 50ms first time and in 1ms second time...
This is most likely due to MySQL query caching. Most queries can be cached so identical resulting queries will be very quick and it appears that is what you're seeing. Rob Roy Barreca Electronic Insight Corporation 12526 High Bluff Drive, Suite 300 San Diego, CA 92130 http://www.electronicinsight.com rob@electronicinsight.com Jakub Suchy wrote:
You can create a test site and populate it with as many nodes as you need using the generate-content.php script that ships with devel.module. There are other scripts in there for creating users, taxonomy terms and even path aliases. Devel module is also great for timing db queries.
Hi, i started debugging one of my sites using Drupal 4.6, which is taking about 1second to generate, which is probably slow (using few modules and 18n for 6 languages).
I found this query is not using index: SELECT locale, name FROM locales_meta WHERE enabled = 1 ORDER BY isdefault DESC, name ASC; This may be fixed using: ALTER TABLE locales_meta ADD INDEX(enabled); But i am not experienced in developing Drupal core yet, so could somebody adopt this issue and add it to CVS please?
This query is executed more than 11 times every time: SELECT s.lid, t.translation FROM locales_source s INNER JOIN locales_target t ON s.lid = t.lid WHERE s.source = '' AND t.locale = 'cs' I don't understand where may appear empty locale string and can't imagine how to debug this, can anybody help?
I also found devel.module measuring very unreliable in my opinion. The slow queries are logged on random basis, query A executes in 50ms first time and in 1ms second time...
Jakub Suchy
On 11 Jul 2006, at 22:06, Jakub Suchy wrote:
I found this query is not using index: SELECT locale, name FROM locales_meta WHERE enabled = 1 ORDER BY isdefault DESC, name ASC; This may be fixed using: ALTER TABLE locales_meta ADD INDEX(enabled); But i am not experienced in developing Drupal core yet, so could somebody adopt this issue and add it to CVS please?
You're right. It is not using an index.
This query is executed more than 11 times every time: SELECT s.lid, t.translation FROM locales_source s INNER JOIN locales_target t ON s.lid = t.lid WHERE s.source = '' AND t.locale = 'cs' I don't understand where may appear empty locale string and can't imagine how to debug this, can anybody help?
This query isn't using an index either. Maybe post a comment to the locale issue I mentioned in the original e-mail. Report your additional findings and then hopefully, someone will add indices for these queries in one smooth swoop. :-) -- Dries Buytaert :: http://www.buytaert.net/
This query isn't using an index either.
This one also i think: SELECT n.nid FROM node n INNER JOIN i18n_node a ON n.nid = a.nid INNER JOIN i18n_node b ON a.trid = b.trid AND b.nid =74 WHERE n.nid != 74 AND n.language = 'de' explain: 1 | SIMPLE | n | eq_ref | PRIMARY | PRIMARY | 4 | newsaltek.a.nid | 1 | Using where This one is used pretty often, i suggest creating an index on language, but i am not sure if this is only the patch from i18n? Jakub Suchy
since you're using i18n and 4.6, this sounds like it might be this issue: http://drupal.org/node/65801 which can be mitigated with an index but is really a sort of a complicated bug about the init_ hook. On 7/11/06, Jakub Suchy <jakub@rtfm.cz> wrote:
This query is executed more than 11 times every time: SELECT s.lid, t.translation FROM locales_source s INNER JOIN locales_target t ON s.lid = t.lid WHERE s.source = '' AND t.locale = 'cs' I don't understand where may appear empty locale string and can't imagine how to debug this, can anybody help?
-- Alan Dixon, Web Developer http://alan.g.dixon.googlepages.com/
Alan Dixon wrote:
since you're using i18n and 4.6, this sounds like it might be this issue:
http://drupal.org/node/65801 which can be mitigated with an index but is really a sort of a complicated bug about the init_ hook.
Applied the patch, but nothing changed. Not this issue...Still getting times about 1-1.5 seconds.
Jakub Suchy wrote:
Alan Dixon wrote:
since you're using i18n and 4.6, this sounds like it might be this issue:
http://drupal.org/node/65801 which can be mitigated with an index but is really a sort of a complicated bug about the init_ hook.
Applied the patch, but nothing changed. Not this issue...Still getting times about 1-1.5 seconds.
Attaching devel.module output, the source = '' query is still the slowest. I don't get it, where it appears... Jakub
In general, it makes sense for a source = '' to be the slowest (since the more data you have the faster the match), but it also seems like a waste to be doing this since you already know the answer (or do you ever want to translate the empty string?). How about putting this into line 134 of locale.module as an experiment: if (!$string) return; And then take a look at your output. I don't know why you'd be wanting to translate an empty string anyway (you could put in a debug_backtrace in that line instead to find out though). - Alan On 7/13/06, Jakub Suchy <jakub@rtfm.cz> wrote:
Jakub Suchy wrote:
Alan Dixon wrote:
since you're using i18n and 4.6, this sounds like it might be this issue:
http://drupal.org/node/65801 which can be mitigated with an index but is really a sort of a complicated bug about the init_ hook.
Applied the patch, but nothing changed. Not this issue...Still getting times about 1-1.5 seconds.
Attaching devel.module output, the source = '' query is still the slowest. I don't get it, where it appears...
Jakub
-- Alan Dixon, Web Developer http://alan.g.dixon.googlepages.com/
Alan Dixon wrote:
In general, it makes sense for a source = '' to be the slowest (since the more data you have the faster the match), but it also seems like a waste to be doing this since you already know the answer (or do you ever want to translate the empty string?).
How about putting this into line 134 of locale.module as an experiment:
if (!$string) return;
Hi, i already managed to find all occurences of source = '', it is caused at first by mine altered taxonomy_dhtml module, but i think it is present in CVS version too. Just some l(..., array('title' => t($term->description))), where description is empty most of the times (most of the times for me or for most of the sites? :) Imagine taxonomy of 10 terms, printed at taxonomy_dhtml page as content and as a block. This generates 20 bogus SQL queries... I don't think it is an experiment. Do we want to translate empty string? Maybe this should be posted as an issue to locale.module... Jakub Suchy
I've just submitted a simple bug report and proposed fix here: http://drupal.org/node/74181 to resolve this issue. I hope someone can look at it. - Alan On 7/13/06, Jakub Suchy <jakub@rtfm.cz> wrote:
Alan Dixon wrote:
In general, it makes sense for a source = '' to be the slowest (since the more data you have the faster the match), but it also seems like a waste to be doing this since you already know the answer (or do you ever want to translate the empty string?).
How about putting this into line 134 of locale.module as an experiment:
if (!$string) return;
Hi, i already managed to find all occurences of source = '', it is caused at first by mine altered taxonomy_dhtml module, but i think it is present in CVS version too. Just some l(..., array('title' => t($term->description))), where description is empty most of the times (most of the times for me or for most of the sites? :) Imagine taxonomy of 10 terms, printed at taxonomy_dhtml page as content and as a block. This generates 20 bogus SQL queries...
I don't think it is an experiment. Do we want to translate empty string? Maybe this should be posted as an issue to locale.module...
Jakub Suchy
-- Alan Dixon, Web Developer http://alan.g.dixon.googlepages.com/
Alan Dixon wrote:
I've just submitted a simple bug report and proposed fix here:
to resolve this issue. I hope someone can look at it.
Well, the patch is probably going to be rejected, but i don't think it's a bad patch. I think that "Do not query something that is empty" is a good idea. Not because taxonomy_dhtml is poor written module, but because we want to speed things up and save SQL queries. Once, forever. Jakub Suchy
participants (5)
-
Alan Dixon -
Dries Buytaert -
Jakub Suchy -
Matt Westgate -
Rob Barreca