version 0.2.0

This commit is contained in:
Nicholas Orlowsky 2023-10-20 12:46:30 -04:00
parent d19c4efad3
commit 3dddee43f7
No known key found for this signature in database
GPG key ID: BE7DF0188A405E2B
32 changed files with 243 additions and 1020337 deletions

View file

@ -0,0 +1,2 @@
FROM anthracite:latest
COPY ./www/ /www/

View file

@ -0,0 +1,36 @@
import socket
import time
num_requests = 10000
http_1_times = []
http_11_times = []
print('=====[ Anthracite Benchmarking Tool ]=====')
print(f'Requests : {num_requests}')
print(f'Test : HTTP 1.0 vs HTTP 1.1\n\n')
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect(("localhost" , 8091))
for i in range(num_requests):
start_time = time.time()
s.sendall(b"GET /test.html HTTP/1.1\r\nAccept: text/html\r\nConnection: keep-alive\r\n\r\n")
data = s.recv(220)
end_time = time.time()
http_11_times.append((end_time - start_time))
s.close()
for i in range(num_requests):
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
start_time = time.time()
s.connect(("localhost" , 8091))
s.sendall(b"GET /test.html HTTP/1.0\r\nAccept: text/html\r\n\r\n")
data = s.recv(220)
end_time = time.time()
http_1_times.append((end_time - start_time))
s.close()
run_time_1 = sum(http_1_times)
run_time_11 = sum(http_11_times)
print(f'HTTP/1.0 Total Time: {run_time_1:.4f} seconds')
print(f'HTTP/1.1 Total Time: {run_time_11:.4f} seconds')

View file

@ -0,0 +1,7 @@
services:
anthracite:
build:
context: .
dockerfile: anthracite.Dockerfile
ports:
- "8091:80"

View file

@ -0,0 +1,4 @@
cd ../..
docker build . -t anthracite:latest
cd benchmarks/http_1_v_11
docker compose build

1
benchmarks/http_1_v_11/run.sh Executable file
View file

@ -0,0 +1 @@
docker-compose stop && ./rebuild-container.sh && docker compose up -d && clear && python3 benchmark.py && docker-compose stop

View file

@ -0,0 +1,2 @@
<h1>Anthracite Benchmarking</h1>
<p>Test document to test the speed of HTTP/1.0 and HTTP/1.1</p>