2

I do have a dedicated server and I need to create ~200 containers inside it.

Each container will only run a single application and I'm looking for the most efficient way for this in terms of resource usage for the container's itself alone.

I wonder if LXC containers or Docker containers would use less resources as empty container, without considering the resource usage of the applications I'll run?

I want to push the limits of my server to create as many containers as possible so I'm looking for the most resource-efficient way for this.

1

What is the most efficient way for creating hundreds of containers for single apps; Docker?

docker-compose --compatibility up

and then use "replica"

version: '3'
services:
  worker:
    image: dockersamples/your_worker
    networks:
      - frontend
      - backend
    deploy:
      mode: replicated
      replicas: 1000

What is the most efficient way for creating hundreds of containers for single apps; LXC

I do not know of a similar method for LXC. lxc-copy does 1 so you would need a bash script to do 999 clones.

I wonder if LXC containers or Docker containers would use less resources as empty container, without considering the resource usage of the applications I'll run?

Yes. But I doubt it will be a big difference.

I want to push the limits of my server to create as many containers as possible so I'm looking for the most resource-efficient way for this.

Docker max in theory is 1023 on 1 host (but at 1000 I got a performance hit :-X) but if you need more there is a way using macvlan ("... to assign a MAC address to each container’s virtual network interface, making it appear to be a physical network interface directly connected to the physical network.")

-> I made 1000 (just for fun) and used roughly 257Mb. It took 10 minutes to start them and 9 minutes to stop them all.

|improve this answer|||||
  • "I made 1000 and each used roughly 200Mb" - that would be 200GB of total RAM usage. Can I borrow this server some time, or did you mean 200MB in total? :D – Byte Commander Aug 9 '19 at 14:24
  • Thank you for your answer. It looks like I couldn't make myself clear. First of all, I'm not interested how to create containers. I was just basically wondering how much resources would 200 empty docker container vs lxc container use. Anyway, in your answer to this question, you've stated as Yes. But I doubt it will be a big difference. but I've just created 200 lxc containers and they used 15gb of RAM in total as empty containers while 200 docker containers with ubuntu image only used 500mb of RAM in total. What do you think about this? – Marry Jane Aug 9 '19 at 14:26
  • @ByteCommander the 1st >:) But I do have a 1Tb container ;-) (those 1000 costs me 19 euro it seems :-D ) Hmm I can;t make lxc containers (as you can see on my answer D: it is all docker). I would go for docker but I have no other proof then that we did this a few years ago and decided on docker -but- nowadays use cloud engines ;-) – Rinzwind Aug 9 '19 at 14:46
  • Which cloud engines? @Rinzwind – Marry Jane Aug 9 '19 at 14:55
  • All 4 that matter ;-) 70 google clouds that all have a backup on both google (in another zone) and on AWS and a couple that also have a version on Azure. And we have a couple in china (on alibaba cloud with google cloud as backup). – Rinzwind Aug 9 '19 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.