Skip to content

Commit ec978f1

Browse files
committed
Update docs
1 parent 33fea56 commit ec978f1

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

CONTRIBUTING.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,75 @@ Removes the `full-ci` label and returns to standard CI behavior:
590590
- **Force-pushes:** The `/run-skipped-ci` command adds the `full-ci` label to your PR. If you force-push after commenting, the initial workflow run will test the old commit, but subsequent pushes will automatically run full CI because the label persists.
591591
- **Branch operations:** Avoid deleting or force-pushing branches while workflows are running, as this may cause failures.
592592

593+
### Benchmarking
594+
595+
React on Rails includes a performance benchmark workflow that measures RPS (requests per second) and latency for both Core and Pro versions.
596+
597+
#### When Benchmarks Run
598+
599+
- **Automatically on master**: Benchmarks run on every push to master
600+
- **On PRs with labels**: Add the `benchmark` or `full-ci` label to your PR to run benchmarks
601+
- **Manual trigger**: Use `gh workflow run` to run benchmarks with custom parameters (see [https://github.com/cli/cli#installation](https://github.com/cli/cli#installation) if you don't have `gh`):
602+
603+
```bash
604+
# Run with default parameters
605+
gh workflow run benchmark.yml
606+
607+
# Run with custom parameters
608+
gh workflow run benchmark.yml \
609+
-f rate=100 \
610+
-f duration=60s \
611+
-f connections=20 \
612+
-f app_version=core_only
613+
```
614+
615+
#### Regression Detection
616+
617+
When benchmarks run, the [github-action-benchmark](https://github.com/benchmark-action/github-action-benchmark) action compares results against historical data. If performance regresses by more than 50%, the workflow will:
618+
619+
1. **Fail the CI check** with `fail-on-alert: true`
620+
2. **Post a comment on the PR** explaining the regression
621+
3. **Tag reviewers** for attention
622+
623+
This helps catch performance regressions before they reach production.
624+
625+
#### Running Benchmarks Locally
626+
627+
**Prerequisites:** Install [k6](https://k6.io/docs/get-started/installation/) and [Vegeta](https://github.com/tsenart/vegeta#install).
628+
629+
You can also run the server in a separate terminal instead of backgrounding it.
630+
631+
**Core benchmarks:**
632+
633+
```bash
634+
cd react_on_rails/spec/dummy
635+
bin/prod-assets # Build production assets
636+
bin/prod & # Start production server on port 3001
637+
SERVER_PID=$!
638+
cd ../..
639+
ruby benchmarks/bench.rb
640+
kill $SERVER_PID
641+
```
642+
643+
**Pro benchmarks:**
644+
645+
```bash
646+
cd react_on_rails_pro/spec/dummy
647+
bin/prod-assets
648+
bin/prod & # Starts Rails server and node renderer
649+
SERVER_PID=$!
650+
cd ../..
651+
PRO=true ruby benchmarks/bench.rb # Rails benchmarks
652+
ruby benchmarks/bench-node-renderer.rb # Node renderer benchmarks
653+
kill $SERVER_PID
654+
```
655+
656+
**Configuration:** Both scripts support environment variables for customization (rate, duration, connections, etc.). See the script headers in [`benchmarks/bench.rb`](benchmarks/bench.rb) and [`benchmarks/bench-node-renderer.rb`](benchmarks/bench-node-renderer.rb) for available options. For debugging, you may want lower `DURATION` and/or specific `ROUTES`:
657+
658+
```bash
659+
DURATION=5s ROUTES=/ ruby benchmarks/bench.rb
660+
```
661+
593662
### Install Generator
594663

595664
In your Rails app add this gem with a path to your fork.

0 commit comments

Comments
 (0)