hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: How to know which port is newly created for the connection ?
Date Mon, 17 Feb 2014 09:12:54 GMT
On Fri, 2014-02-14 at 21:15 +0000, Kiran Chitturi wrote:
> Hi,
> 
> 
> I am using http client 4.3.2 and I have a few questions.
> 
> 1)  I am making lot of concurrent requests to a server. When creating requests, I want
to debug and check which ports are newly created by the client. Currently, I can see the ports
in netstat as pasted below.
> 
> tcp4       0      0  172.16.11.138.7575     172.16.11.138.52014    ESTABLISHED
> 
> I enabled the debug logging for MainClientExec class and it gives me the below information.
Here it does not exactly tell me what is the source port that is being used for the connection.
How can I use this ? Also, whenever MainClientExec prints the below line, does it mean a new
connection is created with a new port or an existing port is being used ?
> 
> 2014-02-14 13:01:01 DEBUG MainClientExec:217 - Opening connection {}->http://172.16.11.138:8983
> 

Kiran

Please raise a JIRA for this change request. I'll try to include it into
the upcoming 4.3.3 release.


> 2) My code looks like this for creating a http Client. I pass the client to SolrJ<https://cwiki.apache.org/confluence/display/solr/Using+SolrJ>
which uses this client to make requests. SolrJ makes requests to a Solr server.
> 
> 
>     HttpClientBuilder httpBuilder = HttpClientBuilder.create();
> 
> 
> 
>     Builder socketConfig =  SocketConfig.custom();
> 
>     socketConfig.setSoReuseAddress(true);
> 
> 
> 
>     httpBuilder.setDefaultSocketConfig(socketConfig.build());
> 
> 
> 
>     httpBuilder.setMaxConnTotal(100);
> 
>     httpBuilder.setMaxConnPerRoute(100);
> 
> 
> 
>     httpBuilder.disableRedirectHandling();
> 
>     httpBuilder.useSystemProperties();
> 
> 
> 
>     final CloseableHttpClient httpClient = httpBuilder.build();
> 
> 
> This httpClient created above also throws some exceptions. Can I assume retry is successful
and does this happen because I enabled socketReuseAddress ?
> 

HttpClient should propagate I/O exceptions to the caller which it is
unable to re-try. If your code is not catching any exceptions it should
be safe to assume requests have been successfully re-tried.

Oleg

> 
> 2014-02-14 12:53:21,415 - INFO  [CloudSolrServer ThreadPool-1-thread-59:RetryExec@93]
- I/O exception (java.net.SocketException) caught when processing request: Address already
in use
> 
> 2014-02-14 12:53:21,443 - INFO  [CloudSolrServer ThreadPool-1-thread-59:RetryExec@106]
- Retrying request
> 
> 2014-02-14 12:53:47,299 - INFO  [CloudSolrServer ThreadPool-1-thread-203:RetryExec@93]
- I/O exception (java.net.SocketException) caught when processing request: Address already
in use
> 
> 2014-02-14 12:53:47,327 - INFO  [CloudSolrServer ThreadPool-1-thread-203:RetryExec@106]
- Retrying request
> 
> 2014-02-14 12:54:24,740 - INFO  [CloudSolrServer ThreadPool-1-thread-263:RetryExec@93]
- I/O exception (java.net.SocketException) caught when processing request: Address already
in use
> 
> 2014-02-14 12:54:24,763 - INFO  [CloudSolrServer ThreadPool-1-thread-263:RetryExec@106]
- Retrying request
> 
> 2014-02-14 12:54:39,121 - INFO  [CloudSolrServer ThreadPool-1-thread-142:RetryExec@93]
- I/O exception (java.net.SocketException) caught when processing request: Address already
in use
> 
> 2014-02-14 12:54:39,157 - INFO  [CloudSolrServer ThreadPool-1-thread-142:RetryExec@106]
- Retrying request
> 
> 
> Please let me know your suggestions.
> 
> 
> Many Thanks for your help,
> 
> --
> Kiran Chitturi,
> Software Engineer,
> LucidWorks.
> Cell Phone: 540-577-4852
> Office Phone: 650-249-4452
> Email: kiran.chitturi@lucidworks.com
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message