Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 997671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:04:16+00:00 2026-05-16T07:04:16+00:00

So, in order to speed up load times, we’re setting up a bunch of

  • 0

So, in order to speed up load times, we’re setting up a bunch of CDN hostnames to serve images and assets from. What’s the best way to consistently use the same host for the same asset? E.g. button.gif always gets served from http://assets-15.ourserver.com.

I was thinking of coming up with some rule, where the md5 hash of the filename somehow maps to a server (can’t use the filename itself, since a lot are similar: “button-home.gif”, “button-about.gif”, etc.). I’m not sure if this is the most efficient way, but it seems like it would work.

Anyone have any experience with this sort of thing? I need a language-agnostic solution, because this will be used by several different languages.

EDIT: Yahoo’s explanation on how this speeds things up: http://developer.yahoo.com/performance/rules.html#split

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T07:04:17+00:00Added an answer on May 16, 2026 at 7:04 am

    When I did something like this, all the relevant resources had id numbers anyway, so I just used that as the basis. Still, it’s not too hard to extend to non-numbers.

    There’s a balance in how many hostnames you use, with too many the host-lookup overhead outplays the advantage of multiple hostnames, so at the outside you’ll likely have about 12, probably less.

    This in itself means that a simple hash will likely split across the given range easily enough without any need to be particularly clever.

    There’s a lack of encoding issues confusion, because either your application deals with IURIs fully (in which case utf-8 handling is already an issue you’ve dealt with) or it doesn’t, in which case every character in the URI-escaped form of the path (that is to say, the name used in the actual URI) is going to be in the ASCII range.

    There’s no need to by cryptographically secure or anything like that, as it isn’t a security risk to guess the server used. It won’t be the end of the world if one or two pages lean slightly to one server over another (randomness would have that happen with a perfect has anyway).

    Hence just running through the characters in the absolute path of the URI for the image (everything after the host from the first / onwards) adding them their integer value to each other and then do use the modulo of that part of the hostname.

    If you want to limit the number of characters processed for speed issues, then do it from the end backwards, as that will have the greatest variation.

    That “button-home.gif” is similar to “button-about.gif” isn’t an issue, as they aren’t really very similar at all as seen through the eyes of a process like this.

    If you ever increase the number of hostnames used, try to do it as a multiple of the previous number, as this results in the largest possible number of resources keeping their old URIs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In order to help speed up my page load times I am removing SessionState
I wanted to load images into my site in a certain order, but found
Order deny,allow deny from all allow from xx.xx.x.xx RewriteRule . - [F] I have
in order to recover data from server I use XMLHttpRequest and my code is
I have created Layer for each of my background images in the following order:
I am seeking for a way to speed up a file loading like this
I have a direct load insert of 54,061,487 records. I'm looking for speed. I
I am wondering if linux keeps something in memory (in order to speed up
I'm writing a semi-generic form plugin using jQuery in order to speed up the
There is one javascript file http://v2.jiathis.com/code_mini/jia.js , in order for good speed , I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.