Skip to content

Commit 068f085

Browse files
committed
dev: add benchmark scripts
1 parent 47d9d51 commit 068f085

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

fastapi-benchmark.sh

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
3+
OUTPUT_FILE="fastapi.log"
4+
5+
python fastapi-app.py > "$OUTPUT_FILE" 2>&1 &
6+
PYTHON_PID=$!
7+
8+
cleanup() {
9+
echo "stopping server..."
10+
kill $PYTHON_PID
11+
}
12+
13+
trap cleanup EXIT
14+
15+
# wait for the server to start
16+
sleep 10
17+
18+
echo "warming up pytorch model..."
19+
python client.py --infile "cats-image.png" --jobs 10
20+
21+
echo "running benchmark..."
22+
23+
echo "experiment 1: 10 concurrent requests"
24+
python client.py --infile "cats-image.png" --jobs 10
25+
26+
echo "experiment 2: 50 concurrent requests"
27+
python client.py --infile "cats-image.png" --jobs 50
28+
29+
echo "experiment 3: 100 concurrent requests"
30+
python client.py --infile "cats-image.png" --jobs 100
31+
32+
echo "experiment 4: 200 concurrent requests"
33+
python client.py --infile "cats-image.png" --jobs 200

litserve-benchmark.sh

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
3+
OUTPUT_FILE="litserve.log"
4+
5+
python litserve-app.py > "$OUTPUT_FILE" 2>&1 &
6+
PYTHON_PID=$!
7+
8+
cleanup() {
9+
echo "stopping server..."
10+
kill $PYTHON_PID
11+
}
12+
13+
trap cleanup EXIT
14+
15+
# wait for the server to start
16+
sleep 10
17+
18+
echo "warming up pytorch model..."
19+
python client.py --infile "cats-image.png" --jobs 10
20+
21+
echo "running benchmark..."
22+
23+
echo "experiment 1: 10 concurrent requests"
24+
python client.py --infile "cats-image.png" --jobs 10
25+
26+
echo "experiment 2: 50 concurrent requests"
27+
python client.py --infile "cats-image.png" --jobs 50
28+
29+
echo "experiment 3: 100 concurrent requests"
30+
python client.py --infile "cats-image.png" --jobs 100
31+
32+
echo "experiment 4: 200 concurrent requests"
33+
python client.py --infile "cats-image.png" --jobs 200

0 commit comments

Comments
 (0)