I miss path caching :(

Here's a couple of patches that are doing the trick for me, been running in production for a week or so on a 2M+ pageview/month site. It's nice to see those drupal_lookup_path's disappear from the devel query logs again. The path.inc.no_serialize.patch is for memcached users.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tomchuk’s picture

Forgot to mention, path.inc patches are against Drupal 5.9

firebus’s picture

tomchuck, do these patches resolve the issues raised in http://drupal.org/node/220983? if so, how?

firebus’s picture

also, please make sure to apply jeremy's change from http://drupal.org/node/230235

tomchuk’s picture

When imagecache handles a request it calls file_transfer() at the end of its menu callback for file_directory_path() .'/imagecache' (the imagecache_cache function). file_transfer() calls exit() after sending the image, which means that hook_exit is never called. Because the caching is done in hook_exit (see advcache.patch), the no_src and map are never cached for imagecache requests. I have confirmed this with watchdogs in advcache_exit and with my own cache_path hit rate (low 80s) on a highly trafficed site with very heavy use of imagecache (30+ presets and 10k+ images)

Regarding the count query, I didn't think it appropriate to make any more changes than necessary from core. With my path.inc patch applied, the query remains the same as the one in core. If there are dramatic gains to be had by tweaking the query, I think it should be submitted as a core patch, not addressed in a contrib module. Just my $0.02.

tomchuk’s picture

I should also note that the above is for imagecache-5.x-1.5. I have downloaded 1.6 and the code is the same, but ads another call to exit() after file_transfer(). Imagecache 2.1 changes its behavior quite a bit, but every path out of _imagecache_cache that I can see ends in a call to exit(), which means that this patch should work fine with all 5.x releases of imagecache.

tomchuk’s picture

Here's the above patches with jeremy's modified count query.

tomchuk’s picture

Wow that does make a difference on InnoDB, with no real difference on MyISAM.

Execution times for 1000 queries with no query caching, average of 3 runs on url_alias table with 160155 entries.
SELECT COUNT(*) FROM url_alias; - MyISAM: 0.071s | InnoDB: 57.13s
SELECT COUNT(pid) FROM url_alias; - MyISAM: 0.081s | InnoDB: 59.39s
SELECT pid FROM url_alias LIMIT 1; - MyISAM: 0.078s | InnoDB: 0.094s

tomchuk’s picture

Running imagecache 2.1 now in production, and things are still working great.

iKillBill2’s picture

will this work on drupal 5.12?

tomchuk’s picture

Yes, path.inc and advcache.module patches apply with a little fuzz on Drupal 5.12 and Advcache 1.9.

Petrica’s picture

I'm using it on a Drupal 5.12 production site and it looks OK. No problems reported.
Thx for the patches.

mikejoconnor’s picture

Status: Needs review » Needs work

I've been running this on a site with 5m page views/month, with 1.2 million url aliases. Its made a HUGE difference. What further testing do we need to bring this back to the main advcache module?

mikejoconnor’s picture

FileSize
2.84 KB

Here is a patch for this version of the path fix, for D6. For the rest of the d6 upgrade please see Issue 242121.

Seems to be working well for me.

mikejoconnor’s picture

Status: Needs work » Needs review

sorry, didn't mean to change the status earlier

Brumisek’s picture

Version: 5.x-1.x-dev » 5.x-1.9

What about patch for memacache module? I also need path (url_alias) improved in this module :(:( Drupal 5.x