@rulebricks/cli 2.0.1 → 2.0.3

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.
@@ -0,0 +1,98 @@
1
+ ## Rulebricks Benchmarking Toolkit
2
+
3
+ A simple benchmarking suite for testing your Rulebricks deployment performance.
4
+
5
+ | Test | Purpose | Measures |
6
+ | ------------------- | ------------------ | ----------------------------------------- |
7
+ | **QPS Test** | API responsiveness | Requests per second (individual payloads) |
8
+ | **Throughput Test** | Engine capacity | Solutions per second (bulk processing) |
9
+
10
+ ### Prerequisites
11
+
12
+ - [k6](https://k6.io/docs/get-started/installation/) load testing tool installed
13
+ - A deployed Rulebricks instance
14
+ - The benchmark flow imported into your instance
15
+ - An API key with access to the benchmark flow
16
+
17
+ ### Quick Start
18
+
19
+ #### 1. Import the Benchmark Flow
20
+
21
+ Import the `Test Flow.rbf` file into your Rulebricks instance:
22
+
23
+ 1. Log into your Rulebricks dashboard
24
+ 2. Navigate to **Flows** → **Import**
25
+ 3. Upload the test flow file, click into the flow and ensure it is published
26
+ 4. Note the published flow API URL (e.g., `https://your-instance.com/api/v1/flows/YOUR_FLOW_ID`)
27
+
28
+ #### 2. Get Your API Key
29
+
30
+ 1. Navigate to the **API** tab on your Rulebricks dashboard
31
+ 2. Copy the API Key
32
+
33
+ #### 3. Run the Tests
34
+
35
+ ```bash
36
+ # QPS Test
37
+ ./run-qps-test.sh -u https://your-instance.com/api/v1/flows/YOUR_FLOW_ID -k your-api-key
38
+
39
+ # Throughput Test
40
+ ./run-throughput-test.sh -u https://your-instance.com/api/v1/flows/YOUR_FLOW_ID -k your-api-key
41
+ ```
42
+
43
+ ### Configuration
44
+
45
+ All configuration is done via environment variables passed to k6:
46
+
47
+ #### Required Variables
48
+
49
+ | Variable | Description |
50
+ | --------- | -------------------------------------------------------------------------------------- |
51
+ | `API_URL` | Full URL to your flow endpoint (e.g., `https://rb.example.com/api/v1/flows/ds_abc123`) |
52
+ | `API_KEY` | Your Rulebricks API key |
53
+
54
+ #### Optional Variables
55
+
56
+ | Variable | Default | Description |
57
+ | --------------- | -------------------------------- | ------------------------------------------------ |
58
+ | `TEST_DURATION` | `4m` | Measurement duration (after 1m warm-up) |
59
+ | `TARGET_RPS` | `500` (QPS) / `100` (Throughput) | Target requests per second |
60
+ | `BULK_SIZE` | `50` | Payloads per bulk request (throughput test only) |
61
+
62
+ ### Test Structure
63
+
64
+ Each test consists of two phases:
65
+
66
+ 1. **Warm-up Phase (1 minute)**: Allows the cluster to scale up and stabilize. Results from this phase are excluded from the final metrics.
67
+ 2. **Measurement Phase (4 minutes by default)**: Steady-state performance measurement. Only this phase contributes to the reported metrics.
68
+
69
+ Total test time = 1m warm-up + `TEST_DURATION`
70
+
71
+ ### Understanding the Tests
72
+
73
+ #### QPS Test (`qps-test.js`)
74
+
75
+ Measures how many **individual requests** your deployment can handle per second. Useful for understanding API gateway performance, connection handling capacity, and latency under load.
76
+
77
+ Sends single-payload requests at a constant rate and measures response times and success rates.
78
+
79
+ #### Throughput Test (`throughput-test.js`)
80
+
81
+ Measures how many **rule evaluations (solutions)** your deployment can process per second. Useful for understanding rule engine processing capacity and bulk API performance.
82
+
83
+ Sends bulk requests (arrays of payloads) at a constant rate. Each request contains multiple payloads that are processed together.
84
+
85
+ ```
86
+ Solutions/second = Successful Requests × Bulk Size / Test Duration
87
+ ```
88
+
89
+ ---
90
+
91
+ ### Note on Autoscaling
92
+
93
+ The 1-minute warm-up phase helps clusters with autoscaling (HPA) scale up before measurement begins. However, if you still see inconsistent results, you may want to:
94
+
95
+ 1. **Set fixed replica counts** temporarily by adjusting `hps.minReplicas` and `hps.maxReplicas` in your Helm values to the same value
96
+ 2. **Increase test duration** with `-d 10m` for longer measurement after warm-up
97
+
98
+ Refer to the Helm chart documentation for tuning autoscaling behavior.