标签:amazon-web-services jmeter apache tomcat java
我已经在Linux和Apache Tomcat 7.0.42中部署了Java EE应用程序
当我使用JMeter对100个用户进行负载测试时,一切正常(并发100个线程请求)
但是,一旦我将用户(或线程数)更改为1000,服务器就会被阻塞,并且在〜600之后,所有请求都会出现“ Connection拒绝”错误.
我已经在应用程序中进行了所有的微调,它现在更多的是静态网页,即使这样它也会返回错误.
服务器配置:Ubuntu,8 vCPU / 32 GB RAM / 960 GB HD
PS:相同的应用程序在AWS(Amazon Web Services)中运行良好,因此您可以排除运行JMeter(client)的我的机器出现任何问题
org.apache.http.conn.HttpHostConnectException: Connection to http://a.b.c.d:8080 refused
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:190)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:645)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:480)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:286)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:62)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1088)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1077)
at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:428)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256)
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(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:127)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)
... 12 more
解决方法:
尝试调整server.xml中http连接器的maxThreads和acceptCount属性:
Each incoming request requires a thread for the duration of that
request. If more simultaneous requests are received than can be
handled by the currently available request processing threads,
additional threads will be created up to the configured maximum (the
value of the maxThreads attribute). If still more simultaneous
requests are received, they are stacked up inside the server socket
created by the Connector, up to the configured maximum (the value of
the acceptCount attribute). Any further simultaneous requests will
receive “connection refused” errors, until resources are available to
process them.
参考:http://tomcat.apache.org/tomcat-7.0-doc/config/http.html
标签:amazon-web-services,jmeter,apache,tomcat,java 来源: https://codeday.me/bug/20191122/2062667.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。