version 0.2.0
This commit is contained in:
		
							parent
							
								
									d19c4efad3
								
							
						
					
					
						commit
						3dddee43f7
					
				
					 32 changed files with 243 additions and 1020337 deletions
				
			
		
							
								
								
									
										2
									
								
								benchmarks/http_1_v_11/anthracite.Dockerfile
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								benchmarks/http_1_v_11/anthracite.Dockerfile
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,2 @@
 | 
			
		|||
FROM anthracite:latest
 | 
			
		||||
COPY ./www/ /www/
 | 
			
		||||
							
								
								
									
										36
									
								
								benchmarks/http_1_v_11/benchmark.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								benchmarks/http_1_v_11/benchmark.py
									
										
									
									
									
										Normal 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')
 | 
			
		||||
							
								
								
									
										7
									
								
								benchmarks/http_1_v_11/docker-compose.yaml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								benchmarks/http_1_v_11/docker-compose.yaml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,7 @@
 | 
			
		|||
services:
 | 
			
		||||
  anthracite:
 | 
			
		||||
    build: 
 | 
			
		||||
      context: .
 | 
			
		||||
      dockerfile: anthracite.Dockerfile
 | 
			
		||||
    ports:
 | 
			
		||||
      - "8091:80"
 | 
			
		||||
							
								
								
									
										4
									
								
								benchmarks/http_1_v_11/rebuild-container.sh
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										4
									
								
								benchmarks/http_1_v_11/rebuild-container.sh
									
										
									
									
									
										Executable 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
									
								
							
							
						
						
									
										1
									
								
								benchmarks/http_1_v_11/run.sh
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
docker-compose stop && ./rebuild-container.sh && docker compose up -d && clear && python3 benchmark.py && docker-compose stop
 | 
			
		||||
							
								
								
									
										2
									
								
								benchmarks/http_1_v_11/www/test.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								benchmarks/http_1_v_11/www/test.html
									
										
									
									
									
										Normal 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>
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue