Closed treasuretron closed 4 years ago
In GitLab by @thomasmurphy on Jun 4, 2019, 01:21
In GitLab by @thomasmurphy on Jun 4, 2019, 01:22
In GitLab by @thomasmurphy on Jun 4, 2019, 01:23
This issue is related to the top 5 transactions https://www.drupal.org/project/drupal/issues/2758985 One person suggests the APCu PHP extension helps Which is a Platform.sh option https://docs.platform.sh/languages/php/extensions.html
and I can look into enabling on Lando.
In GitLab by @thomasmurphy on Jun 4, 2019, 01:29
This is a little different showing the transition from looking at the homepage not logged in to authenticated user activity
In GitLab by @thomasmurphy on Jun 4, 2019, 01:33
Organization Resources is the view which is using up the most resources. It does have tag based caching, but it's not doing much by the looks of things. Quite a few complex look-ups based upon the group and permissions by term relationships. Would need a bit more research to optimise.
In GitLab by @thomasmurphy on Jun 4, 2019, 02:35
Searching for "organization_resources" in the codebase comes up with the interesting instances. This in "spacebase.theme"
// Change descriptions for empty Organization Resources // @Refactor, not sure, could this be combined with _prep_resources // in spacebase_core? if ($view->id() == "organization_resources" && $view->current_display == 'block_1') { $term_name = $view->argument['name']->argument; $terms = \Drupal::entityTypeManager() ->getStorage('taxonomy_term') ->loadByProperties(['name' => $term_name]); $term = array_shift($terms); if ($descrip = $term->getDescription()) { // Remove closing
and possible last period (without relying on // them) then add last text. $descrip = preg_replace('/\<\/p>\s$/', '', $descrip);This in "spacebase_core.module
// Get total number of resources: $view = Views::getView('organization_resources'); $view->setDisplay('block_2'); // No terms used in this display $view->setArguments([$group->id()]); $view->execute(); $variables['resource_total'] = $view->total_rows;
Also in org-resources.html.twig but that is unlikely to being called globally.
I currently suspect that a bootstrap of this view is being manually called on every page load. @jayelless any thoughts?
In GitLab by @jayelless on Jun 10, 2019, 23:55
After looking at the code and the configuration of views in the system, I think the following applies:
There is a call to building the view (block_2) in the function "_set_the_group_links" in spacebase_core.module, and it is likely that this function is called whenever a group entity is rendered.
A key place where numerous organization groups are rendered is in the map view on the home page (each data-point on the map starts as a rendered organization group entity).
One way to confirm this would be to comment out the code that calls the view in the function "_set_the_group_links" and just set the $variable['resource_total'] to a fixed value like zero.
If this confirms that this code is the culprit then the "resource total" value can be supplied to the org_resources twig template by another means that is less demanding of server resources.
In GitLab by @richbodo on Jan 7, 2020, 16:24
closed
In GitLab by @thomasmurphy on Jun 4, 2019, 01:20
Once New Relic is installed, identify performance bottlenecks and suggest improvements.