commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maomaode <maoma...@gmail.com>
Subject Re: HttpClient: Socket(hostName,) or Socket(InetAddress,)
Date Mon, 12 Mar 2007 04:02:04 GMT
Hi Julius,

Thanks for the patient and information, that helped a lot.
I just learned from other threads myself as well.

I'm using JDK5.

But here comes another question, is the any limit in the default DNS 
caching?
I mean, for example, if we use the httpclient on a web spider project, 
there must have millions of hostnames
will java default DNS cache all the ip-hostname mapping?

Anyway, seems it'd done in jre side, there's nothing to do with 
httpclient side.

Another question is that is there any socket connection limitation in 
httpclient?
I saw there is setDefaultMaxConnectionsPerHost default to 2
                     setMaxTotalConnections default to 20
Is that mean if i setDefaultMaxConnectionsPerHost  to 10, the 
setMaxTotalConnections will set to 100? or still 20?
And is there any MAX value for these two methods?

Last question is, where can i learn more about httpclient? any books 
about it, and any performance results about it? any equivalent  projects 
in java?

Thanks a million
James.

> Hi, James,
>
> Sun Java 5 and previous cache all DNS lookups forever, anyway.
> (Drives me crazy since it really screws up DNS-based load-balancing!).
> So once that DNS lookup is done the one time - that's it !  - never
> done again!
>
>> From reading "jre/lib/security/java.security", looks like Sun Java 6
> caches all DNS lookups for 30 seconds when a security manager isn't
> set.
>
> These caching settings can be modified by editing:
>
> jre/lib/security/java.security
>
>
> Here's a snippet from the Sun Java 5 version:
>
> #
> # The Java-level namelookup cache policy for successful lookups:
> #
> # any negative value: caching forever
> # any positive value: the number of seconds to cache an address for
> # zero: do not cache
> #
> # default value is forever (FOREVER). For security reasons, this
> # caching is made forever when a security manager is set.
> #
> # NOTE: setting this to anything other than the default value can have
> #       serious security implications. Do not set it unless
> #       you are sure you are not exposed to DNS spoofing attack.
> #
> #networkaddress.cache.ttl=-1
>
>
> yours,
>
> Julius
>
>
>
>
> On 3/8/07, maomaode <maomaode@gmail.com> wrote:
>> Hi,
>>
>> I think it can improve the performance, when we do host lookup it
>> require extra cost, if we can cache the hostname-ip map, then if there
>> is same hostname, we can use ip directly, no dns resolve will be 
>> required.
>> I guess it improve the performance.
>>
>>
>> > Why?
>> >
>> >
>> > "Jakarta Commons Users List" <commons-user@jakarta.apache.org> wrote:
>> >
>> >
>> >> Hi,
>> >>
>> >> I just noticed that in
>> >> org/apache/commons/httpclient/protocol/DefaultProtocolSocketFactory
>> >>
>> >> we use the Socket(host, port), why not use Socket(InetAddress, port)
>> >>
>> >> I guess the the Socket(host, port) will eventually call
>> >> Socket(InetAddress, port), right?
>> >> I think if we use Socket(InetAddress, port), can improve the 
>> productivity.
>> >>
>> >> thoughts?
>> >>
>> >> James.
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> >> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>> >>
>> >>
>> >>
>> >
>> >
>> >
>> > -----------------------------------------------------------------
>> > Find the home of your dreams with eircom net property
>> > Sign up for email alerts now http://www.eircom.net/propertyalerts
>> >
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
>> >
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message