ruby-grape / ruby-grape/grape

Deeply nesting endpoints within multiple namespaces leads to large jumps in latency and cpu usage

Open
#1,416 4 comments 0 reactions 1 assignee View on GitHub

@namusyaka is already working on this.

Since Oct 12, 2016.

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

Description

In my unit tests when I execute 10 simultaneous requests to a deeply nested endpoint of the form ':path_param1/namespaces1/:path_param2/namespace2/:path_param3/namespace3/namespace4/:path_param4' it takes 60 seconds to complete and CPU consumed by Ruby peaks at over 90%.

If I flatten that endpoint out and have it at the top level instead and have it named post ':path_param1/namespaces1/:path_param2/namespace2/:path_param3/namespace3/namespace4/:path_param4' do then 10 simultaneous requests to that endpoint complete in a few seconds and Ruby consumes only a few mb of CPU.

I will post some code to reproduce the issue here asap...

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.