[英]Traefik poor upload perfomance
最近我轉向 traefik 作為我選擇的反向代理。 但是注意到在啟用 tls 的情況下使用 traefik 時,上傳到我的 synology NAS 的速度急劇下降。 我做了一些調查並安裝了 librespeed 容器來做一些速度測試。 結果讓我吃驚。 普通 http(通過 VPN 直接到容器)150/300,而在使用 traefik(通過公共 IP)時,它能做的最好是 100/20。 VM 配置為 16 個 CPU(支持硬件 AES 加密/AMD Epyc 7281)和 32 GB 內存,10Gb.net。 這是我應該從 traefik 獲得的正確性能嗎? 上傳速度下降了 10 倍以上。 也許這是配置問題?
services:
traefik:
image: traefik:v2.9.6
container_name: traefik
restart: unless-stopped
networks:
- outbound
- internal
command:
- "--serversTransport.insecureSkipVerify=true"
- "--providers.docker.exposedbydefault=false"
- "--providers.docker=true"
- "--providers.docker.watch"
- "--providers.docker.network=outbound"
- "--providers.docker.swarmMode=false"
- "--entrypoints.http.address=:80"
- "--entrypoints.https.address=:443"
- "--entryPoints.traefik.address=:8888"
- "--entrypoints.http.http.redirections.entryPoint.to=https"
- "--entrypoints.http.http.redirections.entryPoint.scheme=https"
- "--providers.file.directory=/rules"
- "--providers.file.watch=true"
- "--api.insecure=true"
- "--accessLog=true"
- "--accessLog.filePath=/traefik.log"
- "--accessLog.bufferingSize=100"
- "--accessLog.filters.statusCodes=400-499"
- "--metrics"
- "--metrics.prometheus.buckets=0.1,0.3,1.2,5.0"
#- "--log.level=DEBUG"
- "--certificatesResolvers.myresolver.acme.caServer=https://acme-v02.api.letsencrypt.org/directory"
- "--certificatesresolvers.myresolver.acme.storage=acme.json"
- "--certificatesResolvers.myresolver.acme.httpChallenge.entryPoint=http"
- "--certificatesResolvers.myresolver.acme.tlsChallenge=true"
- "--certificatesResolvers.myresolver.acme.email=asd@asd.me"
volumes:
- /etc/localtime:/etc/localtime:ro
- ./traefik/acme.json:/acme.json
- ./traefik/traefik.log:/traefik.log
- ./traefik/rules:/rules
- /var/run/docker.sock:/var/run/docker.sock:ro
ports:
- "80:80"
- "443:443"
- "8888:8888"
librespeed:
image: adolfintel/speedtest
container_name: librespeed
environment:
- MODE=standalone
networks:
- outbound
ports:
- 8080:80
labels:
- "traefik.enable=true"
- "traefik.http.routers.librespeed.rule=Host(`s.mydomain.com`)"
- "traefik.http.services.librespeed.loadbalancer.server.port=80"
- "traefik.http.routers.librespeed.entrypoints=https,http"
- "traefik.http.routers.librespeed.tls=true"
- "traefik.http.routers.librespeed.tls.certresolver=myresolver"
速度下降可能高達 2 倍。
在啟用 TLS 的情況下使用 Traefik 作為反向代理時,您遇到上傳速度下降的原因可能有幾個。
一個潛在的原因是加密和解密過程的開銷導致系統出現瓶頸。 運行 Traefik 時 VM 的 CPU 使用率可能很高,這會導致性能下降。
另一個潛在的原因可能是您的 Traefik 容器的配置沒有針對性能進行優化。 例如,可能有一些配置錯誤的設置導致 CPU 使用率過高,或者可能有一些設置沒有正確利用系統上的可用資源。
您可以嘗試以下一些步驟來幫助提高 Traefik 容器的性能:
通過在命令中添加 --global.sendTimeout=6h 和 --global.readTimeout=6h 來增加 Traefik 中的工作線程數。 通過在命令中添加 --workers=16 來增加 Traefik 中的工作進程數。 要檢查問題是否與加密過程有關,您可以嘗試禁用加密以查看是否可以提高性能。 最后,您可以嘗試禁用訪問日志,這有助於降低 CPU 使用率
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.