Skip to content

ci: Update Update test/rackup/sleep_fibonacci.ru, add test script#3793

Merged
MSP-Greg merged 3 commits intopuma:masterfrom
MSP-Greg:00-sleep-fib
Oct 16, 2025
Merged

ci: Update Update test/rackup/sleep_fibonacci.ru, add test script#3793
MSP-Greg merged 3 commits intopuma:masterfrom
MSP-Greg:00-sleep-fib

Conversation

@MSP-Greg
Copy link
Copy Markdown
Member

@MSP-Greg MSP-Greg commented Oct 10, 2025

Description

Recently, sleep_fibonacci.ru was added, it runs some CPU code to better mimic the time spent in an app. It has the cpu time set to about 70% of the total. The duration is set via the request path, using the form /sleep{float}, so /sleep0.005 would be a 5 ms response time.

It performs loops of brief fibonacci code and then sleeps a small amount. When the total time of the fibonacci code hits 70%, the loop stops and it sleeps for the remaining time.

Also, a file benchmarks/local/sleep_fibonacci_test.rb is added, see its comments. It generates the output shown in the next message. It is a quick way to see how sleep_fibonacci.ru performs on a local system.

For times less than 5 ms, it moves around a bit, it's best used for comparison, not absolute measurements.

Your checklist for this pull request

  • I have reviewed the guidelines for contributing to this repository.
  • I have added (or updated) appropriate tests if this PR fixes a bug or adds a feature.
  • My pull request is 100 lines added/removed or less so that it can be easily reviewed.
  • If this PR doesn't need tests (docs change), I added [ci skip] to the title of the PR.
  • If this closes any issues, I have added "Closes #issue" to the PR description or my commit messages.
  • I have updated the documentation accordingly.
  • All new and existing tests passed, including Rubocop.

@MSP-Greg
Copy link
Copy Markdown
Member Author

Here's the output. For requests above 10 ms, the average time is within 1% (or better):

$ ruby benchmarks/local/sleep_fibonacci_test.rb a

 Delay ─── Min ──── Aver ─── Max ─── Loops ─── CPU ─── all times mS ──
    1      1.04     1.12     1.16       7     77.6%
    2      2.13     2.16     2.21      15     73.9%
    3      2.95     3.15     3.22      21     72.0%
    4      4.00     4.03     4.07      18     72.0%
    5      4.99     5.03     5.24      22     71.3%
    6      5.99     6.08     6.12      26     70.9%
    7      6.99     7.09     7.11      31     71.3%
    8      7.98     8.05     8.10      35     70.6%
    9      8.99     9.03     9.11      31     71.0%
 Delay ─── Min ──── Aver ─── Max ─── Loops ─── CPU ─── all times mS ──
   10      9.95    10.01    10.13      26     70.4%
   20     20.00    20.02    20.10      40     70.8%
   30     30.02    30.07    30.19      63     70.7%
   40     40.03    40.11    40.22      29     71.2%
   50     50.01    50.06    50.27      43     70.8%
   60     60.08    60.15    60.24      42     70.6%
   70     70.01    70.20    70.32      56     70.6%
   80     80.01    80.16    80.41      69     70.5%
   90     90.05    90.14    90.24      78     70.3%
 Delay ─── Min ──── Aver ─── Max ─── Loops ─── CPU ─── all times mS ──
  100    100.03   100.22   100.41      38     70.8%
  200    199.99   200.27   200.40      69     70.5%
  300    300.00   300.21   300.38     114     70.2%
  400    400.04   400.20   400.36      60     70.9%
  500    500.06   500.16   500.31      74     70.4%
  600    600.13   600.26   600.39      88     70.5%
  700    700.00   700.09   700.32     104     70.3%
  800    800.03   800.22   800.39     119     70.4%
  900    900.01   900.12   900.24     135     70.4%

@github-actions github-actions Bot added the waiting-for-review Waiting on review from anyone label Oct 10, 2025
@MSP-Greg MSP-Greg merged commit ff08099 into puma:master Oct 16, 2025
73 of 74 checks passed
@MSP-Greg MSP-Greg deleted the 00-sleep-fib branch October 16, 2025 16:11
@dentarg dentarg removed the waiting-for-review Waiting on review from anyone label Oct 26, 2025
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.

2 participants