I've installed CDN (and removed parallel) and enabled the statistics to see what is going on.
It works as advertised, but I wonder if it would be possible to add a kind of round-robbin scheme if I add several subdomain urls? Ie. something like this:
css.example.com|.css
js.example.com|.js
cdn1.example.com
cdn2.example.com
cdn3.example.com
The assigned files will go from the assigned domains, and all others would use the other three domains to spread out the files. If I have 6 images the statistics would show:
Number of files served from the server http://cdn1.example.com: 2
Number of files served from the server http://cdn2.example.com: 2
Number of files served from the server http://cdn3.example.com: 2
Best case would be to have a round robbin scheme working if filetypes are assigned to two or more subdomains, and perhaps have a final catch all domain.
So this example:
css.example.com|.css
js.example.com|.js
cdn1.example.com|.jpg
cdn2.example.com|.jpg
cdn3.example.com
would give me something like this if I have 4 jpgs, 1 ico and 1 png file served:
Number of files served from the server http://cdn1.example.com: 2
Number of files served from the server http://cdn2.example.com: 2
Number of files served from the server http://cdn3.example.com: 2
Would that be even more awesome?
Comments
Comment #1
wim leersYes, this is possible, even with the version you have right now!
See the "When using multiple servers: picking a specific one based on some criteria" section in README.txt:
Note: cdn3.example.com will serve *all* files because you didn't specify any file types, including the .css, .js and .jpg files that the other domains will serve. You'd have to specify all other extensions that you want to serve from cdn3.example.com if you don't want it to server .css, .js and .jpg files.
Comment #2
pkej commentedMy bad, I read the README until I got it working (while testing with Yslow), thanks for the heads up.
Comment #3
wim leersSo you've got it working now? :)
Comment #4
pkej commentedI'm sorry Wim, but it doesn't seem to work as expected, I pasted in the code as per your instructions, but the files come from the same alias (cdn4 in my case), none from cdn5 and cdn6.
I'm a bit unsure about what your modulo do, and if that is supposed to select different servers or not, for now it seems that it doesn't, but it might be some caching, either in the browser, my firewall, or the webserver :)
I'll try again tomorrow and check if I get different servers then.
Thanks for the time to follow up on this.
Comment #5
pkej commentedSeems to work now, thank you for the help.
Comment #6
wim leersWhat went wrong in #4?
Comment #7
pkej commentedIt was boost anonymous caching which I didn't flush deeply enough. IUI (Insufficient user intelligence)
Comment #8
wim leersHaha :D
Nice one :)