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

Wrapping simple query in Grape method causing big slowdown (3s+) #1890

Open
jywarren opened this issue Jun 26, 2019 · 5 comments
Open

Wrapping simple query in Grape method causing big slowdown (3s+) #1890

jywarren opened this issue Jun 26, 2019 · 5 comments

Comments

@jywarren
Copy link

@jywarren jywarren commented Jun 26, 2019

Hi, we're struggling to work through an issue where a Rails controller and a Grape API endpoint both run the same underlying ActiveRecord query - literally the same code, and do nothing else, but the controller version runs in average 116ms and the Grape version in average 3.5s.

Here are the two in Skylight, which is great, but doesn't give us the granularity we need to investigate further:

Navbar: https://oss.skylight.io/app/applications/GZDPChmcfm1Q/1561487700/6h/endpoints/Srch::Search%20%5BGET%5D%20srch%2Ftags

Suggested: https://oss.skylight.io/app/applications/GZDPChmcfm1Q/1561487520/6h/endpoints/TagController%23suggested?responseType=json

The code is documented and linked to here: publiclab/plots2#5951

We'd love some advice on how to further investigate, or potentially what else makes these two requests different?

@dblock
Copy link
Member

@dblock dblock commented Jun 26, 2019

@jywarren
Copy link
Author

@jywarren jywarren commented Jun 26, 2019

@myxoh
Copy link
Member

@myxoh myxoh commented Jul 5, 2019

I can see there's only 1 request. Could perhaps a part of that time is spent in pre-loading the app for the first time?
I know in the specs of an app I maintain the first time the get is called it takes circa 3 seconds, but followup get requests take substantially lower time

@jywarren
Copy link
Author

@jywarren jywarren commented Jul 9, 2019

Thanks, I don't think so, because this is a production app in constant use. And I can select multiple requests and get a similar result:

image

But I wonder if it could be something like that... some kind of boot time thing for Grape? But I don't imagine Grape itself has a lot of overhead or anything.

@jywarren
Copy link
Author

@jywarren jywarren commented Jul 9, 2019

OK, trying to add instrumentation at publiclab/plots2#6000

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.