tags:

views:

46

answers:

2

I'm writing an app that's sole purpose is to determine if one of our core applications is up and running in production. This application is a WCF application. The app is up and running on two different boxes behind a load balancer. The site on each box is configured to listen to traffic for the following DNS name: app.company.com. DNS resolves app.company.com to our load balancer which then hands the request off to one of the two boxes in a round robin fashion. In terms of determining if our core application is up it is not acceptable to just hit the load balancer with a request as the load balancer might round robin us to an active server even if one of the servers is down and our app needs to be able to determine if one of the boxes is down. Yes the load balancer already checks to a limited extent that the server is up but it doesn't cover all scenarios.

The problem I'm having is I cannot send traffic directly to each box (by IP or host name) as the host header (app.company.com) has to be in the request or either the destination server or WCF will reject it. If I use app.company.com instead of the host name or IP address I'll hit the load balancer, if I modify the hosts file on the machine it will only work for one box.

Is there a way to force DNS resolution within .Net or Windows to resolve app.company.com to an IP address of my choosing in a way that can be fine tuned for each request and not affect DNS for the entire system? Elsewise I will probably be looking at hand crafting a request so that I can embedd the correct host header in a request not actually going to the target of the same DNS name.

Thanks

A: 

Its the load balancer that is assigning DNS on a per-hit basis (as you said, in round robin fashion), so you cant overload that from the client side. You may be able to configure your load balancer so that requests from a specific IP don't get load balanced, but that doesn't much help if you need to check both load balanced apps via DNS..

Therefore you need to rethink how to tackle this.

One strategy is to have the load balanced apps report out that they are operational, rather than a separate app checking in.

Alternatively have each app periodically update a timestamped file onto the server so that your app can reach the boxes separately by IP address and check for the presence of the timestamped file.

PaulG
well the load balancer is the target of the DNS lookup. I'm looking for a way to change the target in a localized way. I can do it no problem for one box, but without dynamically modifying the hosts file I can't do it for both boxes. The specific things I have to check require I go through the service the same way a client hit would. Just checking that other portions of the app appear to be up won't give me what I need. For instance, in WCF if I have one of the config files wrong although other aspects of the application may respond perfectly I could get an error when simulating a real request
omatase
A: 

Given that there doesn't appear to be any other viable solution out there I'm going to say the only answer to this problem is to dynamically change the hosts file so that the source machine can hit rotating targets with the same host header value.

omatase