Migrating Facebook to MySQL 8.0
engineering.fb.com
engineering.fb.com
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.
We shot ourselves in the foot a few weeks later with some poorly written RLS policies, but it was overall a smooth experience.
Sadly for me when I tried to make a PoC of Postgres for our eCommerce platform I found that we had violated our constraints and lost data.
That was the day I went from MySQL agnostic to MySQL hating.
It largely doesn’t matter that the defaults could be configured to be more strict. We live in a world where people are trying to avoid hiring sysadmin and that database was set up by a developer. It should not have been a default.
Everyone agrees with this. That's why they changed the default nearly 6 years ago.
Yes, the old default was terrible. But there's no way to change the past, so why complain about it for years and years?
All versions with this bad default have hit end-of-life, what more can be done?
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!
https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sql-mo...
But it's true that PSQL sticks very closely to the standard or only adds on top of it, while MySQL is very uncomformant.
Funnily enough, I actually first used Postgres over MySQL a long time ago when I moved from PHP to NodeJS, and was annoyed that MySQL uses backticks for identifiers while PSQL uses SQL standard double quotes, because in JS multi-line strings (for SQL queries) are also use backticks and I was annoyed by escaping. Sometimes it's the little things...
You could say the same thing about the isolation levels. They are supposed to be platonic ideals, free from any implementation baggage. But the reality is that you can tell that the people that originally defined how they work were mostly (perhaps entirely) thinking about old school two-phase locking.
I'm not a critic of the standard -- it's imperfections (which are arguably contradictions) reflect real world differences that are hard or impossible to resolve. Just pointing out that this is how it is.
The best way to learn the SQL standard is to read the Postgres docs since they clearly call out non-compliances - there is no other easy to access and clear explanation of the SQL standard.
Just using a BSON column for such attributes hits the Pareto 80/20 sweet spot, _and_ I can query against them much more easily than in an EAV schema (far fewer joins).
They're great for when the schema is mostly normalized, but there's just a little bit of denormalized stuff that doesn't warrant completely architecting the schema around it.
And since postgres supports indices on arbitrary expressions you can use CREATE INDEX for the json-queries in your WHERE:
CREATE INDEX ON publishers((info->>'name'));
It would be horribly painful to stick to _just_ SQL/JSON for manipulations, and I have absolutely zero idea what the coverage is in other platforms, but portability isn't completely off the table like it used to be
Other folks have mentioned :: instead of CAST AS (which is really nice when you need to write it a bunch of times) but it's mostly the diverse built-in function set and constraint support that keeps me an enthusiastic Postgres supporter.
PostgreSQL documentation is very good about comparing each feature to the standard.
For example, the SQL standard specifies that triggers fire in the historical order they are added to the table.
PostgreSQL chose to fire them alphabetically.
Technically nonconformant, but in practical terms, far better.
This was surprising for my old tech lead who was sheepish on moving away from MySQL.
He would later refer to the MySQL bindings as “brain dead”
(To be fair, table columns share this characteristic.)
The table columns order is meaningless, but the triggers order is very relevant.
``` INSERT INTO foo SELECT * FROM bar ```
The harder problem however, is order in composite types.
Additionally, modifying a trigger by drop/creating it would change behavior, unless you also drop/create every trigger (in the original order)
And then any second trigger that relies on that value
But I also think that it's unnecessarily problematic to make the order non-deterministic.
It just makes easier to understand what happens when triggers are invoked, without having to actually force specific cases by direct experimentation.
I did not even know that the standard prescribed a FIFO order, looks like a pretty bad idea to me, actually.
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.
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.
Bringing MaximeVM out of research labs into the market as GraalVM.
First RDMS to support Perl and Java as stored procedures.
Join venture with Sun for Network Computer thin clients.
> Fleshing out OpenSolaris into a product that could rival linux?
Every OpenSolaris sales is one sale less from Unbreakable Linux, so in a day and age where UNIX === Linux, a company like Oracle has chosen what makes more sense monetarly.
I doubt that IBM is getting lots of new AIX customers.
And in the end, except for a timid offer from IBM, no one cared to rescue Sun.
But I guess they must have had at least sane management that tried to keep the existing mindshare of acquired projects (as far as I know many people went from Sun to Oracle directly for example), as well as finding new talent. And also, the acquisitions made sense and were done at a comparatively good price so I guess they are good lawnmowers with long-term plans (but terrible PR)?
The talk was in 2011, Oracle purchased Sun in 2010. So basically their continuous work on OpenJDK has nothing to do with the talk at all.
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.
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.
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.
(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)
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.
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
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
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)
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.
The Spanner team noticeably put out https://cloud.google.com/blog/products/databases/inside-clou... a few years back, which tl;drs that they managed to get a reliable enough network that partitions don't really happen anymore and so you can get both C _and_ A from the CAP theorem. I don't think that Vitess is quite at that level, especially since you can self-host it and thus the devs don't have such network-level uptime guarantees.
I am just speculating here but I doubt that YouTube migrated to Spanner so that they could do cross-server transactions. I would think consolidating the Ops burden into the GCP org and also serving as a trophy "customer" were higher on the list of reasons. But again, just speculating...
> Are cross-server transactions scalable? Would anyone architect a system that did them en masse unless they absolutely 100% had to?
As a long time Vitess user and contributor/maintainer, this perfectly describes the issue. Minimal effort has been put into solving cross shard / 2PC transactions because a well designed system rarely needs it.
https://static.googleusercontent.com/media/research.google.c...
It is designed from the ground-up to be globally distributed. Some other databases like FoundationDB (now owned and killed? by Apple) and CockroachDB were designed to scale across multiple datacenters.
Correction: FoundationDB is alive as open-source again, yay!
- https://news.ycombinator.com/item?id=9259986 - Apple Acquires FoundationDB - March 24, 2015
- Comparison between March 25 and March 14, 2015 - https://web.archive.org/web/20150314231702/https://foundatio... (14th March) > https://web.archive.org/web/20150325003252/https://foundatio... (25th March)
[0]: https://vitess.io/
> How Google uses Vitess
> Vitess was serving all YouTube database traffic from 2011 to 2019.
In this regard it is like MacOS X or Windows 10, whatever you prefer where features are shipped without major version change
If following the guidance set out at https://semver.org, a patch release wouldn't add any new functionality, it would just address bugs in a backwards compatible way. A minor version would introduce new functionality in a way that doesn't violate backwards compatibility.
Quickly scanning the release notes for some of the MySQL 8 versions, they seem to be generally sticking to this; most of the versions fixed some bugs or unintuitive behavior, but it doesn't look like much new functionality has been introduced since 8.0.4, the last release candidate for the major version bump.
* 8.0.12 added INSTANT algorithm for adding new columns to a table
* 8.0.13 added DEFAULT expressions (column default values may now be any arbitrary expression, not just a constant)
* 8.0.16 added CHECK constraints
* 8.0.17 added the CLONE plugin for rapid physical copying of a db
* 8.0.23 added INVISIBLE columns (excluded from SELECT *)
These are just a handful among many others... basically MySQL 8 does not follow SemVer at all, nor does it claim to. (Although personally as a tool developer in the mysql ecosystem, I selfishly wish they did!)
SemVer is an arbitrary versioning scheme, not a universal standard. It's the operator's responsibility to understand the versioning scheme prior to upgrading.
Nobody expects defaults to change between patch/minor versions.
This is another example of how MySQL does not give a flying F about the footguns it leaves lying around.
Putting the onus on the user is not reasonable; especially in a world where we’re trying to reduce toil or get rid of ops completely.
Also my comment above in this subthread wasn't even about defaults. I only mentioned some features added, and you responded saying it's scary and then talking about defaults?
You don't like MySQL, I get it. Regardless of reasons, I don't think your view will change, so why enter every HN thread about MySQL just to repetitively bash MySQL? What's the purpose of this?
The strict mode setting should have been the default since the beginning. It is absolutely unthinkable that it wasn’t, the only justification I can think of is that:
a) it wasn’t built with that in mind and thus was experimental.
b) was not enabled to ease adoption (this is kinda evil, in my personal opinion because it teaches bad habits)
c) was considered a power-user feature, which is ridiculous.
What you’ve said just exemplifies the trend I’ve seen before: MySQL does not care about creating footguns, and people who have bought into the ecosystem like to exhalt that “you’re holding it wrong”- which is absolutely not a good warning.
If you listen to my rambling about the pain I’ve seen, and you still want to use it: at least it’s an informed decision. But pretending that all is well is not ideal, it doesn’t lead anyone to make better software or practices (MySQL) or better developers (because they don’t see footguns before they’ve sprung some self-inflicted wounds on themselves)
I absolutely agree with that. But what's the point in talking about a terrible default that changed nearly 6 years ago, literally over and over again, year after year?
> the only justification I can think of
The real answer is almost certainly "backwards compatibility". Same reason many things in Windows are non-ideal, for example.
Someone made a really bad technical decision early on, but fixing it overnight will break things for an utterly massive number of paying customers, so it can't be rectified without a slow transition plan. It happens.
Yes, it absolutely should have been fixed on a faster schedule regardless, given its importance. But just because it wasn't, doesn't mean that the entirety of the piece of software is hopelessly flawed and everyone involved in its development is an utter cretin. Especially when a piece of software is multiple decades in age and has gone through multiple corporate acquisitions.
> What you’ve said just exemplifies the trend I’ve seen before: MySQL does not care about creating footguns
What I've said? What footguns? I'm asking this honestly: what are you referring to? Let's recap this subthread:
* @taywrobel said "it doesn't look like much new functionality has been introduced since 8.0.4"
* I listed a number of new features introduced in 8.0 point releases, and explained that MySQL 8 is intentionally not doing SemVer
* You said "that's pretty scary" without ever elaborating on which specific thing I said you find scary
* I disagreed, given MySQL's stated written policy of not following SemVer
* You mentioned something about defaults changing (??? this wasn't even a topic I mentioned by that point in the subthread)
Now you're talking about footguns again, but the only one you're mentioning with any specificity was fixed many years ago.
> people who have bought into the ecosystem like to exhalt that “you’re holding it wrong”
Where has anyone said anything remotely like that in this subthread? Are you referring to my statement that the user should understand what's in an upgrade before upgrading? If so, I absolutely stand by that statement; it's utterly crazy to upgrade any database without even glancing at the release notes, let alone having a basic understanding of how the database vendor handles releases and versioning. This is operational basic practices 101, not about "holding it wrong".
And for what it's worth, "people who have bought into the ecosystem" includes a massive chunk of the S&P500 using MySQL as a primary data store. If it's as deficient as you claim, why aren't all these companies going out of business?
Linux?
Can you provide an example of an application-side (IOW, not a DB-infrastructure-type variable) that has changed it's default in a patch version after GA in 5.7 or 8.0?
IIRC, all of the defaults changed in very early non-GA versions.
Is there another level of patches below point releases for backported security patches, or are your options to upgrade to something that adds new features and may be backwards incompatible, leave your system vulnerable to known security wholes, or patch it yourself (or maybe depend on your distro to do itl
As far as I can recall, the vast majority of modern MySQL CVEs have been low severity and/or require the attacker to already be in your private network.
For sake of comparison -- does Postgres backport every security patch to every major.minor tree? And aren't HA Postgres upgrades generally more difficult than MySQL ones since logical replication is less widespread in the PG landscape?
Unless the security fix in question is not applicable to some branch, yes.
https://www.postgresql.org/support/security/ https://www.postgresql.org/support/versioning/
No, because its unecessary (in my experience)
> or are your options to upgrade to something that adds new features and may be backwards incompatible
It won't be backwards incompatible, otherwise they would leave the change for a new minor release.
Why would you not want a new feature (e.g. the new "clone plugin") if it gives you value now without any migration required (because of incompatibilities that may arise if all new features are left for minor versions which are reserved for incompatibilities)?
Assuming that is true, this sounds like a normalcy bias to me (https://en.wikipedia.org/wiki/Normalcy_bias).
> Why would you not want a new feature (e.g. the new "clone plugin")
Because features can introduce bugs or performance regressions. Sure you can say that's rare, but I still might not want to take that risk with some of the most critical infrastructure in my app.
Some examples...
WL#10310 Redo log optimization:
Feb 2018, initial commit 6be2fa0bdbba, landed in 8.0.11 (Apr 2018)
Jun 2018, crash regression fix commit 270d18368650, landed in 8.0.13 (Oct 2018)
Apr 2019, performance regression fix commit 75c4f7161a56, landed in 8.0.18 (Oct 2019)
WL#5655 - InnoDB: Separate doublewrite file to ensure atomic writes:
Dec 2019, initial commit ce14ef911, landed in 8.0.20 (Apr 2020)
Feb 2020, data loss regression fix commit c1bc61dc7, landed in 8.0.20 (Apr 2020)
May 2020, stall regression fix commit 00b284707, landed in 8.0.21 (Jul 2020)
In comparison, Cassandra during the DataStax days was extremely buggy, but at least it tried to follow SemVer. So the operators can follow some simple guideline, e.g. >=2.0.14 is fine, >=2.1.17 is fine, >=2.2.9 is fine. Of course regression can still happen, but that would be an exceptional case.
(Except Project Jigsaw of course, but I'd like to think that he got overruled by his boss)
As for bugs, I will just quote Gil Tene from https://www.theserverside.com/opinion/Dont-ever-put-a-non-Ja...
> Play with them on your laptop, but don't use a single feature, and wait for the LTS.
Personally I think the LTS model is great. Features get rolled out as soon as they are ready, and then get stabilized after being used by early adopters. Meanwhile, production can stay on LTS and continue to get just the necessary fixes.
Operators must test before upgrading. Luckily some third-party software makes this easier, e.g. Percona's pt-upgrade or ProxySQL's mirroring feature.
I'll state again unambiguously, I'm not personally fond of 8.0's release policy of rolling out new features post-GA. But I view it as an annoyance, and at least one with some upsides (not having to wait 2 years for a massive feature dump all at once) rather than being uniformly negative or "pretty scary". Personally I was careful about testing point release upgrades before 8.0, and I'm still careful about it now.
Example from 20 years ago:
> The most popular version numbering scheme stems from the <major>.<minor>.<patchlevel> scheme
— https://ask.slashdot.org/story/01/01/05/0054230/version-numb...
Example from 1997:
> Python versions are numbered A.B.C or A.B. A is the major version number -- it is only incremented for major changes in functionality or source structure. B is the minor version number, incremented for less earth-shattering changes to a release. C is the patchlevel -- it is incremented for each new patch release.
— https://web.archive.org/web/19970501012343/http://www.python...
The average seems to be about 2.5 years between minor releases, so this doesn't seem unusual.
Usually new minor versions are only released if there are: * Changes to database behaviour defaults (e.g. default sql mode) * Deprecation or removal of features * Compatibility changes (changes to replication formats)
New features are fine, as long as they don't introduce regressions in other areas.
Even MySQL 5.7 received some good improvements in the past 18-24 months (not just bug fixes).
I feel this is a really pedantic complaint from someone who either doesn't use MySQL, or wants to hate it for a silly reason.
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.
https://engineering.fb.com/2019/06/06/data-center-engineerin...
Also, that "30,000 servers" number is off by... a lot. No comment on by how many orders of magnitude. :-)
Facebook has purchased 6GW of renewable energy to power its datacenters [1]. Its datacenters have a PUE of about 1.06 last they published (they unfortunately seem to have taken their dashboards down) so that's about 5.6GW of electricity actually powering real load. Some of that will power the networking fabric so we could conservatively estimate 5GW of compute load. The OCP Yosemite v3 platform power budget is a max of 1.5kW [2]. Also conservatively, let's assume a real average 1kW load. I'll leave the division as an exercise for the reader to estimate the number of servers they operate.
1 https://www.google.com/amp/s/www.euronews.com/green/amp/2021...
2 https://www.opencompute.org/documents/ocp-yosemite-v3-platfo...
5000000 kilowatts / 1kW per machine = 5,000,000 machines internationally?
[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.
After having used their non cloud products 10 years ago, I wouldn't do any business with them. At all.
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.
MySQL is also going strong after the acquisition. Lots of new features.
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.
I think you either want it to have more functionality and you choose Postgres, you want a particular performance profile and you pick MariaDB, or you want the enterprise support and you pick Oracle's database. Why you would pick Oracle-supported MySQL today I'm not sure.
PostgreSQL still after all these years has a terrible story when it comes to HA and horizontal scalability. Nothing is built in or supported. And one of the only companies to provide something half decent i.e. Citus is now owned by Microsoft and so that project is now at risk.
At least MySQL has something built-in.
With MySQL group replication, it is pretty easy to set up a HA cluster that allows you to sleep soundly. It can also handle thousands of connections without the need of a connection pooler.
Among the largest users, MySQL (or Percona Server) is chosen far more frequently than MariaDB.
GP mentioned Group Replication, which isn't even available in MariaDB.
I will never forget the arrogance and greed of their legal/sales people. They are bloodsucking sociopaths.
The whole process was shitty, predatory, and abusive.
PowerApps, Power Automate etc. - while not necessarily innovative in a vacuum - are, when you consider they are bringing cloud-based automation and RPC to the (enterprise) masses.
They dared sue the small mom&pop shop called Google for going against the Sun license of Java?
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.
It sounds like Oracle is actually pricing bandwidth at a reasonable price. This is quite a shock, coming from a historical perspective!
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...
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 :)
I haven't used Aurora - what's painful about this approach (apart from potentially being locked-in to AWS / Aurora)?
That said, sharding can be very painful too in other ways. But at least it permits infinite horizontal scaling, and it makes many operational tasks easier since they can be performed more granularly on each smaller shard.
Besides, once you get anywhere near Aurora's storage limit, you'll need to shard anyway. So it really just buys you some time before the inevitable.
It is handled by TAO, https://engineering.fb.com/2013/06/25/core-data/tao-the-powe...
My impression too. Very meticulous work, just the facts.
Never. F###ing. Again.
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.
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.
(Disclaimer: I started at independent MySQL AB more than ten years ago and now wear an Oracle badge, after wearing Sun for a while)
Think "Currently developed by Oracle".
Full disclosure - I'm CEO at Percona :)
oh hi. big fan of you all. xtrabackup and PMM are wonderful tools
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).
This might change everything for me. I'm already using MariaDB+MyRocks and Clickhouse for some special/dedicated tasks, but I was really missing a good DB for normal/typical OLTP tasks.
So far I used (as mentioned above) MariaDb+TokuDB (but the optimizer of MariaDB can be a bit crazy from time to time), had multiple times during the past months thoughts about PostgreSQL but the lack of hints always made me take a step back from it => this addon seems to be exactly what I wished for.
Looks like that my weekend will be all about PG - the last time that I set it up its version number had a single digit => cannot remember anything anymore... .
Again, thanks for the hint :P
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.
I'd much rather use a robust, performant real schema migrations tool though.
begin tran
..refactor data, drop/create tables..
..create backwards-compatible views..
commit
..against a live database without risking consistencythat's what the backwards-compatible views are for
disclaimer: 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...] :-)