Here's a related issue to #1530386: Avoid unnecessary cache rebuilds and improve installation performance.

features.field.inc uses field_info_field and field_info_instance, which during installation causes a ton of cache rebuilds, leading to very poor performance.

CommentFileSizeAuthor
#1 1574716-avoid-field-cache-rebuilds.patch2.18 KBbojanz

Comments

bojanz’s picture

Status: Active » Needs review
StatusFileSize
new2.18 KB

Here's a patch by Damien Tournoud.

EDIT: And we really need to do something about field_sync_field_status(), it runs every time the cache is cleared or a module enabled, and rebuilds the module list from scratch. On a slow VM, this means that field_modules_enabled() takes 2min out of 7min of total install time (with lost of post-install tasks).
We have an internal patch testing whether it's fine to replace system_rebuild_module_data() with module_list() in field_sync_field_status(), should make it into the core issue queue soon.

exratione’s picture

We have a megabyte of features modules in our install profile; a couple of hundred field instances are among that lot. I evaluated patch #1 in this thread in connection with patch #6 provided by bojanz in #1530386: Avoid unnecessary cache rebuilds and improve installation performance, using the current features dev branch in 7.14.

Patch #1 doesn't do anything for the speed of installing modules during the batch process, but the time spent at the very end of module installation - where much of the field machinations take place - is greatly reduced. So good job; we'll be using that.

exratione’s picture

I gave your idea for field_sync_field_status() and module_list() a whirl, and it worked for us - though that is far from a guarantee that it'll work for everyone else. I put up an item in the issue queue: #1599306: field_sync_field_status() needlessly rebuilds module data, slows down installation dramatically..

bojanz’s picture

Status: Needs review » Reviewed & tested by the community

Marking RTBC based on number #2.
We have production sites using a variant of this patch for more than 6 months, (and its included in Kickstart v2).

mpotter’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed and pushed to a4d3fc9.

hefox’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Patch (to be ported) » Closed (fixed)

Thanks for setting it for back-port, but Fields in d7 only :P

(funny enough, there was actually a similair but totally unrelated bug with the cck intergration that caused field caches to be reset a lot [so much it caused timeout issues for some if I recall correctly]).

anon’s picture

Status: Closed (fixed) » Active

This patch is giving me warnings when installing from drush.

Undefined index: fields field.info.inc:596 [13.26 sec, 75.4 MB]
Invalid argument supplied for foreach() field.info.inc:596 [13.26 sec, 75.4 MB] 

$info['fields'] is NULL.

If I remove "field_info_cache_clear();" from "field_features_rebuild" it will work.

bojanz’s picture

Status: Active » Closed (fixed)

Might be related to #1669720: Regression in features_flush_caches(). Let's continue there.