Live data from Hacker News

Dockerizing MySQL at Uber Engineering

eng.uber.com

91–100 of 107 posts

Re: Dockerizing MySQL at Uber Engineering

#91
post #33

Earlier quoted context omitted.

There are other benefits to docker than just being able to run multiple processes on the same machine. Putting everything you need to build an image using a dockerfile(Then to version control that) is useful. Developers can also grab docker images for databases for their localmachines without any setup. Also consistency with the rest of the stack.

If you don't need containerization and still want those features you mention why not just use Vagrant?

I often use vagrant + docker. It isn't a replacement for docker. Vagrant isn't designed for servers. I want be using the exact same dockerfiles + images on dev machine, as i'm using on production.

I usually use vagrant + docker images running inside the vm. Sometimes however since I often have all my microservices on my machine, which can consume a lot of ram. I don't want be splitting my RAM between a VM.

Re: Dockerizing MySQL at Uber Engineering

#92
post #72

Earlier quoted context omitted.

Doesn't work that way with containers - they can all still have access to all the memory if you are confident you can safely give them access to it (and if you're not, then you certainly can't co-locate them in the same process. But I have yet to deal with a server where adding more RAM was more than a rounding error compared to getting a fast IO subsystem. And running them all on a single server means you need to ta…

> Doesn't work that way with containers - they can all still have access to all the memory It's not a container problem I'm summing up here, it's a DB problem. Well behaved DB software won't grow to boundless limits to manage the workload, it will grow to it's configured limits. Running multiple instances of a DB server means that each DB is going to be hard-coded to a limit which is some fraction of the available me…

> Running multiple instances of a DB server means that each DB is going to be hard-coded to a limit which is some fraction of the available memory.

What you are suggesting then, is setting limits in a way that does not guarantee resources for any given database.

> There are limits even to this, though. The most memory you can get for any single, broadly available instance in AWS is 244 GiB, and its going to cost you an arm and a leg to run. It's not hard to create a dataset which exceeds 244 GiB in size.

Most people don't have databases that large. If you do, perhaps you shouldn't be puting multiple of them in a single instance if you're limited to machines that small.

For comparison, I have servers with dozens of databases that fit into memory on machines with 64GB and less. I also have machines with single databases that need far more. If we need to, we'll provision machines with 1TB-2TB of RAM.

> This isn't something I frequently see being an actual problem, within the same corporation.

It's something I see all the time. Consider that "within the same corporation", people often run databases for a large number of external customers, or need to be able to roll out new versions, or do development and testing on different versions.

I have at least 5 different versions of Postgress sitting on production servers right now due to customers with different requirements and different upgrade cycles. I also have several different versions of MySQL.

Re: Dockerizing MySQL at Uber Engineering

#93

I guess we should train the new generation better so they don't end up as Uber so... tip for any company who gets incredibly successfull: The first thing one has to do is to drop SQL databases as the main data source. The usual choice is to move to Cassandra. It does have build-in sharding AND backup AND multi-master replication AND multi datacenter support AND performances scale linearly with the number of servers.…

Dropping the RDBM and replacing it with something like Cassandra is fashionable, but sounds like bad advice to me.

A quick google gives these stats for Uber[1]:

- 8 million users

- 160 thousand drivers

- 1 million daily rides

- 2 billion rides so far

The biggest data, as stated in [2], is the trip info. They are storing the trip info as a 20kB JSON blob. If you add a custom data type [3] for a trip to PostgreSQL and encode it efficiently (binary, using deltas), you should be able to do much better than the ~3kB they get by using messagepack and zlib, say 1kB.

All that data should easily fit into 4TB. At one million rides per day, one reasonably beefy RDBM server should be able to easily handle that. You can partition the trips table and move the trips that are older than say, 1 month, to a slower disk to save money on disks. That helps with schema migration too: new data uses the new schema, and you use a view on the old data to adapt to the new schema.

I very much doubt you need anything much fancier than that. It would help if people really learned their tools (in this case PostgreSQL) instead of jumping to a different technology at the first problem they run into.

[1] http://expandedramblings.com/index.php/uber-statistics/

[2] https://eng.uber.com/trip-data-squeeze/

[3] https://www.postgresql.org/docs/current/static/xtypes.html

Re: Dockerizing MySQL at Uber Engineering

#94
post #60
post #45

Most of the assumptions in the comments boil down to its a bad idea if you're resource constrained because you'll get much better performance when everythings on one big server with shared ram. However, possibly, their engineering goal was detecting and isolating hotspots and minimizing debug/downtime effort. And possibly they have an infinite pile of cash or at least they're not resource constrained. In that case it…

It's almost 2017. The scaling choices are not limited to Docker vs. bare metal. With their budget, you should be able to clone and scale metal servers within minutes if you wanted to. This is like Tumblr spending $50,000 grand a month on their developer AWS instances while not making any money. Cool but not very practical.

Bare metal is operationally very expensive because someone has to monitor it, back it up, patch it, test it, fix the software when it breaks at 2am, fix the hardware when it breaks at 2am, explain to security that its either full of confidential stuff or not, decommission it years later, and none of that is as standardized as virtualized or containerized stuff.

Also "in the olden days" we had prod servers but shared dev and test servers. Now a days you just spin up resources assuming your ops is flexible enough. I'll spin up a test image to eliminate one bug and then destroy it, no sweat. In theory you can do that with metal but the accounting must be weird. You could make a pool of bare metal test boxes for people to use as they please, I guess...

I also like spinning up new images for software upgrades. Oh, a new version of the database, here's a new image, test it out.

Some of it is organizational hacking. After a few legendary disasters procedures will be formulated where standing up new iron takes interdepartmental meetings and signing off with the network and security and ops teams and the data center guy has to sign off on the thermal and electrical loads and power points all over the place. In comparison, you wouldn't make someone changing a cell in a spreadsheet go thru all that, right? So you deploying a virtual image is just clicking a harmless little button, as long as you operate under a blanket agreement with ops, infosec, networking, etc... At least until enough legendary disasters inevitably happen that clicking "create" on a virtual image requires weeks of time and at least 4 signatures and 3 departmental meetings of micromanagement. Hopefully we'll invent something new by then.

Re: Dockerizing MySQL at Uber Engineering

#95
post #93

I guess we should train the new generation better so they don't end up as Uber so... tip for any company who gets incredibly successfull: The first thing one has to do is to drop SQL databases as the main data source. The usual choice is to move to Cassandra. It does have build-in sharding AND backup AND multi-master replication AND multi datacenter support AND performances scale linearly with the number of servers.…

Dropping the RDBM and replacing it with something like Cassandra is fashionable, but sounds like bad advice to me. A quick google gives these stats for Uber[1]: - 8 million users - 160 thousand drivers - 1 million daily rides - 2 billion rides so far The biggest data, as stated in [2], is the trip info. They are storing the trip info as a 20kB JSON blob. If you add a custom data type [3] for a trip to PostgreSQL and…

As a rule of thumbs, putting 5TB of data -that are growing exponentially- in a single box is always a terrible idea.

You're gonna hit all kind of limits with the RDBMS software and the special hardware that will be required.

Cassandra will handle the sharding automatically, it will have multiple instances with always one available for your applications, it will handle replications across datacenters all around the world, it will have dependable performances that can scale linearly with the specs you give it, it will allow you to do maintenance while online, it will let you add remove and refresh nodes.

A bigger RDBMS has none of these qualities. It's a one trick pony that will die when either the hardware or the software will reach a limit, then your whole site will be down. Even if you know what needs to be done to avoid the disaster, you can't do it because the RDBMS is a SPOF and every maintenance you perform is called "downtime".

Short term = Postgre/MySQL because it's easier and it gets the job done. Long term = Cassandra because it's dependable.

Re: Dockerizing MySQL at Uber Engineering

#96

Database servers, whether MySQL or PostgreSQL or NoSQL ones like CouchDB should never be dockerized. This is a use case where it is inappropriate to use Docker at all. This is a case where the db server should use the entire resources of a single server and for managing that server (and its replicas or other cluster members) you use a tool like Ansible or Chef or Puppet. And you need to learn that management tool wel…

Why? There are tons of advantages of using docker that's not just for running multiple processes on a single machine. You can still gain advantages from just installing a single database container on a big server + docker volumes.

Being able to version control image creation scripts, being able to pull a identical image for both dev/production is useful and quicker than trying to use puppet on dev machines, the fact you can now use your docker deployment infrastructure for all services, and not have exceptions for things.

Whats the disadvantage? No one has explained this to me.

Re: Dockerizing MySQL at Uber Engineering

#97
post #76

This article shows so little understanding of the software they are using that it frankly makes me a bit mad. Based on my experience as a MySQL DBA, I feel I can safely say that this method of running databases does not scale, and Uber will need to do even more engineering here before too long. Of course, that might be mitigated by the extreme amount of data sharding Uber is doing, but their data will only grow, and…

I feel like a lot of their engineering blog posts are patting themselves on the back a bit prematurely. Here's an article I wrote last year about a blog post they put up about their approach to geofencing which I was not particularly impressed with https://medium.com/@buckhx/unwinding-uber-s-most-efficient-s...

Interesting article - thanks for sharing it. I've had some limited involvement as a GIS expert brought into assist the IT department in dealing with a geofencing solution they agreed to use with various ride sharing companies that use the facility I am employed at.

I can't say much but there were multiple issues that could have been easily avoided with a basic understanding of GIS - I have no doubt that some of it was due to the IT department at my employer but am also incredibly surprised that any GIS staff at the ride share companies would have agreed to what was implemented.

Re: Dockerizing MySQL at Uber Engineering

#98
post #93

Earlier quoted context omitted.

Dropping the RDBM and replacing it with something like Cassandra is fashionable, but sounds like bad advice to me. A quick google gives these stats for Uber[1]: - 8 million users - 160 thousand drivers - 1 million daily rides - 2 billion rides so far The biggest data, as stated in [2], is the trip info. They are storing the trip info as a 20kB JSON blob. If you add a custom data type [3] for a trip to PostgreSQL and…

As a rule of thumbs, putting 5TB of data -that are growing exponentially- in a single box is always a terrible idea. You're gonna hit all kind of limits with the RDBMS software and the special hardware that will be required. Cassandra will handle the sharding automatically, it will have multiple instances with always one available for your applications, it will handle replications across datacenters all around the wo…

> As a rule of thumbs, putting 5TB of data -that are growing exponentially- in a single box is always a terrible idea.

Storage capacity is also growing exponentially: Samsung is shipping a 15TB SSD (albeit at $10000), Seagate has previewed a 60TB SSD.

> You're gonna hit all kind of limits with the RDBMS software and the special hardware that will be required.

The limits of RDBMs are well understood. You don't need any fancy hardware for this use case. A couple of Xeons, as much RAM as you can afford and a RAID of SSDs (or possible spinning disks, it doesn't look like Uber is doing anything too fancy).

SPOF: you have slave replicas running that can take over if something goes wrong with the master.

You don't have to take down an RDBM to do maintenance. DDL statements are transactional in PostgreSQL.

The automatic sharding of Cassandra is nice, when you need it. Of course, Uber's use case seems like it lends itself to easy geographic sharding when you're using an RDBM, if needed.

In the end, I'd rather deal with a mature well-understood technology like an RDBM compared to a 5 year old technology like Cassandra (release 1.0 in 2011). You obviously prefer the opposite. To each its own.

Re: Dockerizing MySQL at Uber Engineering

#99
post #98

Earlier quoted context omitted.

As a rule of thumbs, putting 5TB of data -that are growing exponentially- in a single box is always a terrible idea. You're gonna hit all kind of limits with the RDBMS software and the special hardware that will be required. Cassandra will handle the sharding automatically, it will have multiple instances with always one available for your applications, it will handle replications across datacenters all around the wo…

> As a rule of thumbs, putting 5TB of data -that are growing exponentially- in a single box is always a terrible idea. Storage capacity is also growing exponentially: Samsung is shipping a 15TB SSD (albeit at $10000), Seagate has previewed a 60TB SSD. > You're gonna hit all kind of limits with the RDBMS software and the special hardware that will be required. The limits of RDBMs are well understood. You don't need an…

If you can't get the hardware neither on AWS nor Google nor SoftLayer. I'd consider that exotic enough.

Don't get me wrong. I know vertical scaling and I've done it before. I'd take an old school DBA who understands Oracle over a random junior speaking only NoSQL to everything.

For the majority of use cases (including where I am now), it's easier to pick the right technology (Cassandra) even if we have to learn and later teach it around, than it is to find someone who can really do 10TB PostgreSQL and spreads the knowledge.

Of course, if you have extensive experience with PostgreSQL, that may skew the choice heavily to the other direction ;)

Re: Dockerizing MySQL at Uber Engineering

#100
post #92

Earlier quoted context omitted.

> Doesn't work that way with containers - they can all still have access to all the memory It's not a container problem I'm summing up here, it's a DB problem. Well behaved DB software won't grow to boundless limits to manage the workload, it will grow to it's configured limits. Running multiple instances of a DB server means that each DB is going to be hard-coded to a limit which is some fraction of the available me…

> Running multiple instances of a DB server means that each DB is going to be hard-coded to a limit which is some fraction of the available memory. What you are suggesting then, is setting limits in a way that does not guarantee resources for any given database. > There are limits even to this, though. The most memory you can get for any single, broadly available instance in AWS is 244 GiB, and its going to cost you…

> does not guarantee resources for any given database

Correct. Instead it gives the most resources to the pages in all of the databases which are accessed and used the most. MySQL and InnoDB are remarkably well tuned to ensure that the most often used pages are in memory, where they can be accessed and updated with the greatest performance.

> It's something I see all the time.

We apparently work on very different usecases. Fair enough. Just be aware that your usecase is far from typical. Continuing to argue points across such diverse usecases isn't going to make for a productive discussion.

Post reply on HN