You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nutch.apache.org by Fuad Efendi <fu...@efendi.ca> on 2005/10/04 07:24:42 UTC

DNS

Another cause of another problem:

By default, Java 1.4 caches DNS-to-IP mappings forever...

java.security.Security.setProperty("networkaddress.cache.ttl" ,
"10000");


RE: DNS

Posted by Fuad Efendi <fu...@efendi.ca>.
>>NutchConf.get().getFloat("dns.cache.ttl.minutes", 100);

I said "smth better", .getInt(...)


RE: DNS

Posted by og...@yahoo.com.
Fuad,

Please stick this in JIRA - it will get lost in a pile of incoming
Nutch email.

Otis

--- Fuad Efendi <fu...@efendi.ca> wrote:

> Thanks Paul,
> 
> 
> It would be nice to have this piece of code in
> org.apache.nutch.fetcher.Fetcher
> 
> 
> private static final int DNS_CACHE_TTL_MINUTES =
>     NutchConf.get().getFloat("dns.cache.ttl.minutes", 100);
> 
> 
> static {
>   java.security.Security.setProperty("networkaddress.cache.ttl" , 
>     DNS_CACHE_TTL_MINUTES*60);
> }
> 
> (may be smth better...)
> 
> 
> 
> >> java.security.Security.setProperty("networkaddress.cache.ttl" , 
> >> "10000");
> 
> >I had to look up what the units are for this since your message was
> possibly ambiguous.
> 
> >The units are in seconds; 10000 is about 150 minutes, the default is
> -1.
> 
> >When working with Weblogic a few years ago, I noticed that they
> included
> the units in the property names.  For example:
> 
> >     something.timeoutMsec  or  something.timeoutSec
> 
> >similarly,
> 
> >     final static int SOMETHING_TIMEOUT_MSEC = 2000;
> 
> >I encourage this practice.
> 
> 


RE: DNS

Posted by Fuad Efendi <fu...@efendi.ca>.
Thanks Paul,


It would be nice to have this piece of code in
org.apache.nutch.fetcher.Fetcher


private static final int DNS_CACHE_TTL_MINUTES =
    NutchConf.get().getFloat("dns.cache.ttl.minutes", 100);


static {
  java.security.Security.setProperty("networkaddress.cache.ttl" , 
    DNS_CACHE_TTL_MINUTES*60);
}

(may be smth better...)



>> java.security.Security.setProperty("networkaddress.cache.ttl" , 
>> "10000");

>I had to look up what the units are for this since your message was
possibly ambiguous.

>The units are in seconds; 10000 is about 150 minutes, the default is -1.

>When working with Weblogic a few years ago, I noticed that they included
the units in the property names.  For example:

>     something.timeoutMsec  or  something.timeoutSec

>similarly,

>     final static int SOMETHING_TIMEOUT_MSEC = 2000;

>I encourage this practice.


Re: DNS

Posted by Paul Baclace <pe...@baclace.net>.
Fuad Efendi wrote:
> Another cause of another problem:
> 
> By default, Java 1.4 caches DNS-to-IP mappings forever...
> 
> java.security.Security.setProperty("networkaddress.cache.ttl" ,
> "10000");

I had to look up what the units are for this since your message
was possibly ambiguous.

The units are in seconds; 10000 is about 150 minutes, the default is -1.

When working with Weblogic a few years ago, I noticed that they included
the units in the property names.  For example:

     something.timeoutMsec  or  something.timeoutSec

similarly,

     final static int SOMETHING_TIMEOUT_MSEC = 2000;

I encourage this practice.


Paul