Blog images on sub-domain vs CDN

I’ve been thinking about moving images on my blogs over to a sub-domain (i.e.: images.myblog.com) or a CDN like CloudFlare in order to boost the speed of my sites. I found several posts on this topic in this forum from a few years ago and I’m not sure how current that info is so I thought I’d ask again.

I’m basically just looking for opinions on which would be better, putting images on a sub-domain or using a CDN.

I’m probably leaning towards the sub-domain idea so I’m also wondering if I should do anything special once I make the switch. I think I read somewhere about using an htaccess file on the sub-domain but I’m not sure why or what it should say.

Re: Blog images on sub-domain vs CDN

Personally I wouldn’t choose a subdomain for speed purposes. There are reasons to choose a subdomain, but speed isn’t one of them (IMHO). There is additional DNS overhead and all you’ll accomplish is moving the bulk of the page load to another subdomain – I can’t see it really making much of a difference.

CDNs are great if you’re trying to properly serve far flung parts of the world, but they don’t make much sense if your focus is predominantly the US. A CDN may actually slow things down for users in the US since there is overhead to a CDN.

Instead, look into JPEG Mini and reduce the size of your images. That will most definitely improve your page load times.

Re: Blog images on sub-domain vs CDN

Yes, CDN is a good way to do it. I don’t know as much about it as Rawtop but you would probably get better results from that than just moving them to a sub-domain. Clouldflare also includes some image optimization in their paid plans.

Re: Blog images on sub-domain vs CDN

Thanks for those tips. I need to figure out if the CloudFlare free plan offers enough bandwidth for the blog I’m thinking of putting this on. I really don’t want to pay for a CDN if I can avoid it.

While researching sub-domains more I found some suggestions about making it cookie-less and also including an htaccess file that prohibits hot-linking of the images. I’m wondering how important those suggestions are, or as you guys are saying, maybe I should just drop the idea of using a sub-domain.

Oh, and Rawtop thanks for the JPEGMini link. Do you think its any better than RIOT, something else I saw that was suggested?

Re: Blog images on sub-domain vs CDN

[QUOTE=naked;154952]Thanks for those tips. I need to figure out if the CloudFlare free plan offers enough bandwidth for the blog I’m thinking of putting this on. I really don’t want to pay for a CDN if I can avoid it.

While researching sub-domains more I found some suggestions about making it cookie-less and also including an htaccess file that prohibits hot-linking of the images. I’m wondering how important those suggestions are, or as you guys are saying, maybe I should just drop the idea of using a sub-domain.

Oh, and Rawtop thanks for the JPEGMini link. Do you think its any better than RIOT, something else I saw that was suggested?[/QUOTE]

There are no restrictions on bandwidth on their free plans but it doesn’t offer any image optimizations.

I wouldn’t worry about hot-linking, at least I don’t. You could see it as a free link into your site. Sub-domains can speed up loading, the only thing it does though is allowing another connection in the browser to be open, so it downloads more images at the same time. It won’t make a big difference though.

However… I’m guessing your site is using WordPress which means neither of the options will speed it up much. Clouldflare on Wordpress does very little to speed up the site, same with sub-domains.

Re: Blog images on sub-domain vs CDN

I tried Cloudflare for a while but was not at all happy with them.
Some of their networkcenters had issues. Especially the Amsterdam networkcenter. If one of their centers is down visitors from that region get an error or warning page.

Check their status here
https://www.cloudflarestatus.com/

Re: Blog images on sub-domain vs CDN

I’d still go back to “why do you think you need any of this?” What problem have you encountered that lead you to believe you have a problem? How big is that problem? If it’s small the cure may be worse than the disease.

Remember that CDNs are basically caching mechanisms. The first time a user requests a resource that’s not cached at their local data center, it actually takes longer to load since it has to go get the resource from the origin server. If you’re on a free CDN I assume they purge their caches pretty regularly. So if you’re in a case where people hit rather random images the net result may be slower responses, not faster ones.

Chances are you don’t need any of the above. Most people don’t.

Re: Blog images on sub-domain vs CDN

Sorry Rawtop I did not answer your question about why I think I need this. One reason is because I plan to re-do one of my blogs and I’m going to be adding a lot more posts with photos, so I’m concerned about my page load speed which is pretty good right now. Then as I was researching this I found some articles from a few years ago that said Google recommends using sub-domains for images. But I wasn’t sure if that was still the case, hence my question.

I think I’ll just keep the images in my Wordpress content folder and will try to optimize them with RIOT or JPEGMini.

Re: Blog images on sub-domain vs CDN

[QUOTE=naked;154969]Sorry Rawtop I did not answer your question about why I think I need this. One reason is because I plan to re-do one of my blogs and I’m going to be adding a lot more posts with photos, so I’m concerned about my page load speed which is pretty good right now. Then as I was researching this I found some articles from a few years ago that said Google recommends using sub-domains for images. But I wasn’t sure if that was still the case, hence my question.

I think I’ll just keep the images in my Wordpress content folder and will try to optimize them with RIOT or JPEGMini.[/QUOTE]

Yes, for blogs, I’d recommend not using a CDN. It’s overkill. Just optimize the images and you’ll be fine.

Personally I’m getting frustrated with WordPress. I’m starting to really hate how it rewrites what I tell it to do and strips out things like javacript for Google Analytics events. On my long list of things to do is migrating off it and writing my own blog script.

Re: Blog images on sub-domain vs CDN

Personally I’m getting frustrated with WordPress.

Have you looked into Ghost?

Re: Blog images on sub-domain vs CDN

BTW, the logic behind using sub-domains to speed up page loads is eliminated if you implement HTTP/2 (aka SPDY), but that requires that your site use SSL. Basically using sub-domains let page resources load via multiple connections instead of making resources wait in a single queue to be handled one at a time. HTTP/2 (SPDY) is specifically targeted at making a single connection to the server as fast as possible. It eliminates all the bottlenecks that the sub-domain trick was trying to work around.

The question then is whether HTTP/2 will compare to CDNs. It really depends on the nature of the problem. If the problem was latency when pulling numerous files, then HTTP/2 should as fast or faster than a CDN. If the problem was a slow pipe between the regions (say for serving one large video file), then a CDN will be faster (after the first load of the file in the problem region).

Here’s a testimonial from someone who found SPDY to be faster than a CDN for loading lots of little files…

Clearly, SPDY is providing a huge benefit for us here. While we lose the 70-90ms in SSL negotiation, we save [even more] time in not creating [additional] connections due to HTTP multiplexing.

In hindsight, it was almost silly for us to implement SPDY and a CDN. By sharding assets to another domain, we really lose all of the benefits of SPDY.

Source

If I get off WP, it will be to something I build myself.