Jetpants: a MySQL toolkit for managing billions of rows and hundreds of DBs
engineering.tumblr.com
engineering.tumblr.com
It's really quite a good intro to the subject, I think.
It's an elegant implementation. From a ~30 minute read through I reckon I can use it to replace our current "hacked up" solution in just a few hours.
Kudos Tumblr.
That said, I really grew to love Ruby over the course of this project, which is actually my first in the language. Ruby's open classes allowed me to write a pretty flexible plugin/callback system with very little code. Jetpants allows you to hook arbitrary methods in before or after any method in any Jetpants class, and these callbacks "stack" (with support for different priorities) so multiple plugins can hook-in to the same place.
Because every large site seems to tackle sharding slightly differently, I figured a nice plugin system was pretty important in order for anyone else to be able to use this :)
SSH is also an option (a slow option, but an option) that provides certain things (encryption, authentication) that make it ideally suited for transfers across network boundaries.
[1] - http://engineering.tumblr.com/post/7658008285/efficiently-co...
[2] - http://www.ndchost.com/wiki/server-administration/netcat-ove...
I thought it wasn't a great idea. OK for an on-the-fly solution to the problem but bittorrent or multicast would seem better; the serial route between machines isn't very fault tolerant requiring a start-from-scratch on failure.
socat > nc BTW, and does multicast.
As for ssh, it's a shame the "no encryption" option was removed.
I agree with you on all counts though!
We usually use this to copy to 2 or 3 machines at once; it's rare that we'd need to bring up 4+ slaves simultaneously, or split a shard into 4+ pieces. Most Linux distributions already have all the software needed except pigz, which is tiny and available in several packaging systems.
I'll definitely give socat a look though, thanks for the tip.
Definitely please let me know how you got that impression though -- I'm happy to improve confusing things in the docs.
As for ACID compliance: Jetpants is a toolkit for MySQL / InnoDB, and doesn't really impact the referential integrity guarantees of those systems any more or less than other partitioning schemes. MySQL is inherently not a distributed system, for better or worse.
This is explained in the deeper doc files -- didn't want to bog down the top-level README with implementation details.
Meanwhile, data exporting (for shard splits or table defragmentation) is done on a standby slave with replication stopped.
re: your immediate question, you still connect to MySQL as normal. Jetpants isn't a server, middleware, framework, or ORM. Rather, it's a toolkit. Jetpants has a command suite that you can use to run its built-in functionality, but it's also a Ruby gem that you can integrate into custom scripts however you'd like.
The functionality is all geared towards managing large DBs (importing/exporting lots of data quickly, copying files quickly, etc) and managing large numbers of servers (promoting/demoting masters and slaves, adding new machines to a pool, rebalancing a shard).
Another question - we are using django so are considering Postgres since there is a python connection pool available. Could Jetpants be potentially used for Postgres? ie how much of the functionality is Mysql specific?
I also made the mistake of putting "mysql" in the names of a few methods. At some point soon I'll change those to more generic names, and alias the old names to the new generic ones.
Thanks very much Evan as well for our chats ages ago (Andrew here), was happy to see you release this tool!
Deleted comment
jetpants parallelizes many steps of this process allowing for greater throughput than what could be normally achieved by traditional tools.