This is Part 3 of our Holiday Scaling Series. Click here to view Part 1: To Scale Horizontally or Vertically and click here to view Part 2: Take Advantage of Caching.
Happy Halloween! With Halloween already here, your web traffic will continue to ramp up through the rest of the year. These tips can help you prepare.
Before launching into production, you’ll want to do some web server tuning. You need to tune it for your application and for the instance size. For example, if your app takes up 30MB of RAM, tune Apache to limit the number of processes that a 256MB box would run.
Let’s say you have six Apache processes for a 256MB instance. If you receive 16 concurrent visitors, your web server will fall over. It’ll take some math skills to figure out how to prevent this from happening. Look at what your codes does and make sure Apache doesn’t have modules you don’t need.
If you’re running PHP, for example, don’t load the PHP GD module if you’re not going to be loading images. If you’re not using authentication for your web application, take the authentication module out. Just remember, if you get 16GB out of the box, you don’t necessarily get 16GB as some memory is allocated for default apps.
As web traffic increases, your database may become slow at some point. You can look at making additional server-side fixes, like splitting reads and writes. 85-95% of apps will be read heavy which means you’ll need more slaves than masters, such as MySQL multi-master replication or even MySQL slave-slave replication. This lets your app take advantage of the reads and writes. When you split the reads to a group of slaves, you can also split the writes to a master server.
Tune in next week for Part 4 on Load Balancing.
By the way, did you notice the zombies on our website?