Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APIv4 - Fix performance drag caused by getInfoItem calling the API #21920

Merged
merged 1 commit into from
Oct 24, 2021

Conversation

colemanw
Copy link
Member

Overview

Fixes a performance bottleneck in APIv4 which was in some cases slowing SearchKit to a crawl (in the unreleased master branch).

Before

Searches might take 20 seconds to return results.

After

Back to under 2 seconds.

Comments

I noticed this while testing #21820

Technical Details

The CoreUtil::getInfoItem function is sometimes called thousands of times per request, e.g. for every cell in a searchKit display table. Going through the API wrapper that many times is a considerable (+10 sec) drag on performance.
Instead of calling Entity.get, we can just read directly from the cache where it stores its data.

This function is sometimes called thousands of times per request, e.g. for every cell
in a searchKit display table. Going through the API wrapper that many times is a
considerable (+10 sec) drag on performance.
Instead of calling Entity.get, we can just read directly from the cache where it stores its data.
@civibot
Copy link

civibot bot commented Oct 23, 2021

(Standard links)

@eileenmcnaughton
Copy link
Contributor

Caching = faster = good
Caching = hard to debug = bad

@eileenmcnaughton eileenmcnaughton merged commit 168dc9f into civicrm:master Oct 24, 2021
@eileenmcnaughton eileenmcnaughton deleted the getInfoItemCache branch October 24, 2021 21:25
@colemanw
Copy link
Member Author

Yea it actually uses the same caching before/after. The difference with this PR is skipping the API wrapper.

@colemanw
Copy link
Member Author

It would probably be good to find out why the APIv4 wrapper is so slow...

@eileenmcnaughton
Copy link
Contributor

@colemanw maybe digging into the issue in #21790 would help you figure it out :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants