Skip to content

Commit eadccd4

Browse files
committed
Add benchmarking to docs
1 parent 69600d9 commit eadccd4

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

CONTRIBUTING.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,12 +293,33 @@ If you run `rspec` at the top level, you'll see this message: `require': cannot
293293
294294
After running a test, you can view the coverage results in SimpleCov reports by opening `coverage/index.html`.
295295
296+
### Benchmarking
297+
You'll need to [install `k6`](https://grafana.com/docs/k6/latest/set-up/install-k6/) first.
298+
299+
The benchmarking scripts are in `k6` directory, so you can run, for example:
300+
```sh
301+
k6 run k6/root.js
302+
```
303+
to exercise the main page of the dummy app, or `k6/streaming.js` for the streaming page.
304+
305+
For significant changes, please make sure to run all benchmarks before and after, and include the results in the PR.
306+
Later they will be added to CI, if we can make sure the results there are stable enough.
307+
308+
If you add significant new functionality and add a page in the dummy app showing it, consider adding the corresponding benchmark as well.
309+
310+
#### Debugging the benchmark scripts
311+
You can add `-e DEBUG_K6=true` to run only a single iteration while showing HTTP requests and responses. See
312+
[How to debug k6 load testing scripts](https://github.com/grafana/k6-learn/blob/main/Modules/III-k6-Intermediate/01-How-to-debug-k6-load-testing-scripts.md) for more suggestions if needed.
313+
296314
### Debugging
297315
Start the sample app like this for some debug printing:
298316
299317
```sh
300-
TRACE_REACT_ON_RAILS=true && foreman start -f Procfile.dev
318+
TRACE_REACT_ON_RAILS=true overmind start -f Procfile.dev
301319
```
320+
Using `overmind` instead of `foreman` lets you restart separate processes, connect with them when stopped with a `debugger` call, and so on.
321+
See https://railsnotes.xyz/blog/overmind-better-bin-dev-for-your-procfile-dev for more details.
322+
If you don't need that, you can use `bin/dev` or `foreman` as well.
302323
303324
# Releasing
304325
Contact Justin Gordon, [email protected]

0 commit comments

Comments
 (0)