April 5, 2009

How MySQL Sandbox Solves All My Problems

Filed under: Code, MySQL — Gregory Haase @ 4:01 am

I just can’t help thinking about how amazing and useful MySQL Sanbox is. There are so many things that it can do, and so many problems that it solves for Database Developers. When it comes down to it, I really think that every project that uses MySQL can benefit in some way or another just by using MySQL Sandbox. Here are just some of the challenges that database developers face on a regular basis that sandbox can fix:

  • Upgrade Planning – Are you wanting to upgrade your binaries but are afraid to take the leap. Is there too much activity going on in development that you can’t afford to be disruptive? MySQL Sandbox provides an easy, non-destructive means of testing. Just use make_sandbox with the –datadir_from option. It will copy your current data directory (or a copy of your data directory residing somewhere on the filesystem) into a new sandbox with the version. From there you can test as much as you want without disrupting your current development database.
  • Support Multiple Branches and Multiple Developers – When you have a lot of developers working with your database one of two things can happen – either they all have local instances of the database (in which case you end up running around trying to fix a bunch of broken instances that are all running different versions), or they are all using the same database and breaking things for each other. The old way to fix this was to run a bunch of cheap commodity hardware boxes and have a server on each. The smarter guys got virtualization going, and saved snapshots of database servers and cloned that way. Other guys used mysqld_multi to run a bunch of MySQL servers on the same set of binaries on the same OS. The problem with all these methods is that it’s a lot of overhead for something that is typically short lived. Development cycles can be quick – sometimes lasting less than a week. MySQL Sandbox resolves this by making it trivial to spin up lots and lots of instances. Whenever a developer needs a new copy to work with, just run make_sandbox and give him the new connection string (This will most likely be identical to his current connection string with a change of port number).
  •  Check Backward Compatibility – Does your software package boast that it runs on mysql > 4.0. Does it work on every version in between? How do you even know? And how do you prevent that developer who’s using MySQL 5.1 from introducing incompatible features? How do you catch it if he does? You wouldn’t want to have permanent or even semi-permanent copies of your database on every version. MySQL_Sandbox makes it easy. Just store all the binaries you want to test against and create sandboxes to test each one before you release.
  • Easily Support Multiple Versions – I’ve seen it enough times; It’s an open source project, and there’s a user out there that is seeing an error that no one else can replicate. The development staff things it’s a version issue, but no one seems to have that user’s version installed.  The next step is a call to the community – is anyone else running version XYZ that can test this out. With sandbox, you have no more excuses. Just download the binaries for that version, make_sandbox, and try to replicate the error. Did the user compile their own binaries? If you had the same architecture, could he send them to you?
  • Test New Replication Schemes – Is your environment getting complicated? To you have two many slaves running off a single master and need to introduce a new layer. Mysql_sandbox comes with several prepared schemes out of the box, including standard, circular, and master-master. Start with one of these existing schemes, or start with a bunch of disconnected sandboxes and connect them all together to test your production plans.

I’m sure this is just the tip of the iceberg. I’m sure that are many others ways that people can think of to use MySQL Sandbox. And I bet that some people are already doing wild things that none of us have even thought of. If you are, please share your experiences with us.

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

The Silver is the New Black Theme. Create a free website or blog at


Get every new post delivered to your Inbox.

%d bloggers like this: