<div>Trustin,</div>
<div> </div>
<div>Yes, my problem can be reproduced consistently. Attached are 4 java files. Among them, HttpClientPipelineFactory.java and HttpResponseHandler.java are almost unchanged from their example sibling of snoop, except that I enabled HttpChunkAggregator in HttpClientPipelineFactory and offered answer in HttpResponseHandler to be retrieved.</div>

<div> </div>
<div>I converted the original HttpClient to ConcurrentHttpClient to concurrently send http requests to any server. I tried to achieve maximum concurrency by adding ChannelFutureListener when connecting (see line 70). It&#39;s supposed to work better for me. But if I used the commented-out code below instead. I can run more connections.</div>

<div> </div>
<div>Finally, Requestor is the test driver (into ConcurrentHttpClient) with multi-threading to observe how Netty scales under heavy loads.</div>
<div>To run the program:<br>&gt;java -cp %CLASSPATH% myperfeval.http.Requestor 80 10 <a href="http://www.yahoo.com/">http://www.yahoo.com</a></div>
<div> </div>
<div>where 80 is for n threads spawn from Requestor and 10 is the number of Http servers that ConcurrentHttpClient is to hit for each thread. So in this case, it could reach 800 connections at a time. For the test, you can either use a public server like yahoo, or a local test server available to you, as the thrid argument. I found that with yahoo, I tend to run into timeout trouble. And with a local test server, I&#39;ll get the connection exception as in the original email. You can play with the first two arguments to narrow it down when it starts to trouble your system. Requestor can run a little more connections in Windows than VMware with Centso 5.3.</div>

<div> </div>
<div>I suspect that somehow ConcurrentHttpClient might not do things right.</div>
<div> </div>
<div>Thanks a lot for your time!</div>
<div>Jason</div>
<div> </div>
<div> </div>
<div class="gmail_quote">On Thu, Sep 17, 2009 at 7:36 PM, Trustin Lee (이희승) <span dir="ltr">&lt;<a href="mailto:trustin@gmail.com">trustin@gmail.com</a>&gt;</span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Sorry about the misleading post.  I was merely answering Mike&#39;s questions.<br><br>I have not experienced such a problem so far in Linux.  I am using<br>
Fedora at the moment but I also use RHEL for performance tests.<br><br>Does the connection attempt succeed when you retry or fail forever once refused?<br><br>If all subsequent connection attempts are refused, it means the server<br>
has been terminated for some reason.  Otherwise, it&#39;s a temporary<br>problem related with your operating system.<br><br>I&#39;d like to investigate this problem further if there&#39;s a way to<br>reproduce the problem reliably.  Could you post a simple client-server<br>
test application so that I can run it by myself? A simple modification<br>of the official examples would be perfect.<br><br>Thanks<br>
<div class="im"><br>— Trustin Lee, <a href="http://gleamynode.net/" target="_blank">http://gleamynode.net/</a><br><br></div>
<div>
<div></div>
<div class="h5">On Fri, Sep 18, 2009 at 10:21 AM, J. Mi &lt;<a href="mailto:jmi258@gmail.com">jmi258@gmail.com</a>&gt; wrote:<br>&gt; Trustin,<br>&gt;<br>&gt; I already tried that. I tried to increase &#39;nofile&#39; to 90000 both in<br>
&gt; /etc/security/limits.conf (and restart my Centos in VMware) and on the fly<br>&gt; for a perticular termal session by &#39;ulimit -n 90000&#39; command. None of them<br>&gt; work for me.<br>&gt;<br>&gt; The exception I got was &quot;java.net.ConnectException: Connection refused: no<br>
&gt; further information..&quot;, not &quot;Too many open files...&quot; althouth I seem to hear<br>&gt; that file descriptors, connections and thread might share this same limit.<br>&gt;<br>&gt; This problem blocked me for days. And it doesn&#39;t seem to be the limit on<br>
&gt; http server side because I tried to use the same Netty http client to hit<br>&gt; differnt server and had the same problem.<br>&gt;<br>&gt; Thanks for your help. Appreciated it.<br>&gt;<br>&gt; Jason<br>&gt;<br>&gt; On Thu, Sep 17, 2009 at 5:06 PM, Trustin Lee (이희승) &lt;<a href="mailto:trustin@gmail.com">trustin@gmail.com</a>&gt;<br>
&gt; wrote:<br>&gt;&gt;<br>&gt;&gt; I hope this post answers the first question.<br>&gt;&gt;<br>&gt;&gt; <a href="http://gleamynode.net/articles/1557/" target="_blank">http://gleamynode.net/articles/1557/</a><br>&gt;&gt;<br>
&gt;&gt; I&#39;m not sure about the other questions though. :)<br>&gt;&gt;<br>&gt;&gt; — Trustin Lee, <a href="http://gleamynode.net/" target="_blank">http://gleamynode.net/</a><br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; On Fri, Sep 18, 2009 at 2:37 AM, Michael McGrady<br>
&gt;&gt; &lt;<a href="mailto:mmcgrady@topiatechnology.com">mmcgrady@topiatechnology.com</a>&gt; wrote:<br>&gt;&gt; &gt; What is the impact of changing these settings?  Why is the default low<br>&gt;&gt; &gt; instead of hight?  And, any other questions I should be asking before<br>
&gt;&gt; &gt; changing this configuration?<br>&gt;&gt; &gt; MIke<br>&gt;&gt; &gt; On Sep 17, 2009, at 10:34 AM, J. Mi wrote:<br>&gt;&gt; &gt;<br>&gt;&gt; &gt; H Thomas,<br>&gt;&gt; &gt;<br>&gt;&gt; &gt; Thanks for the lead. To be able to have more connections before seeing<br>
&gt;&gt; &gt; &quot;java.net.ConnectException: Connection refused...&quot;, which configuration<br>&gt;&gt; &gt; I<br>&gt;&gt; &gt; need to change in /etc/security/limits.conf? I added<br>&gt;&gt; &gt; * soft nofile 20000<br>
&gt;&gt; &gt; * hard nofile 20000<br>&gt;&gt; &gt;<br>&gt;&gt; &gt; and first time just tried to re-login, the new limit didn&#39;t work for me<br>&gt;&gt; &gt; for<br>&gt;&gt; &gt; more connections. I then tried to restart my VMware. It still didn&#39;t<br>
&gt;&gt; &gt; work<br>&gt;&gt; &gt; for me<br>&gt;&gt; &gt;<br>&gt;&gt; &gt; Does &#39;nofile&#39; (max number of open files) have anything to do with socket<br>&gt;&gt; &gt; connections?<br>&gt;&gt; &gt;<br>&gt;&gt; &gt; Appreciate if you or anyone else can guide me more on this.<br>
&gt;&gt; &gt; btw, if any of you know any equivalent OS settings on Windows, i&#39;ll try<br>&gt;&gt; &gt; that<br>&gt;&gt; &gt; as well.<br>&gt;&gt; &gt;<br>&gt;&gt; &gt; Jason<br>&gt;&gt; &gt;<br>&gt;&gt; &gt;<br>&gt;&gt; &gt; On Wed, Sep 16, 2009 at 3:38 PM, Thomas Bocek &lt;<a href="mailto:bocek@ifi.uzh.ch">bocek@ifi.uzh.ch</a>&gt; wrote:<br>
&gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;&gt; Hi J.,<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;&gt; This might be a limitation of the OS. If you are using for example<br>&gt;&gt; &gt;&gt; Linux, then you can only open about 1000 connections before seeing &quot;too<br>
&gt;&gt; &gt;&gt; many open files in system&quot; error messages. You can adjust the value in<br>&gt;&gt; &gt;&gt; /etc/security/limits.conf<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;&gt; Thomas<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;&gt; J. Mi wrote:<br>
&gt;&gt; &gt;&gt; &gt; All,<br>&gt;&gt; &gt;&gt; &gt;<br>&gt;&gt; &gt;&gt; &gt; I get following exception pretty consistently when trying to<br>&gt;&gt; &gt;&gt; &gt; concurrently<br>&gt;&gt; &gt;&gt; &gt; connect about 800 connections.<br>
&gt;&gt; &gt;&gt; &gt;<br>&gt;&gt; &gt;&gt; &gt; Any idea? Is this something out of Netty&#39;s control? If so, is there<br>&gt;&gt; &gt;&gt; &gt; some<br>&gt;&gt; &gt;&gt; &gt; configuration I could do to JVM or operating system to increase<br>
&gt;&gt; &gt;&gt; &gt; resource<br>&gt;&gt; &gt;&gt; &gt; capacity?<br>&gt;&gt; &gt;&gt; &gt;<br>&gt;&gt; &gt;&gt; &gt; Thanks,<br>&gt;&gt; &gt;&gt; &gt; Jason<br>&gt;&gt; &gt;&gt; &gt;<br>&gt;&gt; &gt;&gt; &gt; java.net.ConnectException: Connection refused: no further information<br>
&gt;&gt; &gt;&gt; &gt;         at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)<br>&gt;&gt; &gt;&gt; &gt;         at sun.nio.ch.SocketChannelImpl.finishConnect(Unknown Source)<br>&gt;&gt; &gt;&gt; &gt;         at<br>
&gt;&gt; &gt;&gt; &gt;<br>&gt;&gt; &gt;&gt; &gt;<br>&gt;&gt; &gt;&gt; &gt; org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.connect(NioClientSocketPipelineSink.java:381)<br>&gt;&gt; &gt;&gt; &gt;         at<br>
&gt;&gt; &gt;&gt; &gt;<br>&gt;&gt; &gt;&gt; &gt;<br>&gt;&gt; &gt;&gt; &gt; org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.processSelectedKeys(NioClientSocketPipelineSink.java:351)<br>&gt;&gt; &gt;&gt; &gt;         at<br>
&gt;&gt; &gt;&gt; &gt;<br>&gt;&gt; &gt;&gt; &gt;<br>&gt;&gt; &gt;&gt; &gt; org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.run(NioClientSocketPipelineSink.java:273)<br>&gt;&gt; &gt;&gt; &gt;         at<br>
&gt;&gt; &gt;&gt; &gt;<br>&gt;&gt; &gt;&gt; &gt;<br>&gt;&gt; &gt;&gt; &gt; org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:113)<br>&gt;&gt; &gt;&gt; &gt;         at<br>&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>&gt;&gt; &gt;&gt; &gt; org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:53)<br>&gt;&gt; &gt;&gt; &gt;         at<br>&gt;&gt; &gt;&gt; &gt; java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown<br>
&gt;&gt; &gt;&gt; &gt; Source)<br>&gt;&gt; &gt;&gt; &gt;         at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown<br>&gt;&gt; &gt;&gt; &gt; Source)<br>&gt;&gt; &gt;&gt; &gt;         at java.lang.Thread.run(Unknown Source)<br>
&gt;&gt; &gt;&gt; &gt;<br>&gt;&gt; &gt;&gt; &gt;<br>&gt;&gt; &gt;&gt; &gt;<br>&gt;&gt; &gt;&gt; &gt;<br>&gt;&gt; &gt;&gt; &gt; ------------------------------------------------------------------------<br>&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; _______________________________________________<br>&gt;&gt; &gt;&gt; &gt; netty-dev mailing list<br>&gt;&gt; &gt;&gt; &gt; <a href="mailto:netty-dev@lists.jboss.org">netty-dev@lists.jboss.org</a><br>
&gt;&gt; &gt;&gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/netty-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/netty-dev</a><br>&gt;&gt; &gt;&gt; _______________________________________________<br>
&gt;&gt; &gt;&gt; netty-dev mailing list<br>&gt;&gt; &gt;&gt; <a href="mailto:netty-dev@lists.jboss.org">netty-dev@lists.jboss.org</a><br>&gt;&gt; &gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/netty-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/netty-dev</a><br>
&gt;&gt; &gt;<br>&gt;&gt; &gt; _______________________________________________<br>&gt;&gt; &gt; netty-dev mailing list<br>&gt;&gt; &gt; <a href="mailto:netty-dev@lists.jboss.org">netty-dev@lists.jboss.org</a><br>&gt;&gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/netty-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/netty-dev</a><br>
&gt;&gt; &gt;<br>&gt;&gt; &gt; Mike McGrady<br>&gt;&gt; &gt; Principal Investigator AF081-028 AFRL SBIR<br>&gt;&gt; &gt; Senior Engineer<br>&gt;&gt; &gt; Topia Technology, Inc<br>&gt;&gt; &gt; 1.253.720.3365<br>&gt;&gt; &gt; <a href="mailto:mmcgrady@topiatechnology.com">mmcgrady@topiatechnology.com</a><br>
&gt;&gt; &gt;<br>&gt;&gt; &gt;<br>&gt;&gt; &gt;<br>&gt;&gt; &gt;<br>&gt;&gt; &gt;<br>&gt;&gt; &gt;<br>&gt;&gt; &gt;<br>&gt;&gt; &gt; _______________________________________________<br>&gt;&gt; &gt; netty-dev mailing list<br>
&gt;&gt; &gt; <a href="mailto:netty-dev@lists.jboss.org">netty-dev@lists.jboss.org</a><br>&gt;&gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/netty-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/netty-dev</a><br>
&gt;&gt; &gt;<br>&gt;&gt; &gt;<br>&gt;&gt;<br>&gt;&gt; _______________________________________________<br>&gt;&gt; netty-dev mailing list<br>&gt;&gt; <a href="mailto:netty-dev@lists.jboss.org">netty-dev@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/netty-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/netty-dev</a><br>&gt;<br>&gt;<br>&gt; _______________________________________________<br>&gt; netty-dev mailing list<br>
&gt; <a href="mailto:netty-dev@lists.jboss.org">netty-dev@lists.jboss.org</a><br>&gt; <a href="https://lists.jboss.org/mailman/listinfo/netty-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/netty-dev</a><br>
&gt;<br>&gt;<br><br>_______________________________________________<br>netty-dev mailing list<br><a href="mailto:netty-dev@lists.jboss.org">netty-dev@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/netty-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/netty-dev</a><br>
</div></div></blockquote></div><br>