Groups | Blog | Home
all groups > dotnet performance > december 2004 >

dotnet performance : GetHostByAddress Runs Slow


Jed
12/15/2004 7:29:05 AM
I have a class for logging information about user activity on a web site, but
it suddenly really slow. I was wondering what factors may have caused the
slow down.

Initially, I used the following code:
ul.HostName = context.Request.UserHostName;

Since the UserHostName is not always resolved, I opted for the following
more effective code:
IPAddress hostIPAddress = IPAddress.Parse(context.Request.UserHostAddress);
IPHostEntry hostInfo = Dns.GetHostByAddress(hostIPAddress);
ul.HostName = hostInfo.HostName;
hostInfo = null;
hostIPAddress = null;

This worked fine for months, but now it is seriously dragging down
performance. Is there something my web host could do to fix this problem?

Joerg Jooss
12/18/2004 6:55:00 PM
[quoted text, click to view]

Probably yes, but reverse DNS lookups *are* expensive.

Cheers,

--
Joerg Jooss
www.joergjooss.de
news@joergjooss.de

AddThis Social Bookmark Button