Wrapping simple query in Grape method causing big slowdown (3s+)
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 10k
- Forks
- 1.2k
- Avg merge
- 14h 38m
- Merged PRs (30d)
- 92
Description
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:
The code is documented and linked to here: https://github.com/publiclab/plots2/issues/5951
We'd love some advice on how to further investigate, or potentially what else makes these two requests different?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked plots2 issue and compare the two profiled entry points: Srch::Search [GET] srch/tags and TagController#suggested?responseType=json. Use the Skylight traces to isolate where the Grape request diverges from the Rails controller request; done means identifying a reproducible cause and documenting an actionable fix or investigation result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- api, backend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100