Skip to content

Commit 0df1855

Browse files
authored
Add performance tests resources (#217)
* Add performance tests * Add performance testing users manual
1 parent 8b51bac commit 0df1855

File tree

3 files changed

+170
-0
lines changed

3 files changed

+170
-0
lines changed
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# Performance Testing Resources for Arcane Operator
2+
3+
## Overview
4+
5+
This directory contains Kubernetes manifests for performance testing the Arcane operator. The resources enable automated testing of streaming workloads at scale.
6+
7+
## Prerequisites
8+
9+
- Kubernetes cluster with Arcane operator and `arcane-stream-mock` installed
10+
- `kubectl` configured to access the target cluster
11+
- Namespace `arcane-stream-mock` created
12+
13+
## Resources
14+
15+
### 1. test_secret.yaml
16+
A Kubernetes Secret containing test credentials and configuration data.
17+
18+
**Purpose**: Provides ability to test secret management and access by streaming jobs.
19+
20+
**Apply**:
21+
```bash
22+
kubectl apply -f test_secret.yaml
23+
```
24+
25+
### 2. stream_template.yaml
26+
A `TestStreamDefinition` resource that defines mock streaming workloads.
27+
28+
**Purpose**: Creates test streams for performance evaluation.
29+
30+
**Key Parameters**:
31+
- `runDuration`: Duration for each test run (default: 360s)
32+
- `suspended`: Set to `false` to start streams in backfill mode
33+
- `shouldFail`: Set to `true` to test failure scenarios
34+
35+
**Apply**:
36+
```bash
37+
kubectl apply -f stream_template.yaml
38+
```
39+
40+
## Performance Testing Workflow
41+
42+
### Step 1: Deploy Test Secret
43+
```bash
44+
kubectl apply -f test_secret.yaml
45+
```
46+
47+
Verify the secret is created:
48+
```bash
49+
kubectl get secret test-secret -n arcane-stream-mock
50+
```
51+
52+
### Step 2: Create StreamingJobTemplate
53+
Ensure the referenced `StreamingJobTemplate` (`arcane-stream-mock-standard-job`) exists in the `arcane-stream-mock` namespace before applying the stream template.
54+
55+
### Step 3: Deploy Test Streams
56+
```bash
57+
for i in {1..2000}; do kubectl create -f stream_template.yaml; done
58+
```
59+
60+
This creates a two thousand test streams with a generated name (e.g., `mock-stream-abc123`).
61+
62+
### Step 4: Activate Test Streams
63+
By default, streams are created in suspended state. To start testing:
64+
65+
Assuming you want to activate 300 streams at a time in parallel with 4 concurrent processes:
66+
```bash
67+
kubectl get teststreamdefinition -n arcane-stream-mock --no-headers \
68+
| grep Suspended \
69+
| head -n 300 \
70+
| awk '{print $1}' \
71+
| xargs --max-procs=4 \
72+
| kubectl patch teststreamdefinition <stream-name> -n arcane-stream-mock -p '{"spec":{"suspended":false}}' --type=merge
73+
```
74+
75+
### Step 5: Monitor Performance
76+
Use the Prometeus metrics exposed by the Arcane operator to monitor performance and resource usage during testing.
77+
78+
## Scaling Tests
79+
80+
## Customizing Tests
81+
82+
### Modify Run Duration
83+
Edit `stream_template.yaml` and change `runDuration`:
84+
```yaml
85+
spec:
86+
runDuration: 600s # 10 minutes
87+
```
88+
89+
### Test Failure Scenarios
90+
```yaml
91+
spec:
92+
shouldFail: true
93+
```
94+
95+
## Cleanup
96+
97+
### Remove All Test Streams
98+
```bash
99+
kubectl delete teststreamdefinition -n arcane-stream-mock --all
100+
```
101+
102+
### Remove Test Secret
103+
```bash
104+
kubectl delete -f test_secret.yaml
105+
```
106+
107+
## Troubleshooting
108+
109+
### Stream Not Starting
110+
- Check if `suspended` is set to `false`
111+
- Verify `StreamingJobTemplate` reference exists
112+
- Check operator logs: `kubectl logs -n <operator-namespace> -l app=arcane-operator`
113+
114+
### Jobs Failing
115+
- Verify test secret is properly configured
116+
- Check job logs: `kubectl logs -n arcane-stream-mock <job-pod-name>`
117+
- Ensure sufficient cluster resources (CPU, memory)
118+
- Check if `shouldFail` is set to `true` for intentional failures
119+
120+
## Metrics Collection
121+
122+
Monitor operator performance metrics:
123+
```bash
124+
# CPU/Memory usage
125+
kubectl top pods -n <operator-namespace>
126+
127+
# Stream processing metrics
128+
kubectl describe teststreamdefinition -n arcane-stream-mock
129+
```
130+
131+
## Best Practices
132+
133+
1. **Incremental Load Testing**: Start with 1-2 streams, gradually increase
134+
2. **Resource Limits**: Monitor cluster resources during tests
135+
3. **Cleanup**: Always clean up test resources after performance testing
136+
4. **Isolation**: Use dedicated namespace for performance tests
137+
5. **Baseline**: Establish baseline metrics before scaling tests
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: streaming.sneaksanddata.com/v1
2+
kind: TestStreamDefinition
3+
metadata:
4+
generateName: mock-stream-
5+
namespace: arcane-stream-mock
6+
spec:
7+
backfillJobTemplateRef:
8+
apiVersion: streaming.sneaksanddata.com/v1
9+
kind: StreamingJobTemplate
10+
name: arcane-stream-mock-standard-job
11+
namespace: arcane-stream-mock
12+
destination: mock-destination
13+
jobTemplateRef:
14+
apiVersion: streaming.sneaksanddata.com/v1
15+
kind: StreamingJobTemplate
16+
name: arcane-stream-mock-standard-job
17+
namespace: arcane-stream-mock
18+
runDuration: 360s
19+
shouldFail: false
20+
source: mock-source
21+
suspended: true
22+
testSecretRef:
23+
name: test-secret
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: test-secret
5+
namespace: arcane-stream-mock
6+
data:
7+
TEST_SECRET: c2VjcmV0IGRhdGE=
8+
type: Opaque
9+
10+

0 commit comments

Comments
 (0)