-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.load_tests
More file actions
163 lines (151 loc) · 5.7 KB
/
Makefile.load_tests
File metadata and controls
163 lines (151 loc) · 5.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# Load Testing targets
# Variables
LOAD_TESTS_DIR := infra/load_tests
LOAD_TESTS_RESULTS_DIR := $(LOAD_TESTS_DIR)/results
TIMESTAMP := $(shell date +%Y%m%d_%H%M%S)
# Installation
install-load-tests:
@echo "Installing Locust load testing dependencies..."
pip install -r $(LOAD_TESTS_DIR)/requirements.txt
@echo "✅ Load testing dependencies installed"
# DB API Load Tests
load-test-db-api:
@echo "Running DB API load test (default settings)..."
@mkdir -p $(LOAD_TESTS_RESULTS_DIR)
cd $(LOAD_TESTS_DIR) && \
locust -f db_api_locustfile.py \
--host=http://localhost:8001 \
--users=10 \
--spawn-rate=2 \
--run-time=60s \
--headless \
--html=results/db_api_$(TIMESTAMP).html \
--csv=results/db_api_$(TIMESTAMP)
@echo ""
@echo "✅ Load test complete. Results saved to $(LOAD_TESTS_RESULTS_DIR)/db_api_$(TIMESTAMP).*"
@python $(LOAD_TESTS_DIR)/format_results.py $(LOAD_TESTS_RESULTS_DIR)
load-test-db-api-10rps:
@echo "Running DB API load test - 10 RPS target..."
@mkdir -p $(LOAD_TESTS_RESULTS_DIR)
cd $(LOAD_TESTS_DIR) && \
locust -f db_api_locustfile.py \
--host=http://localhost:8001 \
--users=5 \
--spawn-rate=2 \
--run-time=60s \
--headless \
--html=results/db_api_10rps_$(TIMESTAMP).html \
--csv=results/db_api_10rps_$(TIMESTAMP)
@echo ""
@echo "✅ Load test complete. Results saved to $(LOAD_TESTS_RESULTS_DIR)/db_api_10rps_$(TIMESTAMP).*"
@python $(LOAD_TESTS_DIR)/format_results.py $(LOAD_TESTS_RESULTS_DIR)
load-test-db-api-100rps:
@echo "Running DB API load test - 100 RPS target..."
@mkdir -p $(LOAD_TESTS_RESULTS_DIR)
cd $(LOAD_TESTS_DIR) && \
locust -f db_api_locustfile.py \
--host=http://localhost:8001 \
--users=50 \
--spawn-rate=10 \
--run-time=120s \
--headless \
--html=results/db_api_100rps_$(TIMESTAMP).html \
--csv=results/db_api_100rps_$(TIMESTAMP)
@echo ""
@echo "✅ Load test complete. Results saved to $(LOAD_TESTS_RESULTS_DIR)/db_api_100rps_$(TIMESTAMP).*"
@python $(LOAD_TESTS_DIR)/format_results.py $(LOAD_TESTS_RESULTS_DIR)
load-test-db-api-1000rps:
@echo "Running DB API load test - 1000 RPS target..."
@mkdir -p $(LOAD_TESTS_RESULTS_DIR)
cd $(LOAD_TESTS_DIR) && \
locust -f db_api_locustfile.py \
--host=http://localhost:8001 \
--users=500 \
--spawn-rate=50 \
--run-time=180s \
--headless \
--html=results/db_api_1000rps_$(TIMESTAMP).html \
--csv=results/db_api_1000rps_$(TIMESTAMP)
@echo ""
@echo "✅ Load test complete. Results saved to $(LOAD_TESTS_RESULTS_DIR)/db_api_1000rps_$(TIMESTAMP).*"
@python $(LOAD_TESTS_DIR)/format_results.py $(LOAD_TESTS_RESULTS_DIR)
# Chat API Load Tests
load-test-chat:
@echo "Running Chat API load test (default settings)..."
@echo "⚠️ Note: Chat API uses actual LLM inference (6-7 min), expect long response times"
@mkdir -p $(LOAD_TESTS_RESULTS_DIR)
cd $(LOAD_TESTS_DIR) && \
locust -f chat_api_locustfile.py \
--host=http://localhost:8002 \
--users=5 \
--spawn-rate=1 \
--run-time=300s \
--headless \
--html=results/chat_api_$(TIMESTAMP).html \
--csv=results/chat_api_$(TIMESTAMP)
@echo ""
@echo "✅ Load test complete. Results saved to $(LOAD_TESTS_RESULTS_DIR)/chat_api_$(TIMESTAMP).*"
@python $(LOAD_TESTS_DIR)/format_results.py $(LOAD_TESTS_RESULTS_DIR)
load-test-chat-10rps:
@echo "Running Chat API load test - 10 RPS target..."
@echo "⚠️ Note: Chat API uses actual LLM inference (6-7 min), expect queue buildup"
@mkdir -p $(LOAD_TESTS_RESULTS_DIR)
cd $(LOAD_TESTS_DIR) && \
locust -f chat_api_locustfile.py \
--host=http://localhost:8002 \
--users=10 \
--spawn-rate=2 \
--run-time=300s \
--headless \
--html=results/chat_api_10rps_$(TIMESTAMP).html \
--csv=results/chat_api_10rps_$(TIMESTAMP)
@echo ""
@echo "✅ Load test complete. Results saved to $(LOAD_TESTS_RESULTS_DIR)/chat_api_10rps_$(TIMESTAMP).*"
@python $(LOAD_TESTS_DIR)/format_results.py $(LOAD_TESTS_RESULTS_DIR)
load-test-chat-100rps:
@echo "Running Chat API load test - 100 RPS target..."
@echo "⚠️ Warning: This will likely cause timeouts and failures due to LLM inference time"
@mkdir -p $(LOAD_TESTS_RESULTS_DIR)
cd $(LOAD_TESTS_DIR) && \
locust -f chat_api_locustfile.py \
--host=http://localhost:8002 \
--users=100 \
--spawn-rate=10 \
--run-time=300s \
--headless \
--html=results/chat_api_100rps_$(TIMESTAMP).html \
--csv=results/chat_api_100rps_$(TIMESTAMP)
@echo ""
@echo "✅ Load test complete. Results saved to $(LOAD_TESTS_RESULTS_DIR)/chat_api_100rps_$(TIMESTAMP).*"
@python $(LOAD_TESTS_DIR)/format_results.py $(LOAD_TESTS_RESULTS_DIR)
load-test-chat-1000rps:
@echo "Running Chat API load test - 1000 RPS target..."
@echo "⚠️ Warning: This WILL cause widespread failures. Use only for stress testing limits."
@mkdir -p $(LOAD_TESTS_RESULTS_DIR)
cd $(LOAD_TESTS_DIR) && \
locust -f chat_api_locustfile.py \
--host=http://localhost:8002 \
--users=500 \
--spawn-rate=50 \
--run-time=300s \
--headless \
--html=results/chat_api_1000rps_$(TIMESTAMP).html \
--csv=results/chat_api_1000rps_$(TIMESTAMP)
@echo ""
@echo "✅ Load test complete. Results saved to $(LOAD_TESTS_RESULTS_DIR)/chat_api_1000rps_$(TIMESTAMP).*"
@python $(LOAD_TESTS_DIR)/format_results.py $(LOAD_TESTS_RESULTS_DIR)
# Web UI (interactive mode)
load-test-web-db-api:
@echo "Starting Locust web UI for DB API..."
@echo "Open http://localhost:8089 in your browser"
cd $(LOAD_TESTS_DIR) && \
locust -f db_api_locustfile.py --host=http://localhost:8001
load-test-web-chat:
@echo "Starting Locust web UI for Chat API..."
@echo "Open http://localhost:8089 in your browser"
cd $(LOAD_TESTS_DIR) && \
locust -f chat_api_locustfile.py --host=http://localhost:8002
# Results
load-test-results:
@echo "Displaying latest load test results..."
@python $(LOAD_TESTS_DIR)/format_results.py $(LOAD_TESTS_RESULTS_DIR)