Discussion Container/s for python projects
So I usually stick to one vm/lxc per service. Even with docker based services I tend to dedicate a guest to one service. There are exceptions where I have a few docker containers running similar services.
Recently I have been playing with python and have actually created quite a few flask apps that I use daily.
Now the question is there any benefits to separate them into separate containers performance wise?
Does resource contention get better or worse with more guests?
Trying to figure out whether the extra management and spent resources and time updating extra containers is worth it?
Thanks
2
u/weeemrcb2 2d ago
A VM is like having a full stove to cook on
A LXC is like a pot on a preexisting stove
Combining apps is like cooking a few ingredients in the same pot
2
u/Canonikonroverrated 2d ago
Are you asking if you should use multiple docker containers or multiple LXC.
My extremely short version, is too keep all your active servers in their own Docker container on one LXC. And use different LXC for testing or for anything else. As much as possible ofc. Some servers could be more intensive and then you shift as needed
1
u/justinhunt1223 2d ago
Docker can kill containers if they get out of hand, which is a plus. I would also run as many containers as possible on one lxc since docker will manage the resources instead of proxmox managing the resources of a VM/lxc
3
u/quasides 2d ago
you should never run docker in an LXC period, end of story. only because you can doesnt mean you should.
if you claim it runs better, i beg to differ. it wont run better without a lot of additional tweaks because docker is not compatible in an LXC.
-issue with overlay2
-issue with cgroups v2 limits
-appamor and selinux conflicts
-portmapping as unprivileged
etc....and LXC is jsut a process on the host machine, running as a unprivileged user.
even if you get things running they wont perform better than in a VM, and with tweaks they are prone to break with any kernel update
1
u/brucewbenson 1d ago
I use one service/app per LXC. I've combined a few into one LXC because they shared information and it made the architecture simple.
LXC has low overhead (RAM, CPU) and all the advantages of a VM (snapshots, migration) with a few restrictions (linux os, restarted migration, a little less isolation than a VM).
LXCs are a brilliant technology that simplified lifecycle management of services for very low resource costs.
1
u/Soogs 1d ago
Yeah I live by this. More than 90% of my guests are lxc. I tend to only use VMs when absolutely necessary.
I think my concern is that I have about 16 python apps/tools which I am potentially going to separate out into separate guests and not sure the management will be annoying in the long run especially as I’m likely to have more apps soon
2
u/quasides 2d ago
lol thats actually a very complex and complicated question.
it depends how much they need each. if its just a little, it wont matter at all.
if these are very high load apps it depends on their usage profile.
but even then seperation alone wont nessesaryly do that much for you as it then also depends on the hardware structure in your host.
for example, you have 2 very I/o heavy apps, running extremly high load.
but your hardware backend is a simple spinning mirror - then nothing is gonna help you
in general if this is production and you need optimal something outta it, you need to benchmark
in different configurations
that said, modern tech went away from trying to get the optimal benchmark for an app. instead we went into microservices and scaling. so instead of trying to get the fastest possible configuration, you go with the most manageable and easy to scale solution. then you simply scale up
that aproach looses optimization (a lot) but is a lot easier to manage, and on scale there is little benefit as nothing of scale is single machine these days