Skip to content

NGINX With HTTP3/QUIC Docker Image

Notifications You must be signed in to change notification settings

khs1994-docker/nginx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nginx With HTTP3

GitHub stars GitHub release Docker Stars Docker Pulls

注意

  • 只有一个 server {} 能启用 HTTP3,多个 server {} 启用 HTTP3 会提示冲突。

测试浏览器是否支持 HTTP3

chrome 85+

--enable-quic --quic-version=h3-29 --origin-to-force-quic-on=example.com:443

firefox 80+

about:config -> network.http.http3.enabled = true

草案

Docker Compose

version: "3"

services:
  nginx:
    image: "khs1994/nginx:1.25.3-alpine"
    ports:
      - "80:80"
      - "443:443/tcp"
      - "443:443/udp"
    environment:
      - TZ=Asia/Shanghai
    volumes:
      - ./conf.d:/etc/nginx/conf.d:ro

$ docker run

$ docker run -dit \
         -e TZ=Asia/Shanghai \
         -p 80:80/tcp \
         -p 443:443/tcp \
         -p 443:443/udp \
         -v $PWD/app:/app \
         -v $PWD/conf.d:/etc/nginx/conf.d \
         khs1994/nginx:1.25.3-alpine

Who use it?

khs1994-docker/lnmp use this Docker Image.

Compare

$ docker compose up alpine | buster | official

$ h2load -n 100 -c 10 https://quic.t.khs1994.com

alpine

finished in 772.28ms, 129.49 req/s, 22.08KB/s
requests: 100 total, 100 started, 100 done, 100 succeeded, 0 failed, 0 errored, 0 timeout
status codes: 100 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 17.05KB (17463) total, 1.63KB (1673) headers (space savings 90.49%), 13.18KB (13500) data
                     min         max         mean         sd        +/- sd
time for request:     5.84ms     89.32ms     48.74ms     18.40ms    75.00%
time for connect:    53.88ms    399.50ms    201.96ms    122.59ms    70.00%
time to 1st byte:    92.99ms    460.74ms    233.89ms    120.97ms    70.00%
req/s           :      12.99       17.08       14.62        1.41    70.00%

buster

finished in 954.81ms, 104.73 req/s, 17.93KB/s
requests: 100 total, 100 started, 100 done, 100 succeeded, 0 failed, 0 errored, 0 timeout
status codes: 100 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 17.12KB (17532) total, 1.70KB (1742) headers (space savings 90.10%), 13.18KB (13500) data
                     min         max         mean         sd        +/- sd
time for request:    10.71ms    103.80ms     71.21ms     17.92ms    74.00%
time for connect:   118.40ms    307.03ms    178.26ms     61.53ms    80.00%
time to 1st byte:   163.51ms    396.44ms    232.83ms     73.78ms    80.00%
req/s           :      10.59       12.09       11.35        0.57    60.00%

official

finished in 701.79ms, 142.49 req/s, 36.88KB/s
requests: 100 total, 100 started, 100 done, 100 succeeded, 0 failed, 0 errored, 0 timeout
status codes: 100 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 25.88KB (26500) total, 10.56KB (10710) headers (space savings 39.15%), 13.18KB (13500) data
                     min         max         mean         sd        +/- sd
time for request:     9.32ms     62.95ms     49.54ms      9.66ms    83.00%
time for connect:    82.70ms    285.17ms    150.81ms     70.20ms    80.00%
time to 1st byte:   123.90ms    318.23ms    194.80ms     70.23ms    70.00%
req/s           :      14.26       16.78       15.52        0.96    50.00%

More Infortion