“One of the biggest mistake by most website owners is hosting the user uploaded static content or media files in their web server.”
Optimizing your website size and server disk usage is very important, specially on social network sites or large blogs with many photos. You should store your static files such as photos, videos, music and even archive files (eg. tar, gzip, zip) on a separate server or storage. Using external storage such as Large Storage Servers, Object Storage, Block Storage, Storage Area Network (SAN) or Network Attached Storage (NAS) are good solutions for this.
Why do you need to off-load the images and other media files?
- Making the disk usage very small will make your site and server faster.
- When your website size is big you will have a big backup size making the backup process so slow and making the web server use so much CPU and RAM.
- Machine or Hardware fails. Imagine how long to restore a huge backup.
- Sometimes due to the large backup size it gets corrupted. If backup fails imagine how you will recover.
- When you have too many users uploading at the same time your network will get congested making your site slow.
- Uploading too many large images or video files will increase the server system process or disk IO will be very high and will make read/write slow.
- Serving the images and other media files through the same server will make your website slower.
- If you are planning to get big then this is the way.
- If you have active dynamic site it will be easier to scale or setup high-availability in the future. Single server have disk limits.
- If your site grows big it is easier to setup for high-availability.
- A single server or machine have limits on its hardware or disk size.
- Not necessary to backup image files but you need to place it on redundant and distributed storage for added security and reliability.
There may be still a lot more reasons but those are the few. So if you plan on getting big or expecting to get large amount of image files then you should think of external storage. Theme images or icons are forgivable to store on the same server but it is still an advantage to even store theme images to external storage. Small static sites (html) should be fine also without using external storage but still its a good practice and idea.
Most PHP script or apps and plugins today have features to upload images to external storage. You can inquire to your developer for the feature.
- Check if your script or application have external storage features for storing images or media files.
- If your plugin uses images or media files, check if it has the ability to use external storage.
- If you are just starting up and still cannot afford external storage you can monitor the size of your disk or site. As much as possible limit the size to 1gb.
- Limit the file size of your photo or other media files. If possible it should be 2mb file size. For social networks you can try 5mb. You can already have 500 photos for 1gb space at 2mb file size each.
- Clean your site files. Do not store archives or backup files (eg. tar, zip, gzip) in your web server.
- Exclude your media or photo directories from backups.