Results 1 to 9 of 9

Thread: Distance from a server

  1. #1

    Thread Starter
    Fanatic Member x-ice's Avatar
    Join Date
    Mar 2004
    Location
    UK
    Posts
    671

    Distance from a server

    If i have a list of database server IP's how can I establish which one is the closest?

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Distance from a server

    Measuring tape.

    Seriously though... I'm not sure there is a way. Physical distance isn't always indicitive of speed... it all depends on traffic and routing.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: Distance from a server

    tracert
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  4. #4
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Distance from a server

    tracert would tell you how many routers there are between you and the server, it wouldnt be a very accurate way to determine which server is the closest at all, but in lack of other methods...

    Why do you want to connect to the closest one any way?
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  5. #5

    Thread Starter
    Fanatic Member x-ice's Avatar
    Join Date
    Mar 2004
    Location
    UK
    Posts
    671

    Re: Distance from a server

    For my final year project at uni I have to develop a program that can be used to access a database that can either be on a central server or on a number of servers.

    So basically the program must be able to use a centralised or distributed database.

    With the distributed database there will be some replication of data on the servers that the database is on.

    If a server goes down I will need to find the best server to connect to in order to maintain the database connection. I assumed the best server to connect to would be the closest.

  6. #6
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Distance from a server

    From what I understand, your definition of the "best" server is whichever you get the quickest connection with - which is not related to distance.

    In terms of the network speed, you could Ping each server to see how long it takes for a reply.

    That is only half of the issue, as the speed of response from the database system can have a big effect too (that speed will depend on the hardware and configuration etc, as well as the current amount of users/work). One way to test this would be to run a very simple query to return data you know exists (perhaps "SELECT Id FROM TestTable WHERE Id=1"), and see how long it takes.


    It is debatable if running both tests is worthwhile, and I would personally just test the database part (as the results depend on the network part too).

  7. #7
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: Distance from a server

    Quote Originally Posted by Atheist
    tracert would tell you how many routers there are between you and the server, it wouldnt be a very accurate way to determine which server is the closest at all, but in lack of other methods...
    Yeah I thought I'd mention it because it can usually get you the city but beyond that...
    Quote Originally Posted by x-ice
    For my final year project at uni I have to develop a program that can be used to access a database that can either be on a central server or on a number of servers.
    Cool project (my final application was supposed to be a simple game; I made Tic-Tac-Toe ).

    Your answer opens up many questions in my mind. Connecting to the centeral database is simple but how does your client know where all of the other databases are when it has to go into a distributed mode?

    When it's in a distributed mode, how are you syncing the data? Does each database do something specific or do you have / need a way of data syncing?

    I would think that if you just need to connect to one of the distributed databases you would calculate which database has the smallest load and go to that one rather than by latency or geopgrahic distance.
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  8. #8
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,712

    Re: Distance from a server

    Quote Originally Posted by kasracer
    Cool project (my final application was supposed to be a simple game; I made Tic-Tac-Toe ).
    LOL, my last programming class I ever took was programming on Apple IIe's and the final was making a graphical version Connect 4 in AppleBasic or whatever it was called.

    I had two player working fine, then I tried to write the logic routine for one-player and ran out of memory with my computation matrices (8k RAM and most was taken up by AppleBasic ).
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

  9. #9
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538

    Re: Distance from a server

    It's a long shot, but this may just be applicable to you.

    In an Active Directory (AD) network, servers can be listed within an "Active Directory sites and services" console.

    Theoretical connection "links" between servers can be either defined manually, or automatically by AD (in the later, a Windows service named KCC, or the Knowledge Consistency Checker is responsible for creating the links).

    Each of these links has an attributed cost value, again which can be defined manually or calculated. A "site link cost" is a numerical representation of the efficiency of connecting from 1 server to another. If you consider a triangle shape, with ServerA at the top and ServerB and ServerC at the other points, ServerA - ServerB may be nice and fast - connected physically by a T3 connection, and therefore have a lower site link cost of 100. If the link between ServerA - ServerC is connected via a 56K link, and it's on an unreliable NTL/Virgin connection, then this can be set to a cost of 500 to tell the Windows servers not to use this if it can be avoided.

    That's a simple explanation of that process, and here's some coding which'll let you look at an AD site link cost if it's of help:http://techtasks.com/code/viewbookcode/1771 and to alter this so it fits into .Net, you can look at the System.DirectoryServices namespace...

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width