On the developer list, we've been discussing ways to reduce the number of drupal_get_path() queries run during page load.

One option is to allow site admins to throttle path lookups based on some (sane) rules. For example, in 95% of cases, 'admin' paths do not need aliasing.

This task is one attempt to correct this issue.

Comments

agentrickard’s picture

Title: Throttle path aliasing based on allowed / disallowed paths » Allow/Disallow path aliasing based on allowed / disallowed paths

More accurate title

agentrickard’s picture

StatusFileSize
new1.25 KB

Patch to show how the disable lookup works.

No admin settings yet.

agentrickard’s picture

Title: Allow/Disallow path aliasing based on allowed / disallowed paths » Allow/Disallow path aliasing based on admin settings
StatusFileSize
new2.96 KB

I have rolled the admin interface patch.

The attached is the revised patch. It affects common.inc and path.module.

A thought. The items in path.module might have to go into system.module, since path lookups operate independent of path.module being activated.

agentrickard’s picture

StatusFileSize
new3.02 KB

Minor correction to address how variables are saved when using a checkbox.

agentrickard’s picture

StatusFileSize
new3.02 KB

Correction to the last correction. Mixed variable array behaves as a string!

agentrickard’s picture

StatusFileSize
new3.94 KB

Another fix. The path module uses nodeapi to do lookups directly. New patch accounts for this behavior.

Testing the patch very quickly on a local machine with zero traffic, it is clear that it can cut SQL queries drastically.

The question is whether it speeds performance or just shifts the burden.

agentrickard’s picture

StatusFileSize
new3.94 KB

Last fix to patch, correcting a typo.

agentrickard’s picture

StatusFileSize
new12.98 KB

Test results.

I ran Apache Benchmark tests on two pages /blog and /forum/22 from 12 noon to 12:45 pm.

Attached are the full reports. Summary below:

Blog Page	all times in ms						
					KB/sec		
Patch State	Paths Allowed	Queries	Test Time	Req / Sec	Transfer Rate	90% Req.	Longest Req.
Off	All	526	3041	1.64	132.18	3546	3970
On	All	526	3129	1.60	128.47	3465	4080
On	node, user	465	3162	1.58	127.07	3978	4201
On	forum	381	3389	1.48	120.94	3975	4438

Forum Page	all times in ms						
					KB/sec		
Patch State	Paths Allowed	Queries	Test Time	Req / Sec	Transfer Rate	90% Req.	Longest Req.
Off	All	185	2192	2.28	87.35	2777	3287
On	All	185	2281	2.19	83.99	2851	3216
On	node, user	172	2460	2.03	81.00	3037	3308
On	forum	73	2397	2.09	79.83	2890	3218

While the number of database queries drops substantially, the actual processing time goes up, as both Requests per Second and Transfer Rate drop after the patch is applied.

This may be due to the placement of variable_get() in the patch, but more likely, it seems that using the PHP-based check (which requires array handling) just shifts the load from the database to memory.

I'd be interested to see other (more technically expert) people try this patch and test it to see if the results are the same.

alex_b’s picture

Hi agentrickard,

Your patch and tests look interesting. I stumbled across them actually looking for something a lot more basic: I want to avoid DB hits on url_alias table when path.module is actually _turned_off_ . I got a website with lots and lots of links on a single page, each link causing a hit to url_alias through drupal_lookup_path() even though path.module is off.

I couldn t find the discussion you are referring to, so I hope I don't come up with old questions...

How about turning off looking up paths in url_alias, when path.module is not present?

I couldn't try your patch so far, but looking at your code: did you try caching results in a static variable in drupal_alias_allowed ? This could speed things up.

Alex

L4san’s picture

Version: x.y.z » 7.x-dev

How's this task progress?

Moving to cvs.

agentrickard’s picture

Status: Active » Closed (fixed)

I dropped it, since the AB tests showed no improvement.

I believe there are other solutions in the works now.