这两天做一个http测试,客户端使用一台8核16G的虚机,服务器使用8台8核16G的虚机,服务器挂在负载均衡后端。
客户端使用wrk打流
服务器开启nginx,返回 200 ok
测试结果发现服务器nginx的cpu利用率恨不均匀,后来查到有reuseport这个参数,放在listen后面

listen 80 default_server reuseport;

增了了试验了下,果然好用。
下图是对比,上面是不开启reuseport,可以看到cpu利用率在20-40%,而开启了,cpu利用率只有12%了。
http请求

https请求

我的测试机器安装

[root@vm100-0-11-135 ~]# rpm -qa|grep nginx
nginx-mod-stream-1.16.1-1.el7.x86_64
nginx-1.16.1-1.el7.x86_64
nginx-filesystem-1.16.1-1.el7.noarch
nginx-mod-http-perl-1.16.1-1.el7.x86_64
nginx-mod-http-xslt-filter-1.16.1-1.el7.x86_64
nginx-mod-http-image-filter-1.16.1-1.el7.x86_64
nginx-mod-mail-1.16.1-1.el7.x86_64
nginx-all-modules-1.16.1-1.el7.noarch
[root@vm100-0-11-135 ~]# nginx -V
nginx version: nginx/1.16.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-stream_ssl_preread_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-http_auth_request_module --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-google_perftools_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E'

nginx启用reuseport相关推荐

  1. nginx增加php支持,Nginx启用php支持

    在apache中启用php很简单,apache有phpmodule模块,集成进去就OK.在nginx中启用php支持稍有些不同. 1.nginx的worker进程直接管理每一个请求到nginx的网络请 ...

  2. nginx作用_云服务器:详解Nginx启用proxy_buffer缓冲

    云服务器:顾名思义,proxy_buffer 是用于 proxy 模式的缓冲功能.本文介绍其基本用法. buffer 是什么 buffer ,即缓冲区,它在 Nginx 上发挥的作用就是 启用一个缓冲 ...

  3. php 监控nginx日志,nginx启用status监控服务器状态的方法详解

    nginx和php-fpm一样内建了一个状态页,对于想了解nginx的状态以及监控nginx非常有帮助. 在Nginx中的stub_status模块主要用于查看Nginx的一些状态信息.本模块默认是不 ...

  4. Nginx 启用 gzip 压缩

      Gzip是若干种文件压缩程序的简称,通常指GNU计划的实现,此处的 gzip 代表GNU zip.也经常用来表示 gzip 这种文件格式. 什么是 Gzip ? Gzip是若干种文件压缩程序的简称 ...

  5. 关于nginx启用HTTP2后出现ERR_HTTP2_INADEQUATE_TRANSPORT_SECURITY错误的解决方案

    问题 为了提高网站访问速度,在nginx中启用http2协议,配置完成后通过浏览器访问站点无法显示页面,提示"ERR_HTTP2_INADEQUATE_TRANSPORT_SECURITY& ...

  6. 两年来的core折腾之路几点总结,附上nginx启用http2拿来即用的配置

    为什么要迁移,江湖上传说windows server的稳定性不如某某某,这类议题与八卦新闻没两样,不谈,如果windows的价钱能够和linux相同或者差异不至于那么大,我才懒得换,因为穷,这才是重点 ...

  7. nginx启用https访问

    什么是https? https 全称:Hyper Text Transfer Protocol over Secure Socket Layer,是http的安全版.即http下加入SSL协议层,因此 ...

  8. 剖析 TCP - SO_REUSEPORT 使用

    1. 概述 在 TCP 应用中,SO_REUSEPORT 是 TCP 的一个选项设置,它能开启内核功能:网络连接分配负载均衡. 该功能允许多个进程/线程 bind/listen 相同的 IP/PORT ...

  9. QUIC实战(一) 通过Quiche部署支持HTTP3 的NGINX

    之前研究了下quic相关的特性,不过一直没有去搭建过,最近需要在公司搭建一个quic的生产测试环境,记录一下也方便其他需要搭建环境的开发参考. QUIC的搭建方案有很多,最后我们选择了Quiche.C ...

  10. 26.Nginx详解

    文章目录 一 Web服务基础介绍: 1.1 互联网发展历程回顾: 1.2:web服务介绍: 1.2.1 Apace-早期的web服务端: 1.2.1.3:Apache event模型 1.2.2 Ng ...

最新文章

  1. HSV颜色空间 HSV空间各通道分离实验
  2. Quartz Properties 文件
  3. Sqlserver:谈索引优化需要注意的几个方面
  4. 线段树segment_tree go语言实现
  5. cfg桩设备型号_试桩、试验桩、工程桩是一回事吗?
  6. Taro+react开发(60) 第三方icon使用
  7. 安卓适配器类中怎么调用intent_设计模式:代理模式/中介者模式 / 桥接模式/适配器 - 七星望...
  8. MySql 不香了?我们公司为什么放弃MySql选择NewSql?
  9. 物流管理系统需要的服务器,物流业务管理系统
  10. ae遮罩路径图形扭曲插件BAO Boa
  11. idou老师教你学istio :基于角色的访问控制
  12. RV-LINK:输出非预期响应向 GDB 报告错误
  13. HDU 5835 Danganronpa(弹丸论破)
  14. 格局打开,外贸牛人的价格谈判策略!
  15. 03-能看懂代码,就是自己写不出来,怎么办?
  16. sql根据出生日期计算当前年龄 函数TIMESTAMPDIFF()
  17. d3.js画金庸小说力导向图
  18. 如何获取信息源、如何增长眼界?
  19. MySQL优化系列12-MySQL分区表
  20. Docker的文件系统

热门文章

  1. 网站被攻击客户信息被泄露如何解决
  2. 1. 类,对象,对象属性,对象的行为
  3. idea activation code记录
  4. 字节跳动实习生转正工资_上海实习 | 字节跳动 广告设计实习生
  5. 【IT职场】2013中国IT领袖峰会马云演讲实录
  6. IE图标删不掉,桌面IE删了又有了
  7. Oracle VM VirtualBox 打开Ubuntu出现0x00000000指令引用的0x00000000内存,该内存不能为written的解决方案
  8. Centos7下安装MPlay和VLC
  9. 20190301 小中大
  10. 《SpringBoot 手册》:国际化组件 MessageSource