My web site has a download of a file of about 10Mb. I can have it stored in more than one server and was thinking of a way to offer the download to the best performing server (performance measured from the client's side, testing from the own server could lead to unreliable results as the download could go though different paths)

Do you think this is realistic? I have no experience with Ajax but by what I've seen a path could be creating an XMLHttpRequest object and do some request to the server asynchronously, on receipt of a response I could update the actual download address (having a default one for the case there's no response when the user starts the download). Do you tink it's that a good idea? (and for the case I am inventing the wheel please let me know where is one ready :-)


1 Answer 1


You could use an existing content delivery network, such as Amazon Cloudfront, which automatically serves the file from the nearest server to the person requesting it. (The nearest server will very often be the fastest one.)

You could alternatively use a load balancing service, such as cloud load balancers from Rackspace, to determine which of your download servers were under less load to serve the file from there.

If you wanted to test which server was faster from the user's machine, you could fetch a small series of images of the same size from each server, and time how long it took until the images were loaded, then use the server with the lowest response time. The episodes.js JavaScript library may help with this.

  • Thank your for your reply I was not aware of the current CDN offer, looks like a resource to have into account.
    – Joan
    Aug 9, 2011 at 7:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.