4 ms·
Having been there a few times there are a few suggestions I'd like to put out there. The points here should take a very minimal amount of time (< 1 week combine
by dolinsky 16y ago
Having been there a few times there are a few suggestions I'd like to put out there. The points here should take a very minimal amount of time (< 1 week combined) but they are meant to be easy ways of getting more mileage out of what you currently have.
#1. Move all of the non-db specific crons off of your db servers (those that don't specifically involve the rotation of logs/cleanup of tmp directories) and onto one of your web heads. There is nothing more painful then seeing your master db crash because of a cron job or other non-essential role on your db server. It's much easier to recover from / spin up a new web head if it crashes then to restart mysql after your master db crashes (a slave db is easier, but still more of a pain point than a web head). If at all possible, since you're already on EC2, spin up a worker server just to perform these cron jobs (stats collection, db cleanup scripts, etc). EC2 affords you this kind of flexibility. Take it.
#2. Hooking into a CDN is very easy to do and can allow your web servers to offload the serving of static files. As an easy way of doing cache-busting set up a global version variable in your code that gets injected into each static url that's generated (so a request for cdn.mygengo.com/images/29384/bar.jpg would be rewritten to look for /images/bar.jpg on your web heads if and only if the cdn'd cache had either expired or the unique # had changed in the request).
#3 Set up some sort of perfomance monitoring if you haven't already. Almost every startups #1 pain point is the db server, specifically queries. It's great that you've been able to see such a vast improvement through adding indexes / cleaning up some queries, but as long as your data is growing you will need to continue to keep on top of your query logs as their impact footprint will change as the size of your data does. Since you're on AWS, enabling Cloudwatch
should be very easy and provides the basics. You can then move onto implementing Nagios/Munin or look to something like Cloudwatch/ServerDensity for an in-the-cloud solution.
You also didn't mention anything about having a K/V system like Memcache or Redis (yes @antirez we all know Redis rocks and how dare I place it after Memcache ;) which can really take the load off your db servers.
Best of luck with continued growth.