MongoDB java.net.ConnectException:连接被拒绝

发布于 2024-10-03 00:53:45 字数 1476 浏览 1 评论 0原文

我在使用 MongoDB 时遇到问题

,我正在使用 Jmeter 测试 Web 应用程序。

当设置一个大负载时,在Web应用程序上,这是正确的。 当设置低负载但用户较多时,就会开始出现异常。

java.net.ConnectException:连接 拒绝:连接于 java.net.PlainSocketImpl.socketConnect(本机 方法)在 java.net.PlainSocketImpl.doConnect(未知 来源)于 java.net.PlainSocketImpl.connectToAddress(未知 来源)于 java.net.PlainSocketImpl.connect(未知 来源)于 java.net.SocksSocketImpl.connect(未知 来源)于 java.net.Socket.connect(未知 来源)于 sun.net.NetworkClient.doConnect(未知 来源)于 sun.net.www.http.HttpClient.openServer(未知 来源)于 sun.net.www.http.HttpClient.openServer(未知 来源)于 sun.net.www.http.HttpClient。(未知 来源)于 sun.net.www.http.HttpClient.New(未知 来源)于 sun.net.www.http.HttpClient.New(未知 来源)位于 sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(未知 来源)位于 sun.net.www.protocol.http.HttpURLConnection.plainConnect(未知 来源)于 sun.net.www.protocol.http.HttpURLConnection.connect(未知 来源)于 org.apache.jmeter.protocol.http.sampler.HTTPSampler.sample(HTTPSampler.java:483) 在 org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:965) 在 org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:951) 在 org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:348) 在 org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:243) 在java.lang.Thread.run(未知 来源)

请告诉我,为什么..? (我使用 MongoDB、Tomcat、Java)谢谢..

I have problem with used MongoDB

I am testing a web aplication use Jmeter test.

When set up a big load, on the web application, it is right.
When set up a low load but many users, it is beginning exception..

java.net.ConnectException: Connection
refused: connect at
java.net.PlainSocketImpl.socketConnect(Native
Method) at
java.net.PlainSocketImpl.doConnect(Unknown
Source) at
java.net.PlainSocketImpl.connectToAddress(Unknown
Source) at
java.net.PlainSocketImpl.connect(Unknown
Source) at
java.net.SocksSocketImpl.connect(Unknown
Source) at
java.net.Socket.connect(Unknown
Source) at
sun.net.NetworkClient.doConnect(Unknown
Source) at
sun.net.www.http.HttpClient.openServer(Unknown
Source) at
sun.net.www.http.HttpClient.openServer(Unknown
Source) at
sun.net.www.http.HttpClient.(Unknown
Source) at
sun.net.www.http.HttpClient.New(Unknown
Source) at
sun.net.www.http.HttpClient.New(Unknown
Source) at
sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown
Source) at
sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown
Source) at
sun.net.www.protocol.http.HttpURLConnection.connect(Unknown
Source) at
org.apache.jmeter.protocol.http.sampler.HTTPSampler.sample(HTTPSampler.java:483)
at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:965)
at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:951)
at
org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:348)
at
org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:243)
at java.lang.Thread.run(Unknown
Source)

Tell me please, why..? (I use MongoDB, Tomcat, Java)Thanks..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尘世孤行 2024-10-10 00:53:45

这是在使用 JMeter 之类的工具对任何 Web 应用程序进行负载测试时应该看到的错误类型,并告诉您正在达到该应用程序可以支持的事务上限......这就是您的位置d 对设置进行一些调整以获得更好的结果。

错误消息指出同时进行的 HTTP 连接太多,Tomcat 不堪重负。我不确定您使用的是哪个版本的 Tomcat,但它看起来像 Tomcat 6 的默认设置是排队最多 100 个请求,然后拒绝此后的任何请求,最大线程数为 200 个。尝试增加“acceptCount”或“maxThreads”,看看是否有帮助。

您也可以尝试重新标记问题,因为这是一个更广泛的问题,影响的不仅仅是 MongoDB 应用程序......并且您应该通过这种方式获得更多答复。 ;)

This is the type of error you should expect to see when load testing any web application with a tool like JMeter, and tells you that you're hitting the upper limit of transactions that the app can support... and this is where you'd do some tweaking of the settings to get better results.

The error message is saying that there are too many HTTP connections going at once and Tomcat is overwhelmed. I'm not sure which version of Tomcat you're on, but it looks like the default for Tomcat 6 is to queue up to 100 requests, then refuse any after that, and maxes out at 200 threads. Try increasing the "acceptCount" or "maxThreads" and see if that helps.

You may also try retagging the question, since this is a broader problem that affects more than just MongoDB apps... and you should get more replies that way. ;)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文