Jump to content

Hosting images on web server vs. 3rd party image host?


galvin

Recommended Posts

I will have a website that will have thousands of images (some uploaded by me, some uploaded by users).  They will all be small images, but there will be tons.

 

In general, what is the better option for optimal performance of the site...

 

1.  Allow users to upload images to a directory on my site's web server

 

2.  Instruct users to upload images to a 3rd party image hosting site, and only allow them to enter the "hot link" of the image.

 

I realize #2 would likely cost me some money since I'd likely need a "pro" account at whichever image hosting company I go with to allow for unlimited bandwidth (since there will be lots of hot-linking), but it's likely only around $5 a month.  And it's a little more work for the user as well.

 

But is #2 the better way go to, generally speaking?  It just seems like if there's going to be thousands of images, keeping them off my web server would help overall site performance.

 

Thoughts?

Link to comment
Share on other sites

I used to be a programmer on a forum site well known for its (NSFW) gallery.  If you host the images on your web (application) hosting account you can run into problems with disc space, bandwidth and resource usage.  The load on the webserver from distributing images can take up significant resources.  What we ended up doing is setting up an nginx webserver on a colo box hosted at peer1 dedicated to just image serving and resizing (making thumbs).  From what I was told we pushed out 1.2TB from the image server and maybe only a few gigs from the application server a day. 

 

As for the premium image hosting, I don't have experience with that, the NSFW nature of the content we had made such things unavailable.  Splitting up the load definitely was the right choice in our situation.  I can see a problem though with what you said, having your users go offsite to upload pictures is clumsy, I wonder what impact it would have on your users' attention.  Some transparency by integrating an upload mechanism might be beneficial.

 

Be wary of the image hosting sites as well by reading over user agreement closely.  Some sneak in things like giving rights to reuse images which may be a problem for you.

 

Another thing came to mind, you also said your images were small, could you knit them together into a sprite and have CSS sort it out displaying them?  It would cut down on the number of requests to the server.  There are many things you can do to speed up your website, google has a whole section of articles and talks about the subject.

 

I don't know if I said anything useful.

Link to comment
Share on other sites

I'd also suggest looking into setting up a separate server of yours for just static images. Nginx servers static files super quick with a very small footprint. On larger sites (especially forums) I have it setup to where the actual forum is getting served via one server (and possibly one mysql server) and then one "media" server that hosts all the images/videos/etc.

Link to comment
Share on other sites

Thanks!  I use HostGator for my web application files (shared hosting for now, but I anticipate enough traffic ultimately where I'll need to upgrade my hosting to a more capable server).  Do you recommend setting up my own Nginx server (like in my house), or can i get an Nginx server through a 3rd party (like HostGator or someone else)?

 

Link to comment
Share on other sites

It depends on what you need really & what your timeline is. I'd suggest playing around with it on a local box (if you have one readily available), get used to nginx. Then step up to a VPS or dedi (in this case, probably a small VPS) when you're ready to push it to the live site.

Link to comment
Share on other sites

  • 3 weeks later...

The more I think about this, the more I think I'll pursue having a separate server whose only purpose is to host the images for my website.

 

Question about this. If the domain of my regular site is mysite.com, then what could the URL be of the images on my new, separate server?  In other words, they couldn't be at the domain mysite.com since that domain is hosted on the OTHER server, right?

 

Or wait, can you host a subdomain on SEPARATE server?  For example, could I host "images.mysite.com" on the separate server (which would allow all the image URLs to have URLs like images.mysites.com/monkeys.jpg)?

 

Any insight would be appreciated (I'm hesitant to use a 3rd party image hosting site because I want to have control of my images, since there will evenutally be a TON of them).

Link to comment
Share on other sites

If I decide to keep all files (including images) on one server, would it at least help to still use a subdomain.  Like...

 

  • HTML/CSS hosted on mysite.com
  • Images hosted on static.mysite.com
     

 

Both domains would be on the same server, but would this at least help a bit with speed?  Seems there is something called "parallel downloads" that is a positive thing.

 

Just curious, as I want to explore all options here :)

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.