ruby-grape / ruby-grape/grape

Cache compiled API routes

Open
#1,736 3 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request
Dominant language
Ruby
Stars
10k
Forks
1.2k
Avg merge
14h 38m
Merged PRs (30d)
92

Description

I noticed that it takes 5-6 seconds for our Grape API to compile all the routes (see GitLab issue https://gitlab.com/gitlab-org/gitlab-ce/issues/35208), which is especially painful in production whenever a unicorn worker is restarted. Since API routes generally don't change that much, I think there ought to be a way to load the routes from cache.

I filed https://github.com/sinatra/mustermann/issues/69 because it seems like we'd need a way to compile and serialize the data there, but perhaps there is something Grape could be doing too.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by investigating how Grape compiles API routes and whether the route data can be safely loaded from a cache during Unicorn worker startup. Review the linked GitLab issue and the related Mustermann issue 69 to determine the serialization dependency. Done means establishing a workable route-cache approach with appropriate validation and tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
api, backend, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.