Skip to content

Commit b59aba3

Browse files
committed
resuse existing pieces
1 parent 8aa3911 commit b59aba3

File tree

10 files changed

+80
-126
lines changed

10 files changed

+80
-126
lines changed

docker/nginx/nginx-plain-tls.conf

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# perf: define how many processes can be used ('auto' for one per core, doesn't work on docker)
2+
worker_processes WORKER_PROCESSES;
3+
4+
events {
5+
# perf: ensures that each worker accepts as many connections as possible
6+
multi_accept on;
7+
worker_connections 1024;
8+
use epoll;
9+
}
10+
11+
http {
12+
13+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
14+
15+
upstream backend {
16+
server DOWNSTREAM_ADDRESS:DOWNSTREAM_PORT;
17+
keepalive 1024; # more than twice the number of client connections, since warmup will already reserve a set
18+
}
19+
20+
server {
21+
listen 8080 ssl;
22+
23+
ssl_certificate /etc/ssl/certs/testCert.crt;
24+
ssl_certificate_key /etc/ssl/private/testCert.rsa;
25+
26+
# Disable TLS session resumption
27+
ssl_session_cache off;
28+
ssl_session_tickets off;
29+
30+
server_name _;
31+
32+
access_log off;
33+
error_log stdout info;
34+
35+
# returns plain text response
36+
location /hello-world {
37+
return 200 'Hello World!';
38+
add_header Content-Type text/plain;
39+
}
40+
41+
location / {
42+
proxy_pass DOWNSTREAM_SCHEME://backend;
43+
proxy_http_version 1.1;
44+
proxy_set_header Connection ""; # Remove the Connection header if the client sends it, we don't want to close the upstream connection
45+
}
46+
}
47+
}

docker/nginx/nginx.dockerfile

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ ARG SERVER_SCHEME=http
44
# http, http2
55
ARG SERVER_PROTOCOL=http
66

7+
# custom scenario
8+
ARG CUSTOM_SCENARIO=default
9+
710
# NOTE: nginx doesn't support http2 connections to the upstream server
811

912
FROM mcr.microsoft.com/cbl-mariner/base/nginx:1 AS base
@@ -20,17 +23,17 @@ ADD run.sh /
2023
RUN chmod +x /run.sh
2124

2225
# Listening to http connections
23-
FROM base AS scheme-http-http
26+
FROM base AS scheme-http-http-default
2427
# ARG SERVER_SCHEME
2528
ADD nginx-http.conf /etc/nginx/nginx.conf
2629

2730
# Listening to https connections
28-
FROM base AS scheme-https-http
31+
FROM base AS scheme-https-http-default
2932
# ARG SERVER_SCHEME
3033
ADD nginx-https.conf /etc/nginx/nginx.conf
3134

3235
# Listening to h2 connections
33-
FROM base AS scheme-https-http2
36+
FROM base AS scheme-https-http2-default
3437
# ARG SERVER_SCHEME
3538
ADD nginx-http2.conf /etc/nginx/nginx.conf
3639

@@ -40,10 +43,15 @@ ADD nginx-http2.conf /etc/nginx/nginx.conf
4043
# ADD nginx-http2.conf /etc/nginx/nginx.conf
4144

4245
# Listening to gRPC connections
43-
FROM base AS scheme-https-grpc
46+
FROM base AS scheme-https-grpc-default
4447
# ARG SERVER_SCHEME
4548
ADD nginx-grpc.conf /etc/nginx/nginx.conf
4649

47-
FROM scheme-${SERVER_SCHEME}-${SERVER_PROTOCOL} AS final
50+
# Listening to simple TLS connections
51+
FROM base AS scheme-https-http-tls
52+
# ARG SERVER_SCHEME
53+
ADD nginx-plain-tls.conf /etc/nginx/nginx.conf
54+
55+
FROM scheme-${SERVER_SCHEME}-${SERVER_PROTOCOL}-${CUSTOM_SCENARIO} AS final
4856

4957
ENTRYPOINT ["/run.sh"]

docker/nginx/run.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ sed -i "s|DOWNSTREAM_SCHEME|$DOWNSTREAM_SCHEME|g" /etc/nginx/nginx.conf
77
sed -i "s|DOWNSTREAM_ADDRESS|$DOWNSTREAM_ADDRESS|g" /etc/nginx/nginx.conf
88
sed -i "s|DOWNSTREAM_PORT|$DOWNSTREAM_PORT|g" /etc/nginx/nginx.conf
99
cat /etc/nginx/nginx.conf
10+
11+
echo "$(date) - Application started."
1012
nginx -g "daemon off;"

scenarios/tls.benchmarks.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,24 @@ jobs:
7272
environmentVariables:
7373
urls: "https://*:8080" # any ip, port 8080
7474

75+
dockerLinuxNginxServer:
76+
source:
77+
Repository: https://github.com/aspnet/benchmarks.git
78+
BranchOrCommit: main
79+
DockerFile: docker/nginx/nginx.dockerfile
80+
DockerImageName: nginx-reverseproxy
81+
DockerContextDirectory: docker/nginx
82+
environmentVariables:
83+
DOWNSTREAM_SCHEME: '{{downstreamScheme}}'
84+
DOWNSTREAM_ADDRESS: '{{downstreamAddress}}'
85+
DOWNSTREAM_PORT: '{{downstreamPort}}'
86+
WORKER_PROCESSES: '{{cores}}'
87+
buildArguments:
88+
- SERVER_SCHEME=https
89+
- SERVER_PROTOCOL=http
90+
- CUSTOM_SCENARIO=tls
91+
port: 8080
92+
7593
scenarios:
7694

7795
# HTTP.SYS

src/BenchmarksApps/TLS/Nginx/Dockerfile

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/BenchmarksApps/TLS/Nginx/config/cert.pem

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/BenchmarksApps/TLS/Nginx/config/key.pem

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/BenchmarksApps/TLS/Nginx/config/nginx.conf

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/BenchmarksApps/TLS/Nginx/invoke.ps1

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/BenchmarksApps/TLS/Nginx/start-nginx.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)