Document Pathauto configurations that will slow down a site

gracearoha - December 19, 2007 - 13:11
Project:Pathauto
Version:6.x-2.x-dev
Component:Documentation
Category:task
Priority:normal
Assigned:Unassigned
Status:active
Description

Will using pathauto slow down my site node loads?

#1

greggles - December 19, 2007 - 15:52

The answer is both yes and no.

Pathauto will slow down the creation and editing of most objects (users, nodes, taxonomy) on your site because it does it's work of creating aliases during the creation/editing of those objects. Most people don't edit objects very often compared to how often a page is viewed so this is not a problem. This problem can be amplified if you have a lot of modules that provide a very large number of tokens or tokens which are expensive to calculate (see this issue where calculating a single alias takes 2,167 queries!).

The other place where Pathauto will slow down a site is when admins have a large number of objects on their site and configure Pathauto create aliases for every single object on a site (this is made worse when they also create feed aliases for every object). The reason this slows down a site is that for every page load, all links that Drupal creates are checked against an alias table. For example, at the top of this page are the node tabs for view, edit, and outline (depending on your permissions). When they are displayed, all of those links are checked against the url_alias table to see if there is an alias for them. When your site gets more and more entries in the url_alias table this query will take longer and longer. While it may be fast on it's own (fractions of a second) if you have a page that shows lots of links that are passed through l/url functions then having hundreds of those queries will add up to serious time.

So, in general Pathauto on its own will not slow down a site. But it certainly can make a site slow under certain circumstances.

#2

greggles - December 19, 2007 - 15:54
Title:Pathauto slow down site?» Document Pathauto configurations that will slow down a site
Component:Miscellaneous» Documentation
Category:support request» task

Also, I've been meaning to do some benchmarking to determine best practices here, so I'm going to turn this into an issue for that.

If anyone else wants to do that, it would be awesome :)

#3

Freso - August 16, 2008 - 13:55
Version:5.x-1.1» 6.x-1.1
Status:active» postponed (maintainer needs more info)

This should probably be for 6.x-1.1/5.x-2.3 by now. If it's something we still wants to have done? (Seeing as it's been open for over 6 months without any activity, perhaps we should simply "won't fix" it?)

#4

greggles - August 28, 2008 - 00:40
Status:postponed (maintainer needs more info)» active

Yes, I'd still like to do this...

#5

mikeytown2 - September 9, 2009 - 11:08
Version:6.x-1.1» 6.x-2.x-dev
Priority:normal» critical

line 360 - pathauto_taxonomy()

<?php
         
// For all children generate new alias (important if [catpath] used)
         
foreach (taxonomy_get_tree($category->vid, $category->tid) as $subcategory) {
           
$count = _taxonomy_pathauto_alias($subcategory, $op);
          }
?>

This was taking 20 seconds for SQL and about the same in PHP time; for each term added... and I don't have any aliases for taxonomy defined. I recommend adding in some sanity checks before running taxonomy_get_tree(), because that can be very expensive on large databases.
#572046: Each node takes longer to do. SQL Issue. Recommend disabling pathauto.module

#6

greggles - September 9, 2009 - 11:18

What kind of sanity check do you suggest?

#7

mikeytown2 - September 9, 2009 - 11:21

Check if "Taxonomy term path settings" is completely blank; if so don't run.

#8

mikeytown2 - September 9, 2009 - 11:23

So if the Default path pattern is blank and that vocab is blank, don't run.

#9

greggles - September 9, 2009 - 13:22
Priority:critical» normal

Seems like a great idea: #572604: If there is no taxonomy pattern, don't do any work.

But it's unrelated to the purpose of this issue.

 
 

Drupal is a registered trademark of Dries Buytaert.