Added csv output
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -16,6 +16,9 @@ docker-compose.yml
|
||||
# production
|
||||
#/frontend/build
|
||||
|
||||
#test results
|
||||
/tests/benchmark.csv
|
||||
|
||||
# misc
|
||||
**/.DS_Store
|
||||
**/.env.local
|
||||
|
||||
BIN
docs/FiregexBenchmark.png
Normal file
BIN
docs/FiregexBenchmark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
@@ -28,6 +28,8 @@ The testing methodology will soon be updated with more edge-cases.
|
||||
|
||||
# Running a Benchmark
|
||||
./benchmark.py
|
||||
options:
|
||||
-h, --help show this help message and exit
|
||||
--address ADDRESS, -a ADDRESS
|
||||
Address of firegex backend
|
||||
--service_port SERVICE_PORT, -P SERVICE_PORT
|
||||
@@ -40,27 +42,12 @@ The testing methodology will soon be updated with more edge-cases.
|
||||
Number of regexes to benchmark with
|
||||
--duration DURATION, -d DURATION
|
||||
Duration of the Benchmark in seconds
|
||||
--output_file OUTPUT_FILE, -o OUTPUT_FILE
|
||||
Output results csv file
|
||||
|
||||
Benchmarks let you evaluate the performance of the proxy. You can run one by typing in a shell ```test.py -p FIREGEX_PASSWORD -r NUM_OF_REGEX -d BENCHMARK_DURATION```.
|
||||
|
||||
It uses iperf3 to benchmark the throuput in MB/s of the server, both with proxy, without proxy, and for each new added regex. It will automatically add a new random regex untill it has reached NUM_OF_REGEX specified in the arguments.
|
||||
It uses iperf3 to benchmark the throughput in MB/s of the server, both with proxy, without proxy, and for each new added regex. It will automatically add a new random regex untill it has reached NUM_OF_REGEX specified in the arguments.
|
||||
|
||||
Example output:
|
||||
|
||||
Benchmarking with 30 will start on http://127.0.0.1:5000/
|
||||
Sucessfully logged in ✔
|
||||
Sucessfully created service Benchmark Service with public port 1337 ✔
|
||||
Sucessfully received the internal port 38249 ✔
|
||||
Baseline without proxy: 7145.402353788159MB/s
|
||||
Sucessfully started service with id benchmark-service ✔
|
||||
Performance with no regexes: 2255.4573361742887MB/s
|
||||
Performance with 1 regex(s): 76.51810976542541MB/s
|
||||
Performance with 2 regex(s): 38.769568516424684MB/s
|
||||
Performance with 3 regex(s): 25.976997107893663MB/s
|
||||
Performance with 4 regex(s): 19.539058399917625MB/s
|
||||
Performance with 5 regex(s): 14.720692718915746MB/s
|
||||
Performance with 6 regex(s): 13.101487751340413MB/s
|
||||
Performance with 7 regex(s): 11.237772047509017MB/s
|
||||
Performance with 8 regex(s): 9.851833265188406MB/s
|
||||
Performance with 9 regex(s): 8.725255532797124MB/s
|
||||
Performance with 10 regex(s): 7.891516589287963MB/s
|
||||
You will find a new benchmark.csv file containg the results.
|
||||

|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import argparse, socket,secrets, base64, iperf3
|
||||
import argparse, socket,secrets, base64, iperf3, csv
|
||||
from time import sleep
|
||||
from requests import Session
|
||||
from multiprocessing import Process
|
||||
@@ -28,6 +28,7 @@ parser.add_argument("--service_name", "-n", type=str , required=False, help='Nam
|
||||
parser.add_argument("--password", "-p", type=str, required=True, help='Firegex password')
|
||||
parser.add_argument("--num_of_regexes", "-r", type=int, required=True, help='Number of regexes to benchmark with')
|
||||
parser.add_argument("--duration", "-d", type=int, required=False, help='Duration of the Benchmark in seconds', default=5)
|
||||
parser.add_argument("--output_file", "-o", type=str, required=False, help='Output results csv file', default="benchmark.csv")
|
||||
|
||||
args = parser.parse_args()
|
||||
sep()
|
||||
@@ -74,7 +75,7 @@ def getReading(port):
|
||||
client.server_hostname = '127.0.0.1'
|
||||
client.port = port
|
||||
client.protocol = 'tcp'
|
||||
return client.run().json['end']['sum_received']['bits_per_second']/8e+6
|
||||
return round(client.run().json['end']['sum_received']['bits_per_second']/8e+6 , 3)
|
||||
|
||||
server = Process(target=startServer)
|
||||
server.start()
|
||||
@@ -109,8 +110,12 @@ for i in range(1,args.num_of_regexes+1):
|
||||
results.append(getReading(args.service_port))
|
||||
print(f"{results[i]} MB/s")
|
||||
|
||||
print("Results:")
|
||||
print(results)
|
||||
with open(args.output_file,'w') as f:
|
||||
writer = csv.writer(f)
|
||||
for i,result in enumerate(results):
|
||||
writer.writerow([i,result])
|
||||
|
||||
puts(f"Sucessfully written results to {args.output_file} ✔", color=colors.magenta)
|
||||
|
||||
#Delete the Service
|
||||
req = s.get(f"{args.address}api/service/{service_id}/delete")
|
||||
|
||||
Reference in New Issue
Block a user