GetHostByAddress runs slow

Discussion in 'ASP .Net' started by =?Utf-8?B?SmVk?=, Dec 15, 2004.

  1. 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.
     
    =?Utf-8?B?SmVk?=, Dec 15, 2004
    #1
    1. Advertisements

  2. =?Utf-8?B?SmVk?=

    bruce barker Guest

    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" <> wrote in message
    news:...
    | 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.
    |
     
    bruce barker, Dec 15, 2004
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sven
    Replies:
    5
    Views:
    3,452
    Rutger Smit
    Sep 3, 2004
  2. Replies:
    3
    Views:
    3,320
  3. Mikey
    Replies:
    7
    Views:
    968
    Mikey
    Dec 12, 2003
  4. Beemer Biker
    Replies:
    2
    Views:
    556
    Beemer Biker
    Nov 8, 2006
  5. Joe Stateson
    Replies:
    2
    Views:
    602
    Joe Stateson
    Sep 10, 2007
  6. web studio 2008 runs slow

    , Jan 29, 2008, in forum: ASP .Net
    Replies:
    5
    Views:
    775
  7. Nicopilami
    Replies:
    1
    Views:
    2,910
    bruce barker
    Apr 2, 2008
  8. DanG

    Fixed / frozen Datagrid column runs slow.

    DanG, Sep 14, 2006, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    302
Loading...