Caching - for comment

NancyDru - April 2, 2008 - 19:01
Project:Taxonomy image
Version:5.x-1.1
Component:Performance
Category:feature request
Priority:normal
Assigned:NancyDru
Status:closed
Description

While I was doing some performance work on the Glossary and Taxonomy List modules, I discovered that the Taxonomy Image calls were contributing a fair amount of time-to-render. The module does use static caching already and that wasn't helping nearly as much as I had hoped back when that was added.

As a test, I added Drupal caching (cache_xxx) and that made a noticeable improvement in the speed of things like Glossary and Taxonomy List. I haven't tested, but I would assume it would make a difference in any page that has several taxonomy images on it (regardless of how they are placed there). However, this improvement was only noticed when I created my own "cache_tax_image" table -- using one of the existing tables actually slowed it down.

Is anyone interested in having this added to the module as standard?

#1

matslats - April 3, 2008 - 21:07
Status:active» patch (code needs review)

Got a new addon for you. This makes faceted_search work with taxonomy_image
Simply put the following function in template.php

function YOURTHEME_faceted_search_ui_category($category, $path) {
// Note: get_label() is responsible for filtering its returned string.
if ($path) {
$label = l($category->get_label(TRUE), $path, array(), NULL, NULL, NULL, TRUE);
}
else {
$label = $category->get_label(TRUE);
}
if (function_exists (taxonomy_image_display)){
$label = taxonomy_image_display($category -> _tid) . $label;
}
return ''. $label .' ('. $category->get_count() .')';
}

The clever bit is the second to last line.

#2

NancyDru - April 3, 2008 - 22:32

Very interesting stuff. I would think this would be better placed in the Faceted Search module.

This thread was created to get some discussion on my possible addition of caching to the TI module.

#3

Fayna - April 5, 2008 - 18:52

I would be interested! I think this would be a great addition to Taxonomy Image

#4

NancyDru - April 8, 2008 - 16:22
Assigned to:Anonymous» NancyDru

Here are patches for 5.x-1.2 and 6.x-1.2. Testing is strongly encouraged. Please provide feedback here.

AttachmentSize
taxonomy_image_cache6.patch3.96 KB
taxonomy_image_cache5.patch5.67 KB

#5

NancyDru - April 12, 2008 - 16:27
Status:patch (code needs review)» patch (to be ported)

Committed to 5.x-1.x-dev release.

#6

NancyDru - April 12, 2008 - 16:30
Status:patch (to be ported)» fixed

Committed to 6.x-1.x-dev release.

Both versions need testing and comment.

#7

mariagwyn - April 14, 2008 - 19:07

Nancy,

I am happy to help test it but I need to know what you are looking for. I have NOT used taxonomy image before, so I can't compare to previous versions. What sort of data do you need (other than, works-great or broke-my-whole-site!!!)?

Maria

#8

NancyDru - April 14, 2008 - 23:14
Status:fixed» active (needs more info)

Thanks, Maria. Well, "works-great" or "broke-my-whole-site" is a good start. If you have Devel, you could also post some query times for the cache. I would be worried if you're seeing queries taking more than 0.5 milliseconds; I'd be thrilled if they are less that 0.25 ms.

#9

mariagwyn - April 15, 2008 - 05:55

I do have devel, though I haven't gotten to the stage of actually noticing load times. It may take me a bit to get to this part of my site as I am still working through some upgrade issues, but I will let you know what I find when I get there.

#10

NancyDru - April 18, 2008 - 14:02

There will be no further official releases until there is adequate user testing and comment on this change.

#11

zilla - April 29, 2008 - 20:59

nancy, it's bugging out for me: first i got a blank white screen with this:

...taxonomy_image/contributed/taxonomy_image_node_display/taxonomy_image_node_display.module on line 17

then i reloaded afew times and got an error for each called image, like:

user warning: Table '{mydatabase}.cache_tax_image' doesn't exist query: SELECT data, created, headers, expire, serialized FROM cache_tax_image WHERE cid = 'taxonomy_image:52' in /.../html/includes/cache.inc on line 26. (but all different lines!)

#12

zilla - April 29, 2008 - 21:07

hmm, that's interesting - apparently i'm an idiot...forgot to run update.php - did so and saw confirmation of this:

taxonomy_image module
Update #6100
CREATE TABLE {cache_tax_image} ( `cid` VARCHAR(255) NOT NULL DEFAULT '', `data` LONGBLOB DEFAULT NULL, `expire` INT NOT NULL DEFAULT 0, `created` INT NOT NULL DEFAULT 0, `headers` TEXT DEFAULT NULL, `serialized` SMALLINT NOT NULL DEFAULT 0, PRIMARY KEY (cid), INDEX expire (expire) ) /*!40100 DEFAULT CHARACTER SET UTF8 */

...but i'm not seeing the images now! not sure what i did earlier, but perhaps that "files/" directory vanished in upgrade? or maybe i accidentally blasted it? where should files/ be located (i'm going to create a new directory for files/taximages to hold them but not sure if files should be autogenerated in a new location...

#13

zilla - April 29, 2008 - 21:31

at any rate, i went back in to teh site, uploaded a couple of taxonomy images and then checked via ftp to make sure they appeared in the right sites/default/files area (they were in there, saw them both) BUT they are not appearing on the site - i also flushed the cache via the admin page (performance) and checked again, and checked with a couple of themes...they just appear to be not displaying! no errors, nothing like that, just no visible taxonomy images in nodes or teasers (my settings allow for both)

#14

NancyDru - April 29, 2008 - 22:36

Based on your update number, I'm assuming you're on Drupal 6.x. Let's start with going to the administer >> settings >> performance and clearing all the caches (button near the bottom). Then, using PHPMyAdmin, or something like it clear (truncate) cache_tax_image as well.

#15

zilla - April 30, 2008 - 02:45

ah, didn't do the phpmyadmin - i'm not that savvy so try to stay away but can get to it via my control panel...and yes, i'm on d6.2 right now.

#16

NancyDru - April 30, 2008 - 03:41

Well, actually I found a way to make the Performance page do it, and it is now in the -dev version.

#17

zilla - May 1, 2008 - 21:00

cool - i'll pull that down tonight and try it out...

#18

NancyDru - June 25, 2008 - 15:59
Status:active (needs more info)» closed

Released some time ago.

 
 

Drupal is a registered trademark of Dries Buytaert.