尧图网站建设 尧图网络
  • 首页
  • 关于我们
  • 服务项目
  • 案例展示
  • 建站流程
  • 资讯中心
  • 联系我们
首页/资讯中心/详情

docker nginx 和宿主机原生 nginx 服务的性能压测对比

docker nginx 和宿主机原生 nginx 服务的性能压测对比
📅 发布时间:2026/6/19 22:54:04

1、通过 yum install -y nginx 安装的原生 nginx 1.20.1

➜  ~ service nginx restart
Redirecting to /bin/systemctl restart nginx.service
➜  ~ curl localhost
<!DOCTYPE html>
<html>
<head>
<title>HTTP Server Test Page</title>
<style>body {width: 35em;margin: 0 auto;font-family: Tahoma, Verdana, Arial, sans-serif;}
</style>
</head>
<body>
<h1>Welcome to HTTP Server Test Page!</h1>
<p>If you see this page, the httpd web server is successfully installed and
working. Further configuration is required.</p><p><em>Thank you for using apache httpd.</em></p>
</body>
</html>
➜  ~ ab -n 50000 -c 1000 http://localhost/
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 5000 requests
Completed 10000 requests
Completed 15000 requests
Completed 20000 requests
Completed 25000 requests
Completed 30000 requests
Completed 35000 requests
Completed 40000 requests
Completed 45000 requests
Completed 50000 requests
Finished 50000 requestsServer Software:        nginx/1.20.1
Server Hostname:        localhost
Server Port:            80Document Path:          /
Document Length:        452 bytesConcurrency Level:      1000
Time taken for tests:   5.816 seconds
Complete requests:      50000
Failed requests:        0
Total transferred:      34250000 bytes
HTML transferred:       22600000 bytes
Requests per second:    8596.25 [#/sec] (mean)
Time per request:       116.330 [ms] (mean)
Time per request:       0.116 [ms] (mean, across all concurrent requests)
Transfer rate:          5750.42 [Kbytes/sec] receivedConnection Times (ms)min  mean[+/-sd] median   max
Connect:        0   46   7.2     46      71
Processing:    23   69  13.9     69     140
Waiting:        1   51  13.1     48     122
Total:         45  115  12.7    115     173Percentage of the requests served within a certain time (ms)50%    11566%    12075%    12380%    12590%    13395%    13898%    14399%    148100%    173 (longest request)

平均耗时 115ms

 

2、通过 docker pull nginx:1.20.1 安装的 docker run -d -p 80:80 nginx:1.20.1

➜  ~ docker ps
CONTAINER ID   IMAGE          COMMAND                  CREATED       STATUS       PORTS                               NAMES
3c91d5b22774   nginx:1.20.1   "/docker-entrypoint.…"   2 hours ago   Up 2 hours   0.0.0.0:80->80/tcp, :::80->80/tcp   upbeat_roentgen
➜  ~ curl localhost
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>body {width: 35em;margin: 0 auto;font-family: Tahoma, Verdana, Arial, sans-serif;}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p><p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p><p><em>Thank you for using nginx.</em></p>
</body>
</html>
➜  ~ ab -n 50000 -c 1000 http://localhost/
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 5000 requests
Completed 10000 requests
Completed 15000 requests
Completed 20000 requests
Completed 25000 requests
Completed 30000 requests
Completed 35000 requests
Completed 40000 requests
Completed 45000 requests
Completed 50000 requests
Finished 50000 requestsServer Software:        nginx/1.20.1
Server Hostname:        localhost
Server Port:            80Document Path:          /
Document Length:        612 bytesConcurrency Level:      1000
Time taken for tests:   15.255 seconds
Complete requests:      50000
Failed requests:        0
Total transferred:      42250000 bytes
HTML transferred:       30600000 bytes
Requests per second:    3277.64 [#/sec] (mean)
Time per request:       305.098 [ms] (mean)
Time per request:       0.305 [ms] (mean, across all concurrent requests)
Transfer rate:          2704.69 [Kbytes/sec] receivedConnection Times (ms)min  mean[+/-sd] median   max
Connect:        0   13  14.5      8      88
Processing:    57  290  59.9    285     565
Waiting:        1  281  59.8    277     562
Total:         57  303  56.9    297     582Percentage of the requests served within a certain time (ms)50%    29766%    32075%    33680%    34990%    37795%    40398%    44199%    468100%    582 (longest request)

平均耗时 303ms

 

欢迎关注我的微信公众号「猫哥学前班」

相关新闻

  • kode-cli+glm4.6测评
  • UEFI - FV/FFS/FDF 的关系 - 阿源
  • 预算管理不用愁 - 智慧园区

最新新闻

  • 2026长沙防水补漏权威指南:卫生间/屋面/外墙/地下室正规施工+透明报价+避坑全攻略 - 苏易修缮
  • 爱回收靠谱吗?一个测评博主的深度复盘 - 新闻快传
  • 2026昆山建筑修缮行业全景分析:昆山鼎壹万防水补漏公司及本地适配服务商深度指南 专业防水公司排名推荐(2026年6月防水补漏最新TOP权威排名) - 鼎壹万修缮说
  • 六安7年烘焙老店|三个叔叔手工吐司文庙街店:用心做好每一款生日蛋糕 - 速递信息
  • 2026合肥防水补漏权威指南:卫生间/屋面/外墙/地下室正规施工+透明报价+避坑全攻略 - 苏易修缮
  • 爱回收买iPad靠谱吗?质检与售后逐项看 - 新闻快传

日新闻

  • 5分钟掌握Python进化算法:Geatpy高性能优化工具完全指南
  • Microchip 24AA044 EEPROM选型与应用全指南:从参数解析到实战编程
  • 华为的鸿蒙到底有多牛?为什么称作遥遥领先?

周新闻

  • 3步解锁iOS设备:applera1n激活锁绕过完全指南
  • 39 2026 人工智能证书终极盘点,普通人选 AI 证书可以从这些方向入手
  • Redis 暴露公网有多危险?从端口检查到补救步骤

月新闻

  • 【总结】入门篇:50句话让你记住架构核心概念
  • WeChatMsg技术方案解析:实现Mac微信数据自主管理的完整解决方案
  • WeChatMsg:革新性微信数据备份方案,打造你的专属数字记忆库

关于尧图

  • 公司简介
  • 团队介绍
  • 企业文化
  • 荣誉资质

服务项目

  • 定制开发
  • 电商建站
  • UI 设计
  • 运维服务

快速链接

  • 案例展示
  • 建站流程
  • 常见问题
  • 资讯中心

联系方式

  • 📍北京市朝阳区互联网产业园 A 座 10 层
  • 📞400-888-8888
  • ✉️contact@rkmt.cn
  • 🕐周一至周日 9:00-21:00

© 2024 北京尧图网络科技有限公司 版权所有 | 京 ICP 备 XXXXXXXX 号