Reputation: 1367
I'm writing an application which will be contacting a lot of web sites regularly (at their owners request). For this I'd like to be able to tune Java's DNS cache. I can't seem to find anywhere:
The default maximum cache size
How to change this
Any ideas?
Thanks.
Edit: I was concerned about the cache getting to large and running out of memory
Upvotes: 0
Views: 461
Reputation: 1367
I've gone through the implementation for the cache in InetAddress and I'm pretty sure there actually isn't a cache limit. I guess the designers never envisaged that a client could access so many hosts that this would cause us to run out of memory.
Upvotes: 0
Reputation: 12296
You will need to use a DNS server, installed on some server, with caching functionality.
http://tldp.org/HOWTO/DNS-HOWTO-3.html
https://superuser.com/questions/129484/what-is-a-good-local-windows-dns-caching-server-service
Upvotes: 1
Reputation: 46
Java just delegates to the OS. What OS are you using?
Update: that's actually not completely true. The Sun JVM maintains its own cache of resolved hostnames. By default, items in the cache live forever, but you can adjust the TTL downward. Of course, this cache does not persist across JVM invocations; in that case my first sentence stands.
Upvotes: 0