commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julius Davies" <juliusdav...@gmail.com>
Subject Re: HttpClient: Socket(hostName,) or Socket(InetAddress,)
Date Sat, 10 Mar 2007 01:59:57 GMT
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
>
>


-- 
yours,

Julius Davies
416-652-0183
http://juliusdavies.ca/

---------------------------------------------------------------------
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