It would be great to add more URLS, so that Images are loaded from multiple URLs.

currently in a great onlineshop all images are loaded over one Url like images.domain.de.

the load time could be boosted, if there were more url's like img1.domain.de and img2.domain.de and img3.domain.de.

same for css and js files.

CommentFileSizeAuthor
#5 parallel-582816.patch3.29 KBmikeytown2
#4 multiimg.patch3.14 KBball.in.th

Comments

mikeytown2’s picture

In general, anything with more then 4 aliases starts to hurt performance; with parallel you are using 3. I could add in 1 more alias for images, but that would be it. Server selection: add all the ascii values of the filename together and if thats even, serve from one server, odd the other.

$count = 0;
foreach(str_split($filename) as $char) {
  $count += ord($char);
}
if ($count%2) {
  // assign to sub domain A
}
else {
  // assign to sub domain B
}

Might need to use a UTF-8 compatible version of the ord() function.
http://php.net/ord#78032

bennos’s picture

yeah you are rigtht, more than 4 aliases are not good for the performance, but it makes it more flexible to provide indivual solutions. So I can provide two / three URLS for images for an ubercart shop and leave the css and js on the normal URL.

mikeytown2’s picture

css helps; all css images then get downloaded from the separate domain

ball.in.th’s picture

Status: Active » Needs review
StatusFileSize
new3.14 KB

Hi,

Here's a patch to add multiple domains for images. New variables are used in case people use the old one for something else too, e.g. patching lightbox. And the regex has to be changed because we need to look at the filename too.

mikeytown2’s picture

StatusFileSize
new3.29 KB

fixed some white space issues and changed the global variables into static ones since they are only used inside the new function. Let me know.

ball.in.th’s picture

indeed, statics variables are better.

bryancasler’s picture

#5 works great! I noticed that fastest load times if I only put in three domains for the new IMG field, and I leave all the original CSS, JS and IMG fields blank.

Doing this cut an additional .5sec from my page load time.

Check it in action: http://www.ivawbeta.org/

Web Page Speed Test Results: http://www.webpagetest.org/result/100828_3QZG/1/details/

mikeytown2’s picture

Status: Needs review » Reviewed & tested by the community
dalin’s picture

I'm coming in late to the game here, but as an alternative approach you could switch based on path instead. For example on one of my sites about half of the img tags are imagecache files. By switching based on path you have the benefit of being able to build matching rules in .htaccess if you are hyper-SEO concerned (I'm not but enough of the people in this issue queue are).

I can think of three groups for images:
- imagecache
- in the files dir but not imagecache
- other

wim leers’s picture

Status: Reviewed & tested by the community » Closed (won't fix)

This has been supported by the CDN module for a long time now. As per #933942: Merge Parallel and CDN modules: migration path, the Parallel module will be merged into the CDN module, so if you migrate now, that won't be an issue anymore :)

Note that you can also write your own logic in the CDN module, to decide which domain should be used.