Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By kwinto on
I have 247 queries for front page and almost half of them (102) queries from function drupal_lookup_path. These queries consume about 30% of time of all database time. I believe this is very much and it's very inefficient for performance. In my case url_alias table contains only 5 records and I for now I really need all them.
Could be it better for first call of the function to cache ALL records of the table? I believe that it would much more efficient for resources consumption and performance.
Comments
You're not alone
I've used aliasing on 250+ nodes as a test and the number of queries per page went crazy. The culprit is drupal_lookup_path(). I believe this is under discussion so a solution will be engineered for Drupal6 and hopefully back-ported down the road.
Here's a citation to point you in the right direction:
http://drupal.org/node/88022#comment-161124
------------------------------
BioALIEN
Buy/Sell/Trade with other webmasters: WebMasterTrader.com
Ditto
I found the same problems on my 5.1. install when I ran DEVEL and saw that the principal drag was drupal_lookup_path. I recoded my copy so that it leaned on the session object instead of these frequent trips to the database:
noteworthy was my addition of :
and
drupal_clear_path_cache()
If you happen to use this core hack from Mike in Drupal 5.x, I would suggest to additionally insert the following line:
if ($action == 'wipe') {
$map = array();
$no_src = array();
unset($_SESSION['map']); // hacking core to clear session storage
}
Otherwise drupal_clear_path_cache() will not work correctly, and it can cause problems.
Thanks guys, it's perfect.
Thanks guys, it's perfect. 50 less queries!!
sina.salek.ws
Feel freedom with open source softwares
sina.salek.ws, Software Manager & Lead developer
Feel freedom with open source softwares
Hi Gaborh, I only 5
Hi Gaborh,
I only 5 url_aliases, but 200+ drupal_clear_path() function calls. So what does this do exactly? Can I tell it not to lookup url_aliases unless it's those 5? Thx.
Any implications on this patch?
Hi all, Just a thought, shouldn't we clear all user $_SESSION vars ?
Ain't it by this line, we just clear one user session variable ??
EtradingGallery
-=- Jhon -=-
i'm glad i'm not the only
i'm glad i'm not the only one that was horrified at how many db calls are needed for simple pages.
any ideas if the menu.module is also going to be reworked? There are a lot of db calls just to create a silly little navigation bar.
Already done
As a matter of fact, menu.module has already been engineered and ready to go for Drupal 6 ;)
------------------------------
BioALIEN
iScene Interactive :: iScene.eu
subscribing....
subscribing....
Advanced cache can help you.
The advanced cache reduces multiple db lookup queries into one query:
http://drupal.org/project/advcache
Check out the path_cache.patch
Hey - does anyone know what
Hey
- does anyone know what is the status of Drupal urlalias caching?
- has any of this made it into D5 D6 D7?
- where do we go from here? is there an active issue/ patch to test?
- i.e. which one of these possible solutions should i be testing?
References
http://drupal.org/node/102311
http://drupal.org/node/106559
http://drupal.org/node/100301
Update
#106559: drupal_lookup_path() optimization - skip looking up certain paths in drupal_lookup_path() has made it into D7. A backport of that issue for D6 is available in Pressflow.
#100301: Page level path alias caching was marked as duplicate of the above issue.
(Username formerly my full name, Richard Eriksson.)
Implications Update?
Hey all,
Just made these mods and holy crap the speed seems to have significantly improved. Way less DB calls from drupal_lookup_path(). I changed my drupal_lookup_path() in path.inc to the one above posted by dewolfe001. Then I updated my drupal_clear_path_cache() to look like this:
Is that the correct modification of drupal_clear_path_cache()? Is there really nothing else to do? Is it that easy to reduce DB calls this much so quickly and painlessly? Why wouldn't this be in Drupal 5 core releases, makes no sense to me it's so simple it seems like something must be wrong.
-Drew
Any news on this? Is this the
Any news on this? Is this the correct solution that reduces the flood of drupal_lookup_path calls?
—
Vacilando services | blog @vacilandois