欢迎投稿

今日深度:

MariaDB 和 MySQL 比较,mariadbmysql

MariaDB 和 MySQL 比较,mariadbmysql


MariaDB 和 MySQL 比较

英文原文:MariaDB vs. MySQL: A Comparison

返回原文

There's more than enough reason to ditch MySQL and switch over to MariaDB and stay there.

The MariaDB Blog’s performance test.

MariaDB is a fork of the MySQL source code, split off in the wake of concerns over what Oracle would do with MySQL licensing. (MySQL was purchased by Sun, which was subsequently snatched up by Oracle.) These are valid concerns, which I get to later in this article. In addition to its role as a “drop-in replacement” for MySQL, MariaDB also includes some new features that (some claim) make it better than MySQL.

Before getting into those features, I want to talk about MariaDB’s version-numbering scheme. At first, MariaDB’s versions were matched with MySQL versions—so MariaDB 5.1, for example, used the same code base as MySQL 5.1. As updates and fixes were supplied to the MySQL source tree, MariaDB would attempt to bring those same patches in. (In theory, there are monthly merges with the MySQL code.) But if new and unique features are added on a regular basis, I imagine that code-parity has transformed into a nightmare to maintain.

译者信息

译者信息

Garfielt
翻译于 3年前

5人 顶 此译文

现在选择继续使用MySQL或抛弃它切换到MariaDB有足够的理由。

MariaDB 博客上的性能测试。

MariaDB是MySQL源代码的一个分支,在意识到Oracle会对MySQL许可做什么后分离了出来(MySQL先后被Sun、Oracle收购)。这些担忧是有依据的,我会在本文的后面讲到。除了作为一个Mysql的“向下替代品”,MariaDB包括的一些新特性使它优于MySQL。

在介绍这些特性前,我想先谈谈MariaDB的版本编号模式。首先,MariaDB版本与Mysql版本相匹配——比如MariaDB 5.1,与MySQL 5.1使用相同的代码。由于更新和修复是针对MySQL源码树的,这样的话MariaDB可以采纳这些补丁(理论上,MariaDB每月都与MySQL源码合并)。但是如果新的独特特性定期添加的话,我想代码校验肯定会是一个恶梦。

The MariaDB team seems to be aware of this, as they’ve decided to start over with a new numbering scheme. The newest version of MariaDB (which is currently still in alpha) is Maria 10.0, followed by a minor number:

mysql -P 3406 -u root -p

Enter password: ********

Welcome to the MariaDB monitor.  Commands end with ; or \g.

Your MariaDB connection id is 1

Server version: 10.0.2-MariaDB mariadb.org binary distribution

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> select version();

+—————-+

| version()      |

+—————-+

| 10.0.2-MariaDB |

+—————-+

1 row in set (0.01 sec)

MariaDB [(none)]>

MariaDB’s people give a long-winded, somewhat rambling explanation of why they did this—which still hasn’t stopped some developers from being upset—but it is what it is. They can’t continue to add new features and forever insist that it’s a completely compatible MySQL drop-in replacement.

And as for the new features? Let’s look at a couple of them.

译者信息

译者信息

Garfielt
翻译于 3年前

3人 顶 此译文

MariaDB团队应该也意识到这一点,他们已经开始制定新的编号方案。最新的MariaDB版本(目前仍处于alpha状态)是Maria 10.0,后面跟着一个小数:

mysql -P 3406 -u root -p

Enter password: ********

Welcome to the MariaDB monitor.  Commands end with ; or \g.

Your MariaDB connection id is 1

Server version: 10.0.2-MariaDB mariadb.org binary distribution

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> select version();

+—————-+

| version()      |

+—————-+

| 10.0.2-MariaDB |

+—————-+

1 row in set (0.01 sec)

MariaDB [(none)]>

MariaDB再三甚至有些散漫地解释为什么他们这样做——尽管这样让开发者感到不适,但它就是这样。如果依旧完全兼容Mysql的话他们不能继续添加新特性。

至于新特征?让我们看一下其中的几个。

Cassandra Engine

One unique feature of MariaDB is its engine for connecting to a Cassandra backend. The engine itself is just an intermediary that joins a Cassandra server running separately. (Cassandra is a NoSQL key-value store that was created at first at Facebook and later became an Apache project; while it can be used in clusters with no single point of failure, it’s still not ACID-compliant.) Generally speaking, if you’re going to use Cassandra as the engine, you’re not going to get nearly the speed or performance that you would with InnoDB or ExtraDB.

But you can access the data through MySQL, giving it an SQL-like feel and allowing for selects, inserts, updates, deletes, and even joins to an extent. But the MariaDB team says that the Cassandra engine shouldn’t be relied upon for much more than light data usage.

译者信息

译者信息

Garfielt
翻译于 3年前

3人 顶 此译文

Cassandra引擎

MariaDB的一个独特特性是它的连接到Cassandra后端的引擎。引擎本身只是一个加入到Cassandra服务器中单独运行中介(Cassandra是一个NoSQL类型的键-值存储,由Facebook创建后来成为了Apache的项目;它可用于集群且没有单点故障,它同样不是完全ACID的)。通常,如果你使用Cassandra引擎的话你就无法获得与InnoDB或extradb相近的速度或性能。

但是你可以通过MySQL访问数据,通过允许selects、inserts、updates、deletes甚至拓展的join就像使用SQL感觉一样,但MariaDB团队表示Cassandra引擎不适合大量数据的分析类查询。

So this feature could be useful if you, uh, let’s see… well…

If you’re writing a software application that needs to access data from Cassandra, then you’re probably better off using the native Cassandra API rather than going through MySQL. I suppose if you’re fussing around with the mysql command line interface and need to grab some data, this Cassandra engine could come in useful—but if you’re going to do that, you might as well just fuss around with the Cassandra command-line interface.

So I’m not really sure about the use-case here, but that hasn’t stopped some people in the blogosphere from being excited about this feature.

译者信息

译者信息

Garfielt
翻译于 3年前

3人 顶 此译文

所以这个功能可能有用如果你……,呃,让我们接着看……

如果你在写一个需要访问Cassandra数据应用软件,那么你最好直接使用Cassandra的原生API而不是通过MySQL。如果你的注意力在MySQL命令行,且需要抓一些数据,这种情况Cassandra引擎可以派上用场——但如果你打算这样做的话,你可能只想尝试下Cassandra的命令行界面。

所以我真的不知道哪种是适用情况,但这并没有阻止一些人在博客上抒发对此功能的兴奋之情。

OQGraph Engine

I won’t say a whole lot about this one, as it follows the same idea as Cassandra: the engine is really just an interface to the Open Query Graph computation engine. This might assist in some specialized applications, although mapping graph structures to an SQL format is a bit odd on the surface.

One important enhancement that brings additional power to MariaDB is the use of XtraDB as a drop-in replacement for InnoDB. But XtraDB adds modern scalability capabilities that are needed for today’s software—and that’s where we get to the heart of the difference. Oracle claims MySQL now scales better than ever before, and perhaps it does, but it’s only as good as its engine. And if the engine can’t truly scale as well as it should, then MySQL can’t.

译者信息

译者信息

Garfielt
翻译于 3年前

2人 顶 此译文

OQGraph引擎

我不会介绍这个特性的全部,因为它跟Cassandra想法相同:这个引擎是图计算引擎的开放查询接口。这对一些特定的应用可能有用,尽管表面上看将图形结构映射到SQL格式有些古怪。

MariaDB的一个重要的增强力量是使用xtradb作为InnoDB的向下替代。而且xtradb增加了现代软件所需要的可扩展能力——这是核心不同点。Oracle声称MySQL现在的拓展性比以前好,可能的确如此,但引擎还是那个引擎。如果引擎不能真正具备拓展性,那么MySQL也同样不具备。

Atomic Writes

One of the main reasons for choosing a relational database system over a typical NoSQL is for the full ACID compliance. Simply put, if there’s a failure, you don’t want to lose data. While failures might not often occur on our development machines, they’re a fact of life in many IT centers. Presently, the default InnoDB/XtraDB engine uses double-buffer approach to writing data, in order to make sure the data is successfully written in the event of a crash. However, when dealing with high-speed SSD devices (just as an example), the double buffer can have a negative impact on performance, preventing you from accessing the speed benefits of SSDs. The solution? You can now opt out of the double buffer and use what’s known as Atomic Writes. Use at your own risk, and probably not in production.

So again, interesting feature—but not a feature that should convince you to abandon MySQL for MariaDB.

译者信息

译者信息

Garfielt
翻译于 3年前

2人 顶 此译文

原子写

选择关系型数据库而不是NoSQL的主要原因是前者对ACID的完全支持。简单的说,如果有失败,你不想丢失数据。尽管故障可能并不经常在我们的开发用机上发生,但在很多的IT中心却很常见。目前,默认的InnoDB/XtraDB引擎采用双缓冲的方法来写入数据以确保崩溃时数据能写入成功。然而,当使用高速的SSD设备时(打个比方),双缓存对性能有负面影响——会减小SSD在访问速度方面的优势。解决办法是什么呢?现在你可以关掉双缓冲打开所谓的原子写。先在你磁盘上验证再应用到生产环境。

同样是一个有趣的功能,但还不是那个让你转用MariaDB抛弃MySQL的特性。

Performance of MySQL vs MariaDB

Now I want to draw attention to a benchmark that was performed by the MariaDB team and make some additional notes about it. This blog offers an interesting point: MySQL 5.6 performs well up to 16 threads, but after that—although its performance continues to rise a bit—it doesn’t go up as well as the other versions to which it’s been compared (including MariaDB-5.5.28a and MariaDB-10.0.1; see the top of this article for a graph of the performance test). This is a common problem in parallel programming while attempting to target multiple cores and threads within a core. If algorithms are constructed correctly, you will continue to see advantages as your cores increase. The problem is you need to handle two approaches in your parallel programming: (1) Multithreaded across multiple cores, and (2) vectorization. These are the two facets to today’s multicore programming, and your code needs to handle both aspects correctly.

译者信息

译者信息

theboy
翻译于 3年前

2人 顶 此译文

MySQL和MariaDB的性能比较

现在把目光移到benchmark上面来,它其实也是由MariaDB团队开发的,并加了一下额外的说明。这篇博客提到了一个有趣的地方:把MYSQL5.6的线程数一直增加到16,性能都很好,但是超过了16的话,尽管性能也有提升一点点,但比较发现,远不如其他版本(包括MairaDB-5.5.28a和MairaDB-10.0.1;参考文章顶部的性能测试图)。这在单核计算机里面试图达到多核多线程的效果的并行程序时,都会有此类的通病。如果算法设计得当,随着CPU核心数的增加,性能也会跟着提升。当然问题是,你必须在并行程序中处理好2个方面:(1)跨多核的多线程问题(2)矢量化。这也是当前面向多核编程的两个方向,你编写的必须能很好的控制这两个方面。

One common result of not coding these correctly is you’ll start out seeing an improvement in the first 8 or 16 threads, and after that you won’t get nearly the hoped-for improvement. When you see that problem, it means there’s likely trouble with the algorithms. (And this will be the case with either hyperthreads or hardware threads.) That’s what we’re seeing here with the MySQL benchmarks. To me, that’s an indication of trouble with MySQL scaling, and should be a cause for concern. MariaDB also has a slight problem in the same benchmark as the performance goes down slightly, but only barely; I would surmise that this isn’t a problem with the parallel algorithms.

译者信息

译者信息

yale8848
翻译于 3年前

2人 顶 此译文

如果没有正确的编写代码将会得到一个共同的结果,即在用8到16个线程的开始你就想看到好的结果,但在这些线程运行之后你不会看到你期望的结果。你将会看到这个问题,这意味这可能是算法问题。(这也不是超线程或是硬件线程造成的)这就是我们在这里看到MySQL 基准的问题。对于我来说,这就是MySQL规模化产生问题的迹象,这也是令人担心的原因之一。MariaDB在同样的基准中也有一些小问题,但是比MySQL要轻微的多,只能说是勉强吧;我推测这个问题在并行计算中可能不会出现。

I also don’t know how well the specific builds matched to the machines used in the test. When you compile Intel code, you need to have the compiler generate the proper size SIMD code for the target machine; if it’s a mismatch, you won’t get the hoped-for performance in your vectorization code. To do this correctly, you have to insert the correct pragmas into your code and then write your vectorization algorithms correctly, and, finally, turn on the proper compiler switches. I know that sounds silly, but I’ve seen products released with the wrong compiler switches far more often than you might expect. In any case, clearly the MySQL code wasn’t optimized for multicore and vectorization as well as MariaDB.

译者信息

译者信息

yale8848
翻译于 3年前

2人 顶 此译文

其它翻译版本:1(点击译者名切换)
MtrS

我也不知道在测试中怎样才能很好的根据不同机器指定不同的编译器来与之匹配。当你为Intel编译代码时,你需要为目标机器编译生成合适的SIMD代码;如果不匹配,你将不会得到你所期望执行的矢量代码。为了能正确处理,你需要在代码中插入正确的编译指示代码,然后要写下正确的矢量算法,最后在选择合适的编译器。我知道这样看起来很愚笨,但我看过一个发行产品用错误的编译器所造成的结果是你无法想象的。好歹,很明显,MySQL代码在多核和矢量化中的优化没有MariaDB好。
译者信息

译者信息

MtrS
翻译于 3年前

2人 顶 此译文

其它翻译版本:1(点击译者名切换)
yale8848

我也不知道如何好的特定生成匹配到测试中使用的机器。当你编译Intel 代码时,你需要调整编译器为目标机器生成适当大小SIMD代码;如果你不去调整,你不会在矢量化代码中得到期望的性能。若要正确地做到这一点,必须向代码中插入正确的预处理指令(pragma)和然后恰当地编写你的矢量化算法,最后,打开的正确的编译器开关。当然,这听起来很傻,但我见过比你可能期望更多时候发布与错编译器开关的产品。显然在任何情况下,MySQL的代码并没有为多核和矢量化编译做优化,不同于MariaDB。

(What I’d really like to see is a branch of either MySQL or MariaDB compiled specifically with the Intel Xeon Phi coprocessor in mind, with code offloaded to the 61-core coprocessor, and someone try to spin up all 244 threads. Unfortunately, I don’t have access to such a machine. Also, if you want to learn more about vectorization and parallel coding, check out the recent “Intel Xeon Phi Coprocessor High Performance Programming” by Intel’s James Jeffers and James Reinders.)

译者信息

译者信息

super0555
翻译于 3年前

2人 顶 此译文

(我真正想看到的是,MySQL或MariaDB的一个分支为Intel Xeon Phi处理器核心做一个特别的编译,使代码转移到61 核心协处理器,并且有人能尝试加速所有244个线程。可惜我没有接触过这样的机器。同样的,如果你想学习更多关于向量化和并行方式编写代码方面的知识,检索最近Intel公司 James Jeffers 与 James Reinders写的文章“Intel Xeon Phi 协处理器高性能编程”。)

本文中的所有译文仅用于学习和交流目的,转载请务必注明文章译者、出处、和本文链接
我们的翻译工作遵照 CC 协议,如果我们的工作有侵犯到您的权益,请及时联系我们
  • 1
  • 2

www.htsjk.Com true http://www.htsjk.com/mariadb/26073.html NewsArticle MariaDB 和 MySQL 比较,mariadbmysql MariaDB 和 MySQL 比较 英文原文:MariaDB vs. MySQL: A Comparison 返回原文 There's more than enough reason to ditch MySQL and switch over to MariaDB and stay there. The MariaDB Blog’s perf...
相关文章
    暂无相关文章
评论暂时关闭