The ScaleBase Analysis tool gives a schema a grade between 1 and 100 for being “sharding compatible”. It’s a neat feature, but many ask me how the grade is calculated. Well – here goes.
First of all, a good schema is one that is easy to shard. Database Normalization is usually a good thing when sharding. It means that finding the sharding key is easy, relationships between tables are clear, and the queries themselves are usually much simpler. So we try to give a grade on how well the schema is normalized.
After the sharding configuration is determined (see here on how this should be done), we review your MySQL General Log, to understand the value you can expect from the sharding configuration:
- Statements that run on sharded tables, and hit a single shard.
- Since each database is smaller in size, performance of a single shard improves. As a result, statements of this kind will give major performance improvements.
- Bottom line – major performance improvement over the original configuration.
- Statements that run on sharded tables, and hit multiple shards.
- These statements run on multiple shards, in a map-reduce manner. It means they will run faster than running on a single, big, database – but they will run slower than statements that need to hit just one shard.
- Bottom line – better performance than the original configuration.
- Statements that run on global tables, and hit a single shard.
- These are queries on global tables. Basically, the performance improvement should be similar to what’s seen on statements that run on a single shard (depending on the global table size of course).
- Bottom line – major performance improvement over the original configuration.
- Statements that run on global tables, and hit multiple shards.
- DML operations over global tables need to hit all the shards. These will run slower than the original configuration, so if you see you have a lot of these, try to turn the specific global tables into split tables.
Sounds simple, right? Well, try to take all these parameters into consideration, and build a sharding configuration on your own. If you don’t want to – try out our ScaleBase Analyzer – for a free tool that can build the sharding configuration for you.
PlanetMySQL Voting: Vote UP / Vote DOWN