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

API queries from UI almost 2 times slower than direct queries #936

Closed
rkorytkowski opened this issue Aug 20, 2021 · 6 comments
Closed

API queries from UI almost 2 times slower than direct queries #936

rkorytkowski opened this issue Aug 20, 2021 · 6 comments
Assignees

Comments

@rkorytkowski
Copy link
Contributor

rkorytkowski commented Aug 20, 2021

Asynchronous query run by UI from Chrome:
curl 'https://api.staging.openconceptlab.org/mappings/?q=&page=1&exact_match=off&limit=25&includeRetired=false&verbose=false&sortDesc=_score' -H 'authority: api.staging.openconceptlab.org' -H 'sec-ch-ua: "Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"' -H 'accept: application/json' -H 'sec-ch-ua-mobile: ?0' -H 'includefacets: true' -H 'user-agent: Mozilla/5.0 (X11; Fedora; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36' -H 'content-type: application/json' -H 'origin: https://app.staging.openconceptlab.org' -H 'sec-fetch-site: same-site' -H 'sec-fetch-mode: cors' -H 'sec-fetch-dest: empty' -H 'referer: https://app.staging.openconceptlab.org/' -H 'accept-language: en-US,en;q=0.9,pl;q=0.8' --compressed -o /dev/null -s -w 'Total: %{time_total}s\n'

Query directly executed in Chrome:
curl 'https://api.staging.openconceptlab.org/mappings/?q=&page=1&exact_match=off&limit=25&includeRetired=false&verbose=false&sortDesc=_score' -H 'authority: api.staging.openconceptlab.org' -H 'cache-control: max-age=0' -H 'sec-ch-ua: "Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"' -H 'sec-ch-ua-mobile: ?0' -H 'upgrade-insecure-requests: 1' -H 'user-agent: Mozilla/5.0 (X11; Fedora; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36' -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' -H 'sec-fetch-site: none' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-user: ?1' -H 'sec-fetch-dest: document' -H 'accept-language: en-US,en;q=0.9,pl;q=0.8' -H 'cookie: _ga=GA1.2.1552851037.1629461705; _gid=GA1.2.2139365053.1629461705' --compressed -o /dev/null -s -w 'Total: %{time_total}s\n'

Notice the URL is the same but some HEADERS differ.

@rkorytkowski
Copy link
Contributor Author

It's -H 'includefacets: true' that adds the additional time.

I would make an additional query to request facets separate from the original one so the difference is not visible to the user.

@rkorytkowski
Copy link
Contributor Author

rkorytkowski commented Aug 20, 2021

@snyaggarwal it seems like a quick fix, doesn't it?

@snyaggarwal snyaggarwal self-assigned this Aug 21, 2021
@snyaggarwal
Copy link
Contributor

@rkorytkowski I will check this out

snyaggarwal added a commit to OpenConceptLab/oclapi2 that referenced this issue Aug 26, 2021
snyaggarwal added a commit to OpenConceptLab/oclweb2 that referenced this issue Aug 26, 2021
@snyaggarwal
Copy link
Contributor

@rkorytkowski this is done.
we can request just facets with ?q=&facetsOnly=true

@rkorytkowski
Copy link
Contributor Author

I see that web requests facets even when paginating only. Is that needed?

@snyaggarwal
Copy link
Contributor

nope, I will fix that

snyaggarwal added a commit to OpenConceptLab/oclweb2 that referenced this issue Aug 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants