‫Pun.
‫I've been getting told a lot recently not to worry about getting the D.B. Postgres running in a docker
‫container that it may be better to keep the DB on bare metal thoughts especially with replication.
‫OK so if you're running your DBS today on bare metal and they're working fine then you've got to ask
‫yourself are you container rising for just because it seems cool or you container rising for a specific
‫reason to gain something you need.
‫Right.
‫Databases are probably They run great in containers.
‫I should say that also gate lots of containers are running databases.
‫I run on my databases in containers when I have to.
‫The option I prefer is to just use the cloud hosting of the database for themselves.
‫In other words if it's on a W.S. and I can use RDX for their own solution I'd rather do that.
‫I'd rather not have to run and maintain my own database servers because most of us are not full time
‫DB as the cloud engineers that run the cloud tend to be better DB days and we are.
‫So I always prefer running my databases in cloud stuff right.
‫That being said if this is just a personal project or if you're not allowed to do that or if you have
‫very very specific reasons not to price should not be one of them because I in most cases can clearly
‫argue that it's going to be cheaper for you to host that on their storage in their environment because
‫you're going to get automatic redundancy you're going to get better logging and monitoring out of it
‫out of the gate and otherwise you have to do all that yourself.
‫And if you don't do all that yourself you're probably more expensive than the cloud storage itself.
‫So just the hosting itself may be more expensive than a bare metal server but you cost something to
‫the organization and you managing all this stuff yourself costs something.
‫So I would much rather get my time back to work on other things that maybe the cloud doesn't do great
‫for me and one of things they can do well is databases.
‫So that being said if need to run your databases a database in bare metal and a database on that same
‫bare metal in a container will not be any difference in performance.
‫There is with with the exception of a very few rare cases in the way that maybe your volumes work.
‫And as long as you're properly storing your database logs and in volumes themselves and assuming that
‫that volume is on the same storage that you had in the bare metal case you know because obviously storage
‫Io would change if you moved the file somewhere else then everything will be the same.
‫There is no layer of emulation or delay or some sort of shim in the middle of a container.
‫It's bare metal it's running on the host OS right.
‫So if that host OS and that host
‫kernel are on bare metal that it's gonna get bare metal performance and I can say this with confidence
‫because I did this in fact over on my Docker resources page
‫if you search HP e HP there's a white paper that I did a couple of years ago with Docker and Hewlett-Packard
‫HP Hewlett-Packard Enterprise I think is what that stands for.
‫And we did a my sequel performance across three different scenarios using databases one like one database
‫one database engine in a VM and then multiple victims on a single host.
‫Right.
‫Which is the cloud model most people.
‫That's the model they do the traditional model or having a few VM with many containers all running a
‫separate my single instance.
‫So that means fewer OS is but the same number of overall my sequel engines or running that same number
‫of my sequel engines on bare metal in containers without any virtualization.
‫Right.
‫So we did three different models that were most likely the models that you would use as you move from
‫traditional vacuums to containers and without a doubt bare metal wins hands down.
‫It wins in terms of performance and wins in terms of management overhead because you only have one OS
‫now instead of potentially eight or more OS is depending on how many mice equal volumes you create.
‫It also saves you lots of space and memory resources because you don't have to run each OS and use you
‫know gigs of RAM just to run the operating systems over and over again.
‫Right.
‫So if you think about efficiency it was way better on my bare metal.
‫That's containers running in bare metal.
‫If I'd have run that database on bare metal without a container then I probably wouldn't want to run
‫multiple database engines on that same OS.
‫Right.
‫So now if you're not using containers on bare metal you must either one need all the resources of that
‫one physical machine.
‫Right.
‫So maybe it gets a really large database or you're just not able to fully utilize the resources of it
‫because you're not able to stack up you know five different my single instances all on the same bare
‫metal.
‫So that's the advantage I see in containers is it allows you to discreetly isolate separate database
‫engines all in the same bare metal.
‫And why not.
‫When I do that if you have access to very metal then you're willing to do that.
‫So I would not go running and putting Postgres into containers just because I thought would cool it
‫was cool.
‫I would definitely come up with a list of pros and cons and a pro is it's isolated.
‫You can add more things to it like more containers and you have to worry about them conflicting with
‫each other.
‫And but if your database is going to have dedicated hardware and it's not going to have any sharing
‫of resources then maybe the container isn't necessary.
‫Maybe you can get away with that now eventually.
‫Everything you have.
‫Once they're all in containers you're going to wish that everything else was in containers too.
‫Right.
‫You're gonna have all your management tools looking for containers.
‫So there's pros and cons there.
‫Right.
‫I wouldn't just go running into the container land but I certainly would not say that taking something
‫from an OS and then putting it in a container on that OS to me doesn't usually change the performance
‫at all.
‫It's really the same process on the same OS.
‫It's just has a security boundary around it.
‫Now that limits its resource access potentially and it limits its ability to do other things on the
‫machine.
‫All right.
‫Hopefully that helps narrow down but that's a great question about databases and if you're interested
‫more definite go check out those a couple of white papers there on my Docker page and at Brett Fisher
‫dot com slash doctor and you can read about their mental performance versus the In Performance for databases.