registry optimisations

justinrandell - May 9, 2008 - 12:41
Project:Drupal
Version:7.x-dev
Component:base system
Category:bug report
Priority:critical
Assigned:justinrandell
Status:closed
Description

attached patch cleans up and optimises the registry some more.

1. don't write the registry hook or file caches if nothing has changed - two less db writes for 99% of requests.

2. don't drupal_load modules in bootstrap_invoke_all - its now redundant

3. new function registry_load_path_files --> load the files in the registry cache for earlier (during DRUPAL_BOOTSTRAP_PATH), so we avoid a couple of db lookups in drupal_function_exists calls that happen before the menu system takes over.

4. save a different set of files in registry_cache_path_files for logged in vs anon users. this makes the cache more effective.

AttachmentSize
more_faster_2.patch4.14 KB

#1

Dries - May 9, 2008 - 20:12
Status:patch (code needs review)» patch (code needs work)

+  $cache_id = 'registry_' . ($user->uid ? 'logged_in:' : 'anon:') . $_GET['q'];

Can we use 'authenticated' and 'anonymous' for consistency?

Also, the code comments need work.

#2

chx - May 9, 2008 - 20:14

You are replacing the router item with the actual path. That makes the caching much less efficient -- tons and tons of duplicates.

#3

justinrandell - May 13, 2008 - 00:57

just a quick note to say that based on discussions with chx, this patch will get stripped back to just the 'don't write to cache if nothing is changed' part, and we'll open separate issues to tackle the 3. and 4. from the issue description.

#4

justinrandell - May 13, 2008 - 11:37
Status:patch (code needs work)» patch (code needs review)

and here's the patch for 'don't write to cache if nothing is changed'.

AttachmentSize
more_faster_3.patch2.99 KB

#5

catch - May 13, 2008 - 11:45
Status:patch (code needs review)» patch (code needs work)

warning: sort() expects parameter 1 to be array, null given in includes/bootstrap.inc on line 1330.

#6

justinrandell - May 13, 2008 - 11:54
Status:patch (code needs work)» patch (code needs review)

egg, meet face.

catch, thanks for the fast review. here's a non-FAIL patch.

AttachmentSize
more_faster_4.patch3.09 KB

#7

justinrandell - May 13, 2008 - 12:10

more egg, more face. mmmm, egg.

this time with the call to registry_load_path_files.

AttachmentSize
more_faster_5.patch3.81 KB

#8

catch - May 13, 2008 - 12:21
Status:patch (code needs review)» patch (reviewed & tested by the community)

pre-patch: 4057 passes, 122 fails and 15 exceptions.

post-patch: 4059 passes, 120 fails and 15 exceptions.

#9

catch - May 13, 2008 - 13:05
Status:patch (reviewed & tested by the community)» patch (code needs review)

cross-posted, #7 gives 4057 passes, 122 fails and 15 exceptions.

I'm wondering why the second eggface patch results in two less simpletest failures...

#10

justinrandell - May 13, 2008 - 13:10

@catch: do you know if its just two change? is it more than two, with some in both directions?

#11

catch - May 13, 2008 - 13:33

Different results again unpatched... I'm starting to think these are edge cases/environmental conditions in the tests that might be occurring anyway. On one run of each, here's the tests which report differently. Don't have time to do any more in depth comparison.

Patched:
Aggregator
6 test cases complete:
149 passes, 3 fails and 0 exceptions.

Taxonomy
3 test cases complete:
53 passes, 9 fails and 0 exceptions.

Unpatched:
Aggregator
6 test cases complete:
150 passes, 2 fails and 0 exceptions.

Taxonomy
3 test cases complete:
51 passes, 11 fails and 0 exceptions.

#12

justinrandell - May 13, 2008 - 13:50
Status:patch (code needs review)» patch (reviewed & tested by the community)

@catch: thanks for the info.

yeah, i get different pass/fail numbers depending on how many tests are run, both patched and unpatched.

if i just run agregator and taxonomy, its consistently all passes, patched and unpatched, but running all of the tests leads to similar but often not the same numbers of failures. there be dragons in there somewhere...

setting this back to RTBC, because i think what we have is issues with simpletest rather than this patch.

#13

catch - May 13, 2008 - 13:59

I agree with that. SimpleTest failures, though interesting, have nothing to do with this.

#14

Dries - May 13, 2008 - 17:38

Great. I've committed this to CVS HEAD. Thanks.

#15

BioALIEN - May 13, 2008 - 19:08
Status:patch (reviewed & tested by the community)» fixed

As this has been committed, I'm setting it to fixed.

#16

Anonymous (not verified) - May 27, 2008 - 19:11
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.