首页 新闻 会员 周边 捐助

高并发压力测试,nginx负载均衡Connection refused,tomcat请求正常

0
悬赏园豆:10 [已解决问题] 解决于 2018-09-18 13:49

java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:121)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)
at org.apache.jmeter.protocol.http.sampler.hc.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:318)
at org.apache.jmeter.protocol.http.sampler.MeasuringConnectionManager$MeasuredConnection.open(MeasuringConnectionManager.java:114)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:835)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:697)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:455)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1189)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1178)
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:490)
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:416)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:250)
at java.lang.Thread.run(Unknown Source)

tomcat压测正常,说明问题应出在nainx负载均衡上,求指教

每天都要学一点的主页 每天都要学一点 | 初学一级 | 园豆:169
提问于:2018-09-12 09:28
< >
分享
最佳答案
0

先查看下nginx日志记录。

收获园豆:5
Shendu.CC | 老鸟四级 |园豆:2138 | 2018-09-12 09:57

nginx没有错误日志

每天都要学一点 | 园豆:169 (初学一级) | 2018-09-12 10:33

@张亚南: 是没有配置日志记录还是没有错误记录?

如果nginx的error.log 没有记录的话,说明你的nginx配置没问题。

Shendu.CC | 园豆:2138 (老鸟四级) | 2018-09-12 10:59

@Shendu.cc: 配置了日志但没有错误记录。有的时候会有错误日志。如果nginx配置合理的话,为什么tomcat能处理的并发nginx却出现部分连接拒绝?

每天都要学一点 | 园豆:169 (初学一级) | 2018-09-12 11:15

@张亚南: nginx 配置的最大连接数是多少? worker_connections;
你的并发量是多大?

Shendu.CC | 园豆:2138 (老鸟四级) | 2018-09-12 11:45

@Shendu.cc: 最大连接数20480*8,并发量10000.请求的request headers也不完整
POST http://192.168.1.56:81/naire/answerGuest/test

POST data:
id=62&sex=1

[no cookies]

Request Headers:
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded

每天都要学一点 | 园豆:169 (初学一级) | 2018-09-12 13:32
其他回答(2)
0

压力有打过去吗 你这是本地jmeter报的错吧

收获园豆:5
ycyzharry | 园豆:25683 (高人七级) | 2018-09-12 13:14

一部分不过了,没过去的request headers不完整
POST http://192.168.1.56:81/naire/answerGuest/test

POST data:
id=62&sex=1

[no cookies]

Request Headers:
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded

支持(0) 反对(0) 每天都要学一点 | 园豆:169 (初学一级) | 2018-09-12 13:33

@张亚南: 少压点 会报错吗

支持(0) 反对(0) ycyzharry | 园豆:25683 (高人七级) | 2018-09-12 17:55

@ycyzharry: 1000个很稳定,2000以内很少次报错,2000-5000错误请求率在50%以下,5000以上除了个别次基本都会报错,错误请求率在50-80%

支持(0) 反对(0) 每天都要学一点 | 园豆:169 (初学一级) | 2018-09-13 08:31

@张亚南: 一台机器少压点 不超过3000 用2台机器每台3000压试试

支持(0) 反对(0) ycyzharry | 园豆:25683 (高人七级) | 2018-09-13 13:05
0

自己解决了。nginx不支持windows更高的配置

每天都要学一点 | 园豆:169 (初学一级) | 2018-09-18 13:49

你好,请问是怎么解决的呀?我也碰到这个问题了

支持(0) 反对(0) 絕代風華 | 园豆:200 (初学一级) | 2019-12-17 17:15

@絕代風華: 建议在Linux下测试。官网说还不能很好的支持windows,http://nginx.org/en/docs/windows.html
……
Version of nginx for Windows uses the native Win32 API (not the Cygwin emulation layer). Only the select() and poll() (1.15.9) connection processing methods are currently used, so high performance and scalability should not be expected.
……
Although several workers can be started, only one of them actually does any work.……

支持(0) 反对(0) 每天都要学一点 | 园豆:169 (初学一级) | 2019-12-18 08:46
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册