Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > GetHostByAddress runs slow

Reply
Thread Tools

GetHostByAddress runs slow

 
 
=?Utf-8?B?SmVk?=
Guest
Posts: n/a
 
      12-15-2004
I have a class for logging information about user activity on a web site, but
it suddenly became 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?

Thanks.

 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      12-15-2004
GetHostByAddress can be really slow if the address is not managed by the
local DNS server. if it is not a local address the dns server ask the same
question of any other DNS authority it knows about, which in turn does the
same, until the ipaddress is found, or the timeout occurs.


-- bruce (sqlwork.com)



"Jed" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
| I have a class for logging information about user activity on a web site,
but
| it suddenly became 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?
|
| Thanks.
|


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: slow slow slow! Expert lino fitter Computer Support 5 12-12-2008 04:00 PM
Re: slow slow slow! Beauregard T. Shagnasty Computer Support 2 12-10-2008 09:03 PM
Re: slow slow slow! Expert lino fitter Computer Support 0 12-10-2008 02:33 PM
Dns.Resolve / GetHostByAddress deprecated in c# 2? Nicopilami ASP .Net 1 04-02-2008 04:00 PM
System.Net.Dns.GetHostByAddress returns incorrec t Hostame Sven ASP .Net 5 09-03-2004 06:12 PM



Advertisments