Problem/Motivation

I recently upgraded jsonapi + jsonapi_extras from 1.7 -> 1.10 and rc1 -> rc5 respectively. Our frontend is now taking 10-15 seconds longer to fetch each set of 50 nodes it is requesting. I profiled the request using xhprof and with the help of Gabriel, was able to identify that ConfigurableResourceTypeRepository::getResourceConfigs was invoked 500+ times for the single request, thus invoking EntityStorageBase::loadMultiple 500+ times:

    $resource_configs = $this->entityTypeManager
      ->getStorage('jsonapi_resource_config')
      ->loadMultiple($resource_config_ids);

Proposed resolution

Store $resource_configs in a property on the class or in cache so that subsequent calls do not need to load all resource configs again. Will post a patch shortly.

I believe this was introduced in #2941095: ResourceTypeRepository loads all configuration for every ->get($entity_type_id, $bundle).

Comments

malik.kotob created an issue. See original summary.

malik.kotob’s picture

Issue summary: View changes
malik.kotob’s picture

gabesullice’s picture

Status: Active » Reviewed & tested by the community
gabesullice’s picture

Priority: Major » Critical

Setting this as critical. Anyone using extras will be experiencing truly significant slow downs because of this.

e0ipso’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for this patch. This is now fixed!

  • e0ipso committed e24676b on 8.x-1.x authored by malik.kotob
    Issue #2948512 by malik.kotob, gabesullice, e0ipso: All resource configs...

Status: Fixed » Closed (fixed)

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