![]() | 1 BBCCBB 2019-09-02 15:52:10 +08:00 这是肯定的, 挂个 nginx 中间多了一层转发消耗, 挂 nginx 是为了其他的功能,比如多实例水平扩展, 负载均衡, 做统一的权限认证等. |
![]() | 2 opengps 2019-09-02 15:54:56 +08:00 nginx 是为了多台同职责机器对外统一服务入口,多台机器做负载均衡,不是提高单机性能 |
![]() | 3 Mei99 OP @opengps 可是 Nginx 不是说轻松达到几万 QPS 吗?那压测 Nginx 的话不应该是接近 Tomcat 的 QPS*2 吗? |
![]() | 4 opengps 2019-09-02 15:56:37 +08:00 等等,楼主意思是负载均衡后 2 台才 5000,不如一台的 8000 ? |
![]() | 6 opengps 2019-09-02 15:58:57 +08:00 关注下 Nginx 机器的网卡使用情况,压测时候是不是占满了带宽 |
![]() | 7 Mei99 OP @opengps 带宽应该没啥问题,内网千兆互联,看 Jmeter 最大发送速度才 2.5MB/s,Nginx 机器的 CPU 也没有跑满,压测机是 i9 9900K |
![]() | 8 akira 2019-09-02 16:21:03 +08:00 是不是都只转发到一边去了。。 |
9 0ZXYDDu796nVCFxq 2019-09-02 16:23:35 +08:00 via Android jmeter 有性能问题 用 wrk 压吧 |
10 zjlletian 2019-09-02 16:26:29 +08:00 这就太多了要考虑的了,改下 nginx 线程数,连接数配置? |
![]() | 11 justseemore 2019-09-02 16:29:36 +08:00 贴下 nginx 配置? |
![]() | 15 justseemore 2019-09-02 16:41:09 +08:00 @Mei99 额 我意思是配置文件.. |
![]() | 16 LeeSeoung 2019-09-02 17:35:51 +08:00 看 nginx log 看 tomcat log |
![]() | 17 Xusually 2019-09-02 17:39:37 +08:00 一般情况下不会的。。大概率是 NGINX 配置问题或者 NGINX 那台机器的内核参数配置问题。 |
![]() | 18 cloudyplain 2019-09-02 17:41:56 +08:00 可能是 nginx 配置的问题,是否是长连接、upstream 连接池是否足够大、网络问题等等 |
![]() | 19 janxin 2019-09-02 17:51:13 +08:00 我盲猜可能是 nginx 相关配置的问题 |
![]() | 20 gz911122 2019-09-02 17:54:05 +08:00 盲猜两个 tomcat 在一个机器上 |
![]() | 21 chendy 2019-09-02 18:15:38 +08:00 盲猜两个 tomcat 在一个机器上 +1 |
![]() | 22 lishunan246 2019-09-02 18:22:49 +08:00 有可能是你 Jmeter 压测的时候线程数固定而且顺序发请求。 由于多路过一台机器请求完成时间增加了 60%,比如说 1ms 变成了 1.6ms 。 qps 自然就变成了原来的 5/8。 |
![]() | 23 jsy123392550 2019-09-02 18:23:39 +08:00 盲猜两个 tomcat 在一个机器上 +2 |
24 stupil 2019-09-02 18:28:34 +08:00 盲猜两个 tomcat 在一个机器上 +3 |
![]() | 25 autogen 2019-09-02 18:44:39 +08:00 你有几台机器? |
![]() | 26 janxin 2019-09-02 18:59:00 +08:00 ![]() 盲猜 Tomcat 在一个机器上你们是真没看吧... |
![]() | 27 Mei99 OP nginx.conf: worker_processes auto; pid /run/nginx.pid; include /etc/nginx/modules-enabled/*.conf; worker_rlimit_nofile 65535; events { use epoll; worker_connections 65535; #multi_accept on; } http { upstream tomcat{ server 192.168.50.166:8080; server 192.168.50.99:8080; keepalive 20480; } server{ listen 8080; location / { proxy_pass http://tomcat; proxy_http_version 1.1; proxy_set_header Connection ""; } } sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 15; types_hash_max_size 2048; server_tokens off; client_header_buffer_size 4k; client_max_body_size 10m; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; ## # SSL Settings ## ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE ssl_prefer_server_ciphers on; ## # Logging Settings ## access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; |
![]() | 28 lishunan246 2019-09-02 19:18:11 +08:00 预期能有 16000qps 现在只有 5000 的话,可以试试线程数*3 再压 |
![]() | 29 zhuisui 2019-09-02 19:42:33 +08:00 worker_connections 和 keepalive 不是越高越好 看看连接的状态 |
![]() | 30 realpg PRO 如果没有硬件瓶颈问题 基本是 nginx 没配好 我的低配机器 nginx 做入口,都能上万 QPS |
![]() | 31 nekoyaki 2019-09-03 11:44:53 +08:00 楼主你的 192.168.50.166 和 192.168.50.99 这两台机器和 nginx 所在服务器之间的网络是什么网络? 网络延迟可能是一个比较大的因素,如果中间有路由器 /交换机,可能也得查查负载和延迟 |