views:

69

answers:

2

I have a C# web service on IIS acting like a proxy. My problem is that when the IP address of one of the backend servers change, the windows DNS cache is correctly updated (checked with nslookup) but the service continues to do some requests on the old IP for about 40 minutes.

I noticed that the failover works if I stop hitting the proxy for 5 minutes but it is not an acceptable solution, the failover should be automatic.

Any idea?

Thanks in advance.

A: 

Have you tried setting the negative cache timeout to zero? I know you said the dns cache is correctly updated, but if you hit it even once when it was outdated, you may be stuck using the old IP until it expires.

On Windows XP, you set it in the registry as:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters DWORD: MaxNegativeCacheTtl Value: 0

Haven't played with this in Vista or Windows 7.

I'm curious to see the code that's failing to resolve the backend server address... wondering if something in the code itself is holding on to the old IP.

James B
the negative cache is how to long to store _negative_ (i.e. missing) answers. it has no effect on _changed_ answers.
Alnitak
You're correct, my mistake
James B
A: 

If you are using something built on the windows http components, you will find that the component hangs on to the resolved ip as a performance "optimization". Once it has a name/ip match, it will hang onto it for literally DAYS. It completely ignores TTL's.

The only reason why you are overcoming this with an idle delay is because the component is recycling in your particular usage.

It's a known problem. The MS program manager "sort of" admits to it. But, it has never been fixed.

We wrote our own replacement.

spenser
I'm suspecting something like this and was wishing someone could help me pointing it out. So I can't avoid the "dirty" patch...?
benfle