Playing around with AmazonS3
It's almost a week until we're supposed to debut our little baby to the world, and folks are starting to get nervous. But we've been churning out code for more than two months now, going through an architecture redesign both on the software and system level. One of the things we wanted to do this round was to address issues of scalability. So for the next several posts, I'll try to discuss some of the things we've tried to accomplish in this area.
One of the first things we took a look at was offloading all our images to AmazonS3, but after doing some benchmarks on it, it seemed to be pretty slow at serving up images. Compared to having them hosted locally, the load times were about doubled. Ouch! We really don't have a lot of images in our pages, because a lot of the design is pure CSS, but in certain cases we need to load a bunch of images at the same time, as is the case for our shows and channels picker. So for now we're going to stick with our own local hosts for these, and start evaluating migrating over to a CDN like MirrorImage or Limelight in a few weeks.
However, AmazonS3 is not something to just be disregarded completely, and for what it is, it works quite nicely as a cheap, reliable storage system. Our hosting company doesn't currently support mounting shared SAN storage, so until then, we'll be using S3 to store all of our user-uploaded images. This seemed to be a more reliable alternative than using some kind of rsync script on the server side to synchronize uploads between our load-balance web servers. All we have to worry about is just making sure the URLs are pointing to the right location on Amazon's servers, and we're good to go.
I spent some time integrating S3 into our PHP uploader built in CakePHP, and for all intensive purposes, it was pretty simple, thanks to another open source library out there called PHP-AWS, which provides PHP5 classes for connecting to all of Amazon's web services. Everything is well documented and easy to integrate, and we were able to get something up and running within a day. I'll try to follow up on this with another post in a few weeks, to let you know how everything turns out.
Filed in: Development, PHP, Web Services
