I am running drupal site with very big count of modules and one of them is admin menu. Every page of site is loading very fast except for page when user first logs in to site. After submitting /user login form. So I debugged with xhprof and noticed that admin menu is rebuilding menu every time user is logging in. Login page loads on average in 30 seconds, which is way too long.
Here is screenshot from xhprof http://prntscr.com/r5lxt I can provide more information if you need.


johnv’s picture

Apparently admin_menu thinks it is necessary to create a new entry in cache_menu, each time a admin_user logs in.
However, the high load time is due to bad performance in core menu.inc file, which loads every object in the shown menus. Admin_menu taps into core menu system when it calls _menu_translate() while rebuilding the menu cache.
Problems arise when you have lots of entities (nodes/terms) in your menu.

Root cause is described in #1978176: Build menu_tree without loading so many objects , which tries to resolve that issue.

Related issues:
#1923260: og_menus uselessly included / high server load at log-in is a duplicate of this, but aimed at a specific use case;
#420816: On-demand loading of dynamic paths and local tasks #1 would not be necessary with performant core menu;
#1699230: Infinite Loop in admin_menu_merge_tree (admin_menu.inc) is probably unrelated;

johnv’s picture

Title: High load time » High load time for admin_menu upon user login/menu refresh

Better title for tracking in other issues.

Chris Charlton’s picture

Issue summary: View changes