The Great 2010 Hosting Move
Late last month, I started to weigh my options. My image hosting service, kimages, has long outgrown shared hosting environments. With bandwidth in the terabytes, and ever increasing disk usage, it was time to change something.
Originally, I tried to see how much of an effect deleting all images over a year old would provide. Not surprisingly, it hardly made a dent in bandwidth or disk usage. Clearly the problem was larger than simple file management, hence I made the leap to switch hosting providers.
After checking out a bunch of providers, I decided on a virtual environment from BurstNET. I'm not going to get into the details of what I'm working with hardware wise, but I've decided to keep a typical LAMP setup for the time being.
So far, I've only moved kimages to the new server, and it is running quite well. I'm quite happy with how things are running thus far. I've started automatically trimming images that haven't been viewed for 7 days. Also, if a image uses too much bandwidth, its quality is reduced to reduce file size. If it continues to abuse bandwidth, it is removed. This seems to be the most sensible solution to the current bandwidth problem.
Here are a few resources / tricks I've picked up since switching to a new host.
fileatime() - For filesystems that support file access times, PHP's fileatime() call is an excellent way to check when a file was last viewed.
vnstat - For simple server-side bandwidth monitoring (without access to SNMP statistics), vnstat is a great tool for monitoring and logging bandwidth usage.
Postfix Piping
Ever wanted to be able to parse emails using a script without fetching the e-mails from the server? Postfix piping allows you to pipe incoming e-mails to scripts via STDIN. Simply add the following line (modified to your liking) to your /etc/aliases file.
EMAILADDRESS: "|/path/to/script.php"
Then run the command "sudo newaliases" which refreshes the aliases list for Postfix. Now all e-mails sent to "EMAILADDRESS" will be piped out to the script you specify. I personally used this for the new feature on kimages in which new images can be posted via e-mail.
All in all, I think the move was successful. Hopefully it adds some much needed stability to the platform.
Permanent Link · Published on August 15th, 2010
