rails_benchmark_suite 0.2.8 β 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +65 -77
- data/lib/rails_benchmark_suite/runner.rb +1 -1
- data/lib/rails_benchmark_suite/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c48ce5faaa5348bcd47cdd9c88ba9b1441d0f7bcd0a6fa601d84b36014673d1a
|
|
4
|
+
data.tar.gz: f39f188c55fe6749a5b9ba4ae9c5c44e926bd5d6588737f689192ab841deda92
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 28f32ff03be6cbd83aabb1c3f8750316f5c3e2cb69de127885f96a4ef27841b12ee916999c2dea59c314605a6755f0aee34d0c610338c596bbff2789120a7ce0
|
|
7
|
+
data.tar.gz: 2e4f5a17c66e0caed9a95a46cdc3e0049783eea603f9cd263d699f492d49440f7ceaab45bf4c469b8b05fc316ca999052d12705dfe29b0edf54b032160fc2966
|
data/README.md
CHANGED
|
@@ -1,29 +1,44 @@
|
|
|
1
|
-
# Rails Benchmark Suite
|
|
1
|
+
# Rails Benchmark Suite π
|
|
2
|
+
|
|
3
|
+
**Standardized Hardware Benchmarking for Rails 8.1+**
|
|
2
4
|
|
|
3
5
|
A standardized performance suite designed to measure the "Heft" of a machine using realistic, high-throughput Rails 8+ workloads.
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
## π What is this?
|
|
8
|
+
|
|
9
|
+
Think of this as a **"Test Track" for Rails servers**. Unlike profilers that measure your specific application code, this gem runs a **fixed, standardized set of Rails operations** (Active Record object allocation, SQL query complexity, ActionView rendering, and background job throughput) to measure the raw performance of your server and Ruby configuration.
|
|
10
|
+
|
|
11
|
+
To ensure a level playing field, the gem boots an **isolated, in-memory SQLite environment**. It creates its own schema and records, meaning it **never touches your production data** and returns comparable results across any machine.
|
|
6
12
|
|
|
7
13
|
## π The "Heft" Score
|
|
8
14
|
|
|
9
|
-
The Heft Score is a weighted metric representing a machine's ability to handle Rails tasks.
|
|
10
|
-
|
|
11
|
-
|
|
15
|
+
The Heft Score is a weighted metric representing a machine's ability to handle Rails tasks.
|
|
16
|
+
* **Baseline:** A score of **100** is calibrated to represent an **AWS c6g.large** (ARM) instance.
|
|
17
|
+
* **Objective:** To provide a simple, comparable number for evaluating different computing platforms (Cloud VMs, bare-metal, or local dev rigs).
|
|
12
18
|
|
|
13
19
|
### Baseline Comparisons
|
|
20
|
+
|
|
14
21
|
| Score | Classification | Comparable Hardware |
|
|
15
22
|
| :--- | :--- | :--- |
|
|
16
|
-
|
|
|
17
|
-
| 60 | π Capable | Standard Cloud VM (c5.large/standard) |
|
|
18
|
-
| **100** |
|
|
19
|
-
| 150
|
|
20
|
-
| 300
|
|
23
|
+
| **< 40** | π’ Sluggish | Older Intel Macs, Entry-level VPS |
|
|
24
|
+
| **60** | π Capable | Standard Cloud VM (c5.large/standard) |
|
|
25
|
+
| **100** | ποΈ Baseline | AWS c6g.large (2 vCPU ARM) |
|
|
26
|
+
| **150+** | π High Performance | Apple M-series Pro/Max, Ryzen 5000+ |
|
|
27
|
+
| **300+** | β‘ Blazing | Server-grade Metal, M3 Ultra |
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## π Quick Start
|
|
32
|
+
|
|
33
|
+
Ensure you are in your Rails root directory and run:
|
|
21
34
|
|
|
22
|
-
### Quick Start
|
|
23
35
|
```bash
|
|
24
36
|
ruby --yjit -S bundle exec rails_benchmark_suite
|
|
25
37
|
```
|
|
26
|
-
|
|
38
|
+
|
|
39
|
+
**Note:** `bundle exec` is mandatory for Rails environment stability and to prevent Minitest version conflicts.
|
|
40
|
+
|
|
41
|
+
---
|
|
27
42
|
|
|
28
43
|
## π Technical Philosophy
|
|
29
44
|
|
|
@@ -32,28 +47,16 @@ Rails Benchmark Suite prioritizes **Benchmarking** (via `benchmark-ips`) over **
|
|
|
32
47
|
* **Benchmarking:** Focuses on macro-throughputβ"How many iterations can the hardware handle?" This provides the final Heft Score.
|
|
33
48
|
* **Why no Profiling?** Profiling tools (like `StackProf` or `Vernier`) introduce instrumentation overhead that skews hardware metrics. We aim for "Conceptual Compression"βone clear number to inform infrastructure decisions.
|
|
34
49
|
|
|
50
|
+
---
|
|
51
|
+
|
|
35
52
|
## π Installation & Usage
|
|
36
53
|
|
|
37
54
|
### Requirements
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
### Prerequisites
|
|
42
|
-
* **Ruby:** 3.4.1+ (Recommended for latest YJIT/Prism performance)
|
|
55
|
+
* **Ruby:** 3.3+ (Ruby with YJIT support highly recommended)
|
|
56
|
+
* **Rails:** 8.1+
|
|
43
57
|
* **Database:** SQLite3
|
|
44
58
|
|
|
45
|
-
### Standalone Usage
|
|
46
|
-
If you want to test hardware performance without an existing application:
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
git clone https://github.com/overnet/rails_benchmark_suite.git
|
|
50
|
-
cd rails_benchmark_suite
|
|
51
|
-
bundle install
|
|
52
|
-
bin/rails_benchmark_suite
|
|
53
|
-
```
|
|
54
|
-
|
|
55
59
|
### Use within a Rails Application
|
|
56
|
-
Rails Benchmark Suite is "Rails-aware." Adding it to your app allows you to benchmark your specific configuration and custom suites.
|
|
57
60
|
|
|
58
61
|
Add to your Gemfile:
|
|
59
62
|
|
|
@@ -61,84 +64,69 @@ Add to your Gemfile:
|
|
|
61
64
|
gem "rails_benchmark_suite", group: :development
|
|
62
65
|
```
|
|
63
66
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
ruby --yjit -S bundle exec rails_benchmark_suite
|
|
70
|
-
```
|
|
67
|
+
### Usage Flags
|
|
68
|
+
* `--yjit`: Enables the Ruby JIT compiler (significant for Rails 8+ performance).
|
|
69
|
+
* `-S`: Corrects the path to look for the executable in your current bundle.
|
|
70
|
+
* `--json`: For programmatic consumption of results.
|
|
71
|
+
* `--skip-rails`: To ignore the host application and run in isolated mode.
|
|
71
72
|
|
|
72
|
-
|
|
73
|
-
- `--yjit`: Enables the Ruby JIT compiler (significant for Rails 8+ performance).
|
|
74
|
-
- `-S`: Corrects the path to look for the executable in your current bundle.
|
|
75
|
-
- `bundle exec`: Prevents version conflicts (e.g., Minitest) between the gem and your host application.
|
|
73
|
+
### Standalone Usage
|
|
76
74
|
|
|
77
|
-
|
|
78
|
-
If running outside a Rails project:
|
|
75
|
+
If you want to test hardware performance without an existing application:
|
|
79
76
|
|
|
80
77
|
```bash
|
|
78
|
+
git clone https://github.com/overnet/rails_benchmark_suite.git
|
|
79
|
+
cd rails_benchmark_suite
|
|
80
|
+
bundle install
|
|
81
81
|
bin/rails_benchmark_suite
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
For programmatic consumption:
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
ruby --yjit -S bundle exec rails_benchmark_suite --json
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
> **Note:** Use `--skip-rails` to ignore the host application and run in isolated mode.
|
|
84
|
+
---
|
|
92
85
|
|
|
93
|
-
##
|
|
86
|
+
## π§ͺ The "Heft" Suites
|
|
94
87
|
|
|
95
|
-
|
|
88
|
+
The gem measures performance across critical Rails subsystems using a dedicated, isolated schema:
|
|
96
89
|
|
|
97
|
-
|
|
90
|
+
* **Active Record Heft:** Standardized CRUD: Creation, indexing, and complex querying.
|
|
91
|
+
* **Cache Heft:** High-frequency read/writes to the Rails memory store.
|
|
92
|
+
* **Solid Queue Heft:** Background job enqueuing and database-backed polling stress.
|
|
93
|
+
* **View Heft:** Partial rendering overhead and ActionView throughput.
|
|
94
|
+
* **Image Heft:** Image processing performance (requires libvips).
|
|
98
95
|
|
|
99
|
-
|
|
96
|
+
---
|
|
100
97
|
|
|
101
|
-
## Troubleshooting
|
|
98
|
+
## β οΈ Troubleshooting
|
|
102
99
|
|
|
103
100
|
### YJIT Shows "Disabled"
|
|
104
101
|
|
|
105
|
-
If you see `YJIT: Disabled
|
|
102
|
+
If you see `YJIT: Disabled`, it means your Ruby was not compiled with YJIT support.
|
|
106
103
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
# Using rbenv
|
|
111
|
-
RUBY_CONFIGURE_OPTS="--enable-yjit" rbenv install 3.4.1
|
|
112
|
-
|
|
113
|
-
# Using rvm
|
|
114
|
-
rvm install 3.4.1 --enable-yjit
|
|
115
|
-
```
|
|
116
|
-
3. Verify YJIT is available: `ruby --yjit -e "puts RubyVM::YJIT.enabled?"`
|
|
104
|
+
* **Fix (rbenv):** `RUBY_CONFIGURE_OPTS="--enable-yjit" rbenv install 3.4.1`
|
|
105
|
+
* **Fix (rvm):** `rvm install 3.4.1 --enable-yjit`
|
|
117
106
|
|
|
118
107
|
### SQLite Lock Errors
|
|
119
108
|
|
|
120
|
-
|
|
109
|
+
Version 0.2.9+ includes surgical connection resets and randomized backoffs to handle SQLite concurrency. If issues persist, ensure no other processes are accessing the benchmark database.
|
|
121
110
|
|
|
122
|
-
|
|
123
|
-
- Automatic retry logic with sleep backoff
|
|
124
|
-
- Per-thread unique identifiers to prevent conflicts
|
|
125
|
-
- Optimized busy timeout settings (10 seconds)
|
|
126
|
-
|
|
127
|
-
If issues persist, try reducing concurrency or ensuring no other processes are accessing the benchmark database.
|
|
111
|
+
---
|
|
128
112
|
|
|
129
113
|
## π Architecture
|
|
114
|
+
|
|
130
115
|
* **Engine:** Built on `benchmark-ips`.
|
|
131
|
-
* **Database:** Uses In-Memory SQLite with `cache=shared` for multi-threaded accuracy.
|
|
132
|
-
* **Isolation:** Uses transactional rollbacks
|
|
133
|
-
* **Threading:** Supports 1-thread and 4-thread scaling tests
|
|
134
|
-
|
|
116
|
+
* **Database:** Uses In-Memory SQLite with `cache=shared` and a 50-connection pool for multi-threaded accuracy.
|
|
117
|
+
* **Isolation:** Uses transactional rollbacks and Mutex-wrapped schema creation.
|
|
118
|
+
* **Threading:** Supports 1-thread and 4-thread scaling tests.
|
|
119
|
+
|
|
120
|
+
---
|
|
135
121
|
|
|
136
122
|
## π Credits
|
|
137
|
-
This project is a functional implementation of the performance benchmark vision discussed in the Rails community.
|
|
138
123
|
|
|
139
124
|
* **Vision:** Inspired by @dhh in [rails/rails#50451](https://github.com/rails/rails/issues/50451).
|
|
140
125
|
* **Initial Roadmap:** Based on suggestions by @JoeDupuis.
|
|
141
126
|
* **Implementation:** The Rails Community.
|
|
142
127
|
|
|
128
|
+
---
|
|
129
|
+
|
|
143
130
|
## π License
|
|
131
|
+
|
|
144
132
|
The gem is available as open source under the terms of the MIT License.
|
|
@@ -17,7 +17,7 @@ module RailsBenchmarkSuite
|
|
|
17
17
|
SETUP_MUTEX = Mutex.new
|
|
18
18
|
|
|
19
19
|
def run
|
|
20
|
-
# Ultimate Hardening: Massive pool and timeout for zero lock contention (v0.2.
|
|
20
|
+
# Ultimate Hardening: Massive pool and timeout for zero lock contention (v0.2.9)
|
|
21
21
|
ActiveRecord::Base.establish_connection(
|
|
22
22
|
adapter: "sqlite3",
|
|
23
23
|
database: "file:heft_db?mode=memory&cache=shared",
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rails_benchmark_suite
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- RailsBenchmarkSuite Contributors
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-01-
|
|
10
|
+
date: 2026-01-03 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: benchmark-ips
|