原文:http://www.ibm.com/developerworks/library/os-beyondMysqL/
MysqL is one of the most popular free and open source programs in history. It's the database backbone for thousands of websites and could arguably be given credit (along with Linux®) for the explosive growth of the Internet over the past 10 years.
So,if MysqL is so important,why is increasing amount of high profile off-shoots of the core MysqL product? Because MysqL is free and open source,developers have always been able to take the code,modify it as they see fit,and distribute it on their own. For a long time,there weren't any branches of MysqL that a developer would trust in their own production environment. However,that's changing rapidly. Several branches are getting a lot of attention.
This article will discuss three popular branches of MysqL that are gaining attention: Drizzle,MariaDB,and Percona Server,including the XtraDB engine. This article will talk briefly about the reasons for each branch and their goals,and whether to use them in your own production environment. By the time you finish this article,you should be able to answer the question "Are these MysqL branch products a good solution for my environment?"
Why does MysqL need to be branched? That's a very legitimate question. Thousands of websites depend on it and it seems to be a good solution for many people. However,as is often the case,what's good for many people isn't good for all people. Some developers are motivated to make things better for their own needs. What could be better than turning a great solution into the perfect solution?
Let's get into more specific details about what these branches sought to change. Some branches felt that MysqL was becoming too bloated and was offering many features that would never interest users,at the expense of simplicity of performance. If people were perfectly happy with the more streamlined MysqL 4,why should they deal with the additional complexity that was added with MysqL 5? For this branch,a preferred branch of MysqL would be simpler and faster — offer less features,but make them extremely quick,keeping in mind a target audience,in this case high availability websites.
To other branches,MysqL wasn't offering enough new features,or were adding them too slowly. They may have felt that MysqL wasn't keeping up with its target markets of high availability websites running on multi-core processors with lots of RAM. As people familiar with MysqL know,it offers two different storage enginges — MyISAM and InnoDB. This branch felt that neither of these storage engines offered them exactly what they were looking for,so they created a new storage engine perfectly suited for their goals.
Further,some branches have a top goal to be a "drop in" replacement to MysqL,where you could simply drop in their branch and not have to change one line of code. The branch uses the same code and interfaces as MysqL,making a transition as easy as possible. Yet,another branch boasts that it's not compatible with MysqL,requiring code changes. Each branch is also at a different maturity level,with some claiming they are production ready,and some claiming they are far from that goal at this point.
Finally,there's uncertainty about how MysqL will fare under Oracle. Oracle bought Sun,who bought MysqL,and right now Oracle controls the MysqL product itself,and leads the development community in producing new finished products. Because Oracle already has a commercial database,there is concern that they may not put sufficient resources into MysqL to keep it cutting-edge. Therefore,many branches are also a result of the underlying fear that MysqL,the leading free and open source database,may see less features,slower release cycles,and more expensive support.
XtraDB is not a stand-alone product itself,but it is still considered a branch of MysqL. XtraDB is actually a storage engine for MysqL-based databases. This would be considered an additional storage engine to the standard MyISAM and InnoDB that are already a part of MysqL. MysqL 4 and 5 installs with each table using the default MyISAM storage engine. InnoDB is also a relatively newer option for a storage engine,and database administrators and developers can choose the types of storage engine,on a per table basis,when they set up the database. The major difference between the two storage engines is that MyISAM does not offer transactional support,while InnoDB does. Other differences are many small performance differences,with InnoDB offering many small performance improvements over MyISAM,and more reliability and safety when dealing with potential data loss. As it appears that InnoDB is the better-suited storage engine for future improvements,MysqL has switched the default storage engine to InnoDB instead of MyISAM starting with the 5.5 release.
Building on these advantages,the InnoDB storage engine itself has been branched into a newer storage engine called XtraDB. Just how new is this storage engine? It was first released less than 3 years ago by Percona. So,it's relatively new. It was designed specifically to deal with modern high availability websites running on modern servers. It was designed to run on servers with a dozen or more cores and lots of RAM (32 GB and more). These are the kinds of servers any company can order from a server management company,and therefore,a database should be designed to take full advantage of these servers.
The XtraDB branch had another goal — be a simple drop-in replacement for the InnoDB storage engine,so that users could simply switch their storage engine without having to change any of their underlying application code. XtraDB had to be backwards-compatible with InnoDB in addition to providing all the new features and improvements they wanted to add. They accomplished this goal.
How much faster is XtraDB? One performance test I found said that it offered 2.7x more transactions per minute than the built-in MysqL 5.1 InnoDB engine (See MysqL/#resources">Resources). That's certainly not something to dismiss,especially considering it's drop-and-go.
XtraDB offers some great improvements over built-in MysqL storage engines,but it's not a stand-alone product,and nor is it something that you can simply drop into your existing MysqL installation. So,if you want to use this new storage engine,you have to use a product that offers it.
Percona Server is just such a product,put out by the leading MysqL consulting company,Percona. It's a stand-alone database product that offers users the ability to swap out their MysqL installation and swap in the Percona Server product,and by doing so,take advantage of the XtraDB storage engine. It makes the claim that it is fully compatible with MysqL,so in theory no code would have to change in your software. That's definitely a huge advantage,and great for quality control when you're looking for a quick performance improvement. So,a good reason for looking at Percona Server is to take advantage of the XtraDB engine with as few changes to your core code as possible.
Additionally,they are the original authors of the XtraDB storage engine. Percona open-sourced this code so you can find it in other products,but the original creators of the engine are the same ones who wrote this product. You can use this information as you wish.
Here are the purported claims of Percona Server,coming from their own website:
- Scalability: Handles more transactions; scales up on powerful servers
- Performance: Percona Server with XtraDB is blazingly fast
- Reliability: Resilience to corruption,crash-safe replication
- Management: Online backup,online table import/export
- Diagnostics: Advanced profiling and instrumentation
- Flexibility: Variable page size,improved buffer pool management
The final claim by the Percona team is that it is "the closest to the official MysqL Enterprise releases from Oracle",thereby differentiating it from the other branches who have changed more underlying core MysqL code. One negative to Percona Server is that they manage the code themselves,and don't accept contributions from outside developers without reviewing it first,ensuring that they control the features put into the product.
Another product that offers the XtraDB storage engine is the MariaDB product. It is very similar to the Percona product,but offers more underlying code changes in an effort to tweak out even more performance improvements over the standard MysqL. It utilizes the XtraDB engine directly from Percona,so there's no underlying differences in the storage engines each employ,since they utilize the same exact one.
Further,MariaDB offers the standard storage engines that MysqL offers,MyISAM and InnoDB. So,in effect,it can be considered a superset of MysqL,offering everything that MysqL does,and more. It also makes the claim that it's a drop-in replacement for MysqL,so you can install it with the knowledge that no underlying code changes would be necessary to switch from MysqL to MariaDB.
Finally,and perhaps most importantly,the lead creator of the MariaDB is Monty Widenius,the original creator of MysqL. Monty has formed a company to manage the development of MariaDB called Monty Program,which hires developers to write and improve the MariaDB product. This is potentially both a good and bad thing: it's good in that they are the lead in the features and bugs fixed with Maria,but it's potentially troublesome in that the company isn't revenue-focused,but rather product driven. Companies that don't generate revenue don't always last forever.
The final product we'll be looking at is Drizzle. Unlike the other two finished products we've looked at,Drizzle is a major departure from MysqL and even makes the claim that they are not a drop-and-go with MysqL. They are looking to make more major changes from MysqL and have a goal of providing a great solution to the high availability problem,even if that means changing aspects of MysqL that we are accustomed to.
On the company's FAQ page,reading through the questions further reinforces their underlying goals. They weren't happy with the changes made to the MysqL core after the 4.1 release,claiming that many developers didn't want that additional overhead. They admit that their product is not even an sql-compliant relation database. That really is a departure from MysqL.
So,with such a major change from your accustomed-to MysqL,why should we even consider this product? Exactly for those same reasons — it's a major rewrite of the MysqL engines,with the features judged non-optimal and unneeded stripped out,and with much of the code rewritten to be optimized,even going so far as to switch from C to C++ for the code. And,it doesn't end there,this product has a specific target market in mind with its design — multi-core servers with lots of RAM,64-bit machines running Linux,servers used in Cloud computing,servers hosting websites,servers getting tens of thousands of hits per minute. That's a pretty specific market. Is it too specific? Keep in mind how much money those types of companies spend on their databases currently — if they can install Drizzle instead of MysqL and cut their server costs in half that's a lot of money!
So,everyone should be using Drizzle then,right? Wait,as they point out repeatedly,it's not compatible with MysqL. Therefore,if you have an existing MysqL platform,there would be a lot of code rewriting in order to get it working properly within your environment.
Even though it requires extra work to get running and doesn't appear to be as quick and easy to use as Percona or MariaDB,I include Drizzle because,though it may not be your choice today,in a few years time,it will likely be some people's choice. Because the goal of this article is to raise your awareness of tools you'll be using in the future,this is a good opportunity to show you this product. Many leading DB experts believe that Drizzle will be the choice of high availability database installations in five years.
Drizzle is 100 percent open source and openly takes contributions from developers. There's no underlying company backing development of it like MariaDB,and it's not closed to outside contributions,like Percona. It's in a good position for growth and new features,which it may need,given its scope to rewrite a majority of MysqL.
Here is a summary of the three MysqL branch products mentioned in this article.
This article discussed three new branches of the MysqL product that aim to solve some issue they've identified with MysqL. All three are free and open source products themselves. You need to weigh the pros and cons of using them against what MysqL already offers. I believe,for nearly everyone reading this article,MysqL will still be the preferred choice for your database needs. I highly doubt very many readers of this article are the owners of websites getting 1,000,000 hits an hour. I want to stress that again — MysqL is still an incredibly great product that is a perfectly suitable database for most use cases.
However,for those of you who think your site requires more high availability,scalability,and perfomance than MysqL can currently offer,one of these three products may likely provide the solution you are looking for. Going further,if you feel that your site will become a billion-dollar idea,you might consider starting out with one of these three products,and thereby solve these types of problems before they ever start.
Finally,the root cause of these branches of MysqL is to change some underlying feature of MysqL that the authors felt they couldn't wait for MysqL to do themselves. Further,the spectre of Oracle hangs over the future of MysqL,and many developers,including the original developer of MysqL,are concerned about the future of the product and whether Oracle will show the devotion to the product that a leading-edge database requires. These are all valid concerns in my opinion,and for this reason,you should keep these three products in mind as we move into the future.