521 points · by moneil971 · 5y ago · 328 comments
When you consider the network effect of all the stacks already heavily invested in MySQL, all Oracle really needed to do was put in a modicum of effort to MySQL to stave off the MariaDB migrations (and from my understanding they've put in quite a bit more than a modicum).
Lastly, Postgres is an interesting player. Migrating from MySQL to Postgres might be a scarier prospect than to MariaDB, but since the Oracle acquisition a lot of MySQL-veterans were looking for something non-MySQL for new projects and in that I get the sense Postgres beat out MariaDB.
I absolutely adore Postgres's tweaks to the SQL language, that dialect is amazing and has served us extremely well. And, since we passed pg10 a while back, the performance tuning you can do on it is pretty amazing.
Do you mean additions to the SQL standard, or bits of the standard that MySQL doesn't implement, or something else?
The reason i ask is that i also enjoy writing SQL for PostgreSQL, but as far as i know, i am sticking to standard SQL. Perhaps there are things i'm missing, or things i like which i haven't realised are nonstandard!
We shot ourselves in the foot a few weeks later with some poorly written RLS policies, but it was overall a smooth experience.
https://mariadb.com/kb/en/mariadb-vs-mysql-compatibility/
It doesn't sound too bad. The incompabilities seem to be mostly stuff like not being able to generally use replication from MySQL to MariaDB or vice versa. But I would guess that's not a very common case anyway: most users are either developers that want their software to work with both MariaDB and MySQL (which can be achieved by sticking to the very large intersection of supported features), or they are users that want to switch from MySQL to MariaDB (which seems well-supported). Running a mix of MariaDB and MySQL servers and expecting to be able to replicate between them seems like a particularly uncommon setup (though maybe it's useful during a migration).
Arguably MariaDB made the correct decision to fix some MySQL 5.7 bugs that we were unwittingly relying upon, but the different behavior caused issues for us all the same.
Rather than worry about MySQL vs MariaDB and whether the one I need is packaged and available for my distro/OS of choice, I reach for Postgres on new projects.
Anecdata: I've been using mariadb as a drop in mysql replacement for over 5 years in production, and it's been working seamlessly.
I'm no DB expert, and perhaps my use case isn't complex enough or written in a highly mysql dependent way - but I felt like someone should chime in since there's not much positivity toward mariadb in this thread so far. I'd be interested to hear from some other people with actual mariadb experience.
I guess any actual incompatibility is in fringe cutting edge features, which is where both databases have diverged.
I recall a Bryan Cantrill talk about how Oracle is this completely amoral machine that just wants to make money, and how that drives their every decision [0]. Is this no longer the case? Or is it, and if so, how does improving MySQL and giving it away for free making Oracle money? Or was it always hyperbole and Oracle is improving MySQL because they want to be nice?
[0] https://www.youtube.com/watch?v=-zRN7XLCRhc&t=2047s, that link starts at the beginning of what's popularly known as "the lawnmower rant", it's delightful.
In Bryan's defense, the lawnmower rant is pretty true- they are a simple company. They focus heavily on making money and abandoning things they aren't in a good position to do so from.
Selling per-cpu-core licenses and support contracts, great! Experimenting on or converting small projects into new markets? Not great. Fleshing out OpenSolaris into a product that could rival linux? Dead end.
Maybe it could have worked out, but the lawnmower didn't care about a product that had too few users to make money from. OTOH, even Facebook uses MySQL... All they need to do is invest enough to maintain market share to get support contracts.
and yes, Oracle is 110% focused on the bottom line. Preferably this quarter
* Permission management on Postgres is much more painful. * The need for an external connection pooler makes postgres more annoying to set up. * Better quality docs on performance tuning MySQL.
but way more flexible and powerful
I only work in the Java world where all application servers have the connection pooling built in, so I never had the need for an external connection pooler.
I believe that developers back in the 90's wanted a way to "drop in" various low and higher cost DBMS systems to their client-server based apps without the need of hiring full-time database sysops.
It can be useful if your program is simple enough to work with both MySQL and SQLite, but often you should just stick with one DB and get to use all its features.
(arguably SQL itself is/was supposed to be that common layer in the first place, but db vendors always want to be able to present users with new features that are not yet standardized)
mysql and MariaDB diverged from versions 5.6 and 10 respectively, although MariaDB can and does still merge some fixes from mysql; oracle don’t do that.
MariaDB and the original InnoDB developers are now doing heavy rewrites with big performance gains, replication options like multi-source, spider for sharding and galera are all built in and actively maintained.
Oracle attempted to extort anyone trying to licence a mysql based product(rip infobright), so infinidb and clustrix, now respectively called columnstore and xpand, have new homes with MariaDB and are core parts of the system. Online schema changes, easy horizontal scale (huge numbers that make db2 and oracle sweat), s3 backed tables, non blocking backups, flashback, versioned tables.
The list goes on, and many industry veterans from ibm, oracle, sybase etc are finding a home there and helping MariaDB grow.
There are new public developer resources and the connectors are feature rich and well loved. There have been a few free online conferences during the pandemic, and MariaDB now has its own place at fosdem not just bundled in with mysql.
If you go enterprise, there isn’t much out there as accessible as maxscale for transaction failover!
MySQL 5.7 supports multi-source replication: https://dev.mysql.com/doc/refman/5.7/en/replication-channels...
> spider for sharding and galera are all built in and actively maintained.
Galera is available in MySQL-compatible binaries from Percona (Percona-XtraDB-Cluster): https://www.percona.com/software/mysql-database/percona-xtra...
MySQL also has their own Paxos-compliant clustering solution (called "Innodb cluster"), first available in 5.7, but much better in 8.0:
https://dev.mysql.com/doc/refman/5.7/en/mysql-innodb-cluster...
I played with Spider in MariaDB 10.3, and it didn't satisfy the requirements we had, and it doesn't seem to have progressed significantly since then.
Yes, it's neat that MariaDB merged it and is keeping it working, but there don't seem to be many use cases where it ends up being significantly better than e.g. multi-source replication (the use cases where you're going to run out of disk, in most cases spider's un-implemented push-down join etc. make it too slow to be practical either).
> Online schema changes,
https://dev.mysql.com/doc/refman/8.0/en/innodb-online-ddl-op...
(including "instant column add")
> easy horizontal scale (huge numbers that make db2 and oracle sweat), s3 backed tables, non blocking backups,
MySQL has had "MySQL Enterprise Backup" for a long time. Percona wrote a similar implementation (XtraBackup), which works for MySQL, Percona, and MariaDB. AFAIK MariaDB copied XtraBackup as mariabackup (not criticising them for doing this, just pointing out that Percona did the original heavy lifting on this).
> flashback, versioned tables
Yep, versioned tables are a nice feature that I don't think are available in any other MySQL-like DB.
> If you go enterprise, there isn’t much out there as accessible as maxscale for transaction failover!
Not even ProxySQL ( https://proxysql.com/ )?
To be clear, I like MariaDB, but Oracle isn't doing a bad job on MySQL. MySQL 5.7 is pretty solid, and they have been improving defaults (while leaving the option to enable compat settings which are necessary when migrating a large deployment between versions), and MySQL 8.0 has some really nice improvements. For some of the best features from each, Percona (either standard Percona 8.0, which gives features like MariaDB's thread-pool, more comprehensive encryption including redo-logs etc., or XtraDB-Cluster to go with Galera instead of Innodb Cluster) offers quite a few benefits/improvements (and is contributing a lot of bugfixes/improvements upstream).
(My team runs quite a big installation, currently running Percona 5.7, and migrating to MariaDB probably won't be practical or justifiable considering replication compatibility which is a requirement to do no-downtime migrations)
Which is a pity, Netbeans is my favourite IDE and still has features hardly replicated in other Java IDEs, including the InteliJ Ultimate edition.
JetBrains would rather sell two licenses than allow for integrated development and debugging of native methods.
I disagree with this
It is fair to say Oracle did not invest in ease of Oracle->MySQL migration but they have been making a steady progress on making MySQL better database for modern applications
MySQL 8.0 was released on 19 April 2018.
>The 8.0 migration has taken a few years so far. We have converted many of our InnoDB replica sets to running entirely on 8.0.
At the scale of Facebook I wonder if they are the largest MySQL user on the planet.
And I take this opportunity to ask, does anyone know how does the MySQL roadmap works? What sort of features are coming or when is 9.0 expected to arrive.
In this regard it is like MacOS X or Windows 10, whatever you prefer where features are shipped without major version change
I have to imagine they use other databases as well, right? We're much smaller than Facebook and we have some Mongo and some Postgres and a mix of Go/Rust/Scala/node.js.
I wonder how many boxes they have dedicated to be being MySQL machines. I wonder how big their tables are and how many writes per second they see during the day.
> With roughly 2.85 billion monthly active users as of the first quarter of 2021
> 1.8 billion of Facebook users (66%) use the app on a daily basis
Say 1 database could store the data + handle the reads/writes for 100,000 users (literally just guessing)
2.85 billion monthly active users / 100k users per server = 28,500 servers/"instances" for MySQL
That's not even counting Kubernetes pods (if they use that) running Docker containers (if they use that) for their API / content serving.
I wonder what their average transactions per second looks like.
For Twitter:
> Every second, on average, around 6,000 tweets are tweeted on Twitter, which corresponds to over 350,000 tweets sent per minute, 500 million tweets per day and around 200 billion tweets per year.
> As of the first quarter of 2019, Twitter averaged 330 million monthly active users
Twitter has 11.5% the MAU of Facebook (330m of 2.85b)? I don't know if 1 tweet can be extrapolated to 1 Facebook like/comment/share/post but if it did, 6k tweets per sec * 8.7x the user base = 52.2k writes per second?
Found this:
> Facebook now has about 30,000 servers supporting its operations, hosts 80 billion photos, and serves up more than 600,000 photos to its users every second.
[0]: https://vitess.io/
> How Google uses Vitess
> Vitess was serving all YouTube database traffic from 2011 to 2019.
[1] https://github.blog/2020-05-20-three-bugs-in-the-go-mysql-dr...
Most product engineers interact with it by querying TAO, which you can read about in various blog posts, but is basically a cache in front of MySQL (this is a vast oversimplification).
You wrote:
"Despite all the hurdles in our migration path, we have already seen the benefits of running 8.0."
May I ask what are the main performance benefits you have measured/noticed?
2 weeks ago was FB use of GraalVM (from Oracle). And now this.
https://news.ycombinator.com/item?id=15160149
> ORA is the elephant's graveyard of software.
> Once something gets bought by them, you know it is done. Slowly, but surely.
> They perform a function akin to the maggots that destroy cadavers in nature. Part of the overall ecosystem.
> ORA stopped being a tech co a while ago, now it is a finance play. Use cash to buy a business for its locked in customers, gut it to squeeze max money out of it until last customer is gone. Rinse, repeat.
I think I'm too young to hate Oracle with a burning passion. I would be very scared of their sales/corporate team, but I mean, even having large contracts with Google or Amazon is difficult to say the least.
MySQL is also going strong after the acquisition. Lots of new features.
They dared sue the small mom&pop shop called Google for going against the Sun license of Java?
After having used their non cloud products 10 years ago, I wouldn't do any business with them. At all.
Tell us more. Ignore the haters please. I'd love to have your insights.
Additionally their cloud servers (and most other services as well) are much cheaper than comparble EC2 instances and every one of their services I've used so far also includes a free tier so you can try them out without paying anything.
All in all pretty pleased so far.
This makes it sound like Oracle created it, when it fact the reality is the opposite: Oracle fought it, and bought Sun just so they could get their hands on MySQL. How did regulators let that happen is beyond me.
There was also Java.
This is some tremendous effort as I see. I wonder how many people work on these evaluations.
Or the times where the transaction isolation just abruptly ends and commits your transaction midway; leaving no chance of a rollback.
Or when you alter a column to a new type and the cast doesn’t work in a few cases and just leaves corrupted garbage on every row.
Or when the replication misses a few transactions and your replica now looks different to your primary.
(These aren’t hypothetical, these are things I’ve seen)
But at least people stopped doing REPAIR TABLE after hard restarts of MySQL. It's been a long time since I last had to do that.
Shaking: https://engineering.fb.com/wp-content/uploads/2021/07/CD21_3...
Not shaking: https://engineering.fb.com/wp-content/uploads/2021/07/CD21_3...
As you deal with more and more rows, it becomes imperative that all of your where clauses hit indexes/indices, but even beyond that, with large enough row sizes, it's not enough to provide fast responses.
I suspect they deal with this in the form of some sort of caching outside of MySQL, but I haven't read into it.
I'd be curious about how you respond to such challenges at the billions or trillions of rows orders of magnitude. Millions can be difficult enough, but beyond that you may have queries that effectively never return if you do not plan.
Related reading:
[1]: https://dba.stackexchange.com/questions/20335/can-mysql-reas...
It is handled by TAO, https://engineering.fb.com/2013/06/25/core-data/tao-the-powe...
Similar story at nearly every large tech company using MySQL, aside from some more recent ones that go for the painful "shove everything in a huge singular AWS Aurora instance" approach :)
My impression too. Very meticulous work, just the facts.
Full disclosure - I'm CEO at Percona :)
Replaced TokuDB with MyRocks but it's totally different => now finally managed to have good ~constant performance insert&deletes (had to test & tune a lot), but "updates" remain a problem (they write a lot as I understand that any update always has to rewrite the entire row).
Using InnoDb instead of MyRocks is NOK for me (problems with deletes and related hole punching + bad that tables can never shrink when stuff gets deleted), I don't see other alternatives... .
I'm now experimenting with other DBs (right now with CockroachDB but it doesn't seem to be very stable, might then try as well Postgres but I'm scared by the lack of SQL-hints to cover worst case scenarios).
oh hi. big fan of you all. xtrabackup and PMM are wonderful tools
Went to dyn.com and the goddamn website is gone, redirects to some corporate Oracle bullshit and PR, and I can't login to that Oracle crap with my dyn.com account and password.
In case any confused people googling for this stumble upon this comment you need to go to: account.dyn.com which they don't tell you on the Oracle page.
You can log in there with your former dyn.com credentials.
Never. F###ing. Again.
(Disclaimer: I started at independent MySQL AB more than ten years ago and now wear an Oracle badge, after wearing Sun for a while)
I haven’t thought about MySQL proper in years, but it is interesting Facebook is moving to MySQL 8 rather than going to MariaDB, which as far as I know, had MyRocks built-in.
Interesting, I've run into a bug in MySQL 5.6 involving select for update where it deadlocked when it shouldn't. I wonder if the two were related.
Are they storing the friend graph in MySQL?
https://github.com/facebook/mysql-5.6
The social graph is indeed stored in MySQL via TAO. A recent white paper about MyRocks is:
https://research.fb.com/publications/myrocks-lsm-tree-databa...
This part is quite interesting. I'd think it will take maybe a day to dump/restore a database with a single 10TB table with no parallelism, at a speed of about 120MB/s. How big is these mysqld instances such that the process will take many days?
Would be really good to see how long the project took and the migration speed they achieved.
Unfortunately, in my experience once you are operating at scale they are expensive, slow and fraught with peril.
The result is that engineering teams often chose to build poorly designed schemas and take on technical debt rather than make a schema change to a core table. This is a terrible anti-pattern!
I'm massively in favour of anything that makes schema changes cheaper and more boring. I really enjoy working with the Django schema migration system for this reason - though it won't help you as much if you need to make schema changes to older versions of MySQL (I've not tried schema changes against 8.0 yet) since you'll likely still need to use GitHub ghost or Percona pt-online-schema-change.
begin tran
..refactor data, drop/create tables..
..create backwards-compatible views..
commit
..against a live database without risking consistencydisclaimer: I work at PlanetScale
Because it makes the migrations much more robust and way easier to develop & test.
If something goes wrong in a migration script, everything is rolled back. You edit the part that caused the error and simply run the whole script again.
And despite of thorough testing, there is always the possibility that it fails when applied in production. You want that migration to be completely successful or not at all.
Think e.g. splitting a table into two (which also includes DML) or moving columns around while creating new foreign keys.
You might not need to put the whole migration into a single transaction, but at least combine some steps into one - but this is only possible if the DDL statements are transactional.
Because I used to have to do that all the time seemingly before I finally got to pick my toolchain and I chose Postgres
"MySQL, an open source database developed by Oracle, powers some of Facebook’s most important workloads. "
Oracle didn't develop MySQL, they bought it... Am I nit-picky here, opinions?
Otherwise, congrats on shipping!
At big companies, sometimes the corporate lawyers are overly picky about wording in blog posts and public presentations, e.g. "make it clearer that MySQL isn't our in-house product" type of thing.
fwiw, several of FB's top database folks originally worked for MySQL AB, so they're well aware of the development history.
> Non-MyRocks Server: Features in the mysqld server that were not related to our MyRocks storage engine were ported.
i.e. things that they haven't shared with the MySQL community but aren't related to the storage layer. Why would/should they keep those private? Considering that RocksDB is open-source, clearly it's unlikely it's because they're 'trade secrets'.
Sorry but there is a difference between "developed" as in originally created and "being developed" which is the case here in relation to Oracle.
Dear Facebook:
Please fix the wording emphasized above ASAP before we revolt here in outrage with your lack of attention to detail. MySQL was developed by relevant open source project contributors (initially, MySQL AB folks), but not by Oracle and even not by Sun Microsystems. MySQL has been in development for ~12 years before Sun acquired MySQL AB. Please set the record straight.
Sincerely,
MySQL user (not currently, but in the past and maybe in the future [though unlikely, because Postgre...] :-)