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

Caching on heavily-used API calls: srch/api/profiles #4763

Merged
merged 2 commits into from
Feb 5, 2019

Conversation

milaaraujo
Copy link
Collaborator

Fixes #3149

@plotsbot
Copy link
Collaborator

plotsbot commented Feb 5, 2019

1 Message
📖 @milaaraujo Thank you for your pull request! I’m here to help with some tips and recommendations. Please take a look at the list provided and help us review and accept your contribution! And don’t be discouraged if you see errors – we’re here to help.

Generated by 🚫 Danger

@milaaraujo milaaraujo requested a review from jywarren February 5, 2019 07:15
@jywarren jywarren merged commit a68a07d into publiclab:master Feb 5, 2019
@jywarren
Copy link
Member

jywarren commented Feb 5, 2019

Great. I'll roll this out today and we can see how it does!

@milaaraujo milaaraujo deleted the cachingAPIcalls branch February 5, 2019 16:50
@jywarren
Copy link
Member

jywarren commented Feb 5, 2019

Strangely i don't see a lot of tracking in Skylight: https://oss.skylight.io/app/applications/GZDPChmcfm1Q/recent/6h/endpoints/Srch::Search%20%5BGET%5D%20srch%2Fprofiles

Not sure if this is because these calls aren't monitored?

@milaaraujo
Copy link
Collaborator Author

Depending on how it does we can implement the caching for the other endpoints...

@jywarren
Copy link
Member

jywarren commented Feb 5, 2019

@jywarren
Copy link
Member

jywarren commented Feb 5, 2019

@jywarren
Copy link
Member

jywarren commented Feb 5, 2019

Wow, ok so i did a hard cache flush and reloaded this:

https://publiclab.org/api/srch/profiles?query=camila&sort_by=recent&field=username&_=1549385453136

Initially 6 seconds, but on repeating, 578ms

https://publiclab.org/api/srch/profiles?query=sidha&sort_by=recent&field=username

2 seconds, then on refresh 553 ms

https://publiclab.org/api/srch/profiles?query=jywa&sort_by=recent&field=username

2 seconds then 80 ms

so, i think this worked pretty well. Let me try actually using it in a comment...

@jywarren
Copy link
Member

jywarren commented Feb 5, 2019

image

And a longer interactive session here:

image

You can see how typing @warren 3 times, the later ones show much much lower load times; the initial ones are at 2-4 seconds, the later at 68-631ms, although one was 2.4s

image

This is a big improvement, but I do want to note how many requests go out -- i think we can change the settings on the typeahead to refine this too. See a gif:

typeahead

Also note it's sending lots of requests where query is empty. We should adjust so it only sends when there are at least 2.

@jywarren
Copy link
Member

jywarren commented Feb 5, 2019

Copying this into #4670

SrinandanPai pushed a commit to SrinandanPai/plots2 that referenced this pull request May 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants