| By Alex Bosworth's Weblog | Article Rating: |
|
| June 6, 2008 04:15 AM EDT | Reads: |
3,788 |
Over the past few months or so I’ve been working on rewriting my web application engine to go from running on a virtual dedicated server at a hosting company to running an instance on Amazon EC2 instance. Additionally, I decided to take a risk on Amazon SDB and despite its many flaws, eschew MySQL completely and utterly.
One thing I like a lot about Amazon’s service stack is that it forces you to think about scalability problems right up front. If you design with MySQL on a VPS, it’s easy to get into using a lot of the features that don’t scale – so you make a mess for yourself down the road.
There were several challenges to running a site completely on Amazon’s stack:
- Amazon has a large distance between their small nodes and the next size up node. – The small nodes are pretty weak by themselves, you wouldn’t want to base a website on a single node by itself. This forced me to design the architecture to work from day 1 on ‘n’ servers.
- EC2 still has no load balancing API – They should add this, but to get around it we use DNS round robin assignment, which is pretty much good enough for assigning servers that should never be under huge loads anyways.
- SDB is slow. Everything about it is slow. Also it has its own features that don’t scale very well, such as ‘starts-with’ < this runs slowly.
- The data model you want for SDB is different than one you want for an RDBMS. Because you can’t join or index, you want to be thinking about denormalization of your data quite quickly. This also means migration from MySQL to SDB is tricky.
- EC2 payloads are annoying to change – Marc created a script that on instance startup pulls down all the required software for a server from SVN, finds the other servers for dns round robin-ing and for memcaches, and starts up apache.
To move over to Amazon required a migration on our relatively small database of 100k or so rows. This however expanded to around 250k rows on SDB, and required about a million SDB requests to accomplish.
As I wanted to move the site without a lot of downtime, I wrote the migration script to run on ‘N’ servers. When I started the migration up, I ran 20 server instances, and ran the script on all of them. Each segment of the migration took about 2 hours to run, so without EC2’s easy scaling capabilities the site would have been required to be down for 2 days instead of 2 hours.
So far the new Amazon EC2/SDB code base has been up for 3 days. All data is in SimpleDB, from user logins to the friend network graph, despite mysql’s ease of use I’m glad to be rid of the database as a potential bottleneck that could bring the entire site down – something that happened too frequently on my last project.
Overall the site migration went quite smoothly, and we’ve been running for a couple days now without incident. The site has created about 40k html pages, extensive use of memcache means most pages will load in 200ms under a bit of pressure, and best of all costs are reduced and completely trackable.
Now my job is to focus on growing traffic. My new site only has about 7k daily visitors, whereas my previous effort swik.net has about 30k, so I have a ways to go.
Read the original blog entry...
Published June 6, 2008 Reads 3,788
Copyright © 2008 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
- It's the Java vs. C++ Shootout Revisited!
- Patterns for Building High Performance Applications
- Asynchronous Logging Using Spring
- Java for Programmers (2nd Edition)
- Cross-Platform Mobile Website Development – a Tool Comparison
- Three Buzzwords That Every CIO Hears but One They Should Listen To
- Write Once Run Anywhere or Cross Platform Mobile Development Tools
- Immersing into JavaScript Frameworks
- Workday Reportedly Prepping to Go Public
- Cloud Expo New York: The Java EE 7 Platform - Developing for the Cloud
- Book Review: Sams Teach Yourself Java in 24 Hours
- OpenOffice.com Lives
- Book Excerpt: Introducing HTML5
- Adobe Sends Flex to the Apache Foundation
- Five Years Waiting for JRE 7: Is It Justified? (Part 1)
- Book Excerpt: Java Application Profiling Tips and Tricks
- i-Technology in 2012: Five Industry Predictions
- It's the Java vs. C++ Shootout Revisited!
- Patterns for Building High Performance Applications
- OpenXava 4.3: Rapid Java Web Development
- The Next Web Architecture
- Asynchronous Logging Using Spring
- Java for Programmers (2nd Edition)
- Is Write Once Run Anywhere Ever Going to Be a Reality?
- A Cup of AJAX? Nay, Just Regular Java Please
- Java Developer's Journal Exclusive: 2006 "JDJ Editors' Choice" Awards
- JavaServer Faces (JSF) vs Struts
- The i-Technology Right Stuff
- Rich Internet Applications with Adobe Flex 2 and Java
- Java vs C++ "Shootout" Revisited
- Bean-Managed Persistence Using a Proxy List
- Reporting Made Easy with JasperReports and Hibernate
- Creating a Pet Store Application with JavaServer Faces, Spring, and Hibernate
- Why Do 'Cool Kids' Choose Ruby or PHP to Build Websites Instead of Java?
- What's New in Eclipse?
- i-Technology Predictions for 2007: Where's It All Headed?
















