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