Download & Extend

Performance issue: _nodewords_detect_type_and_ids() loads excessive tag data.

Project:Nodewords: D6 Meta Tags
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)
Issue tags:v6.x-1.12 blocker

Issue Summary

Because _nodewords_detect_type_and_ids() makes a call to _nodewords_get_pages_data(), nodewords_load_tags() gets called for every single page in the nodewords_custom table. For a site with 1000 entries in the nodewords_custom table this results in an extra 1000 queries on every page load, just to find out if a path in nodewords_custom matches the current path.

Loading just the content of the nodewords_custom table when determining path matches will greatly cut down on unneeded queries.

Comments

#1

I'm attaching a patch with resolves this issue.

AttachmentSizeStatusTest resultOperations
Issue-1232498.patch2.1 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch Issue-1232498.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.View details

#2

I have done some load-testing with this patch on a site that has 1,194 rows in nodewords_custom and 114,293 rows in the nodewords table and the throughput on my site has jumped from an average of 9.7 requests/second to 21.2 requests/second.

#3

I think this should be included in the next release.

#4

Status:active» needs review

#5

Status:needs review» needs work

The last submitted patch, Issue-1232498.patch, failed testing.

#6

Status:needs work» fixed

The current _nodewords_get_custom_pages_data() function includes static caching already, making this redundant. Thank you for the effort, though!

#7

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

#8

Status:closed (fixed)» needs review

Hi Damien,

This issue still exists and is not solved by the static caching. The problem is very severe when a site has many entries in the nodewords_custom table. Even with the caching changes, a SELECT * FROM nodewords WHERE type = 10 AND id = ? query gets run for every entry in nodewords_custom. Our site has about 2000 entries in nodewords_custom and this results in an extra [unnecessary] 2000 queries on every page load, enough to take down our database host. _nodewords_detect_type_and_id() doesn't need all of the metadata for every custom path, just the paths and ids, and this patch allows _nodewords_detect_type_and_id() to access just the data it needs in a single query.

I have recreated the patch against the 6.x-1.x HEAD (and hopefully formatted it correctly with git-format-patch).

Best,
Adam

AttachmentSizeStatusTest resultOperations
Avoid_loading_all_tag_data-1232498.patch2.31 KBIdlePASSED: [[SimpleTest]]: [MySQL] 127 pass(es).View details

#9

Status:needs review» fixed

You've convinced me. Committed, it'll be in the next release.

#10

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here