-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
93 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
all: build-server build-lb run | ||
|
||
load-balancer-files = ../../LoadBalancer.cpp ../../LoadBalancer.hpp ../../../lib/httplib.h ../../../lib/json.hpp ../../../lib/umbridge.h | ||
|
||
build-server: | ||
g++ -O3 -w -std=c++11 minimal-server.cpp -o server -lssl -lcrypto -pthread | ||
|
||
build-lb: | ||
g++ -O3 -Wno-unused-result -std=c++17 $(load-balancer-files) -o ../../load-balancer -pthread | ||
|
||
run: | ||
rm -f retry-port-job_id.txt | ||
rm -f retry-respond-job_id.txt | ||
mkdir -p logs | ||
rm -f logs/* | ||
|
||
if ! printenv PORT > /dev/null; then \ | ||
echo "PORT environment variable not set. Using default value 4242."; \ | ||
export PORT=4242; \ | ||
fi && \ | ||
export HQ_SUBMIT_DELAY_MS=100 && \ | ||
while nc -z localhost $$PORT; do \ | ||
read -p "Port $$PORT is already in use. Please enter a different port: " NEW_PORT; \ | ||
PORT=$${NEW_PORT:-$$PORT}; \ | ||
done; \ | ||
cd ../../ && ./load-balancer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
# export TEST_DELAY=1e4 | ||
|
||
if [ -z "$PORT" ]; then | ||
PORT="4242" | ||
fi | ||
|
||
echo "Using URL http://localhost:$PORT" | ||
|
||
echo "Sending requests..." | ||
|
||
for i in {1..300} | ||
do | ||
# Expected output: {"output":[[200.0]]} | ||
# Check if curl output equals expected output | ||
# If not, print error message | ||
|
||
if [ "$(curl -s http://localhost:$PORT/Evaluate -X POST -d '{"name": "forward", "input": [[100.0]]}')" == '{"output":[[200.0]]}' ]; then | ||
echo -n "y" | ||
else | ||
echo $(curl -s http://localhost:$PORT/Evaluate -X POST -d '{"name": "forward", "input": [[100.0]]}') | ||
echo -n "n" | ||
#echo "Error: curl output does not equal expected output" | ||
fi & | ||
|
||
done | ||
|
||
echo "Requests sent. Waiting for responses..." | ||
|
||
wait |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters