News for hackers. Stuff that matters.
Re:Making EC2 boot time 8x faster by cjk2 on Thursday May 23, 2024 @11:28AM (#40455913)
I'm mostly just running the (Go) compiler on my laptop which is considerably faster than on docker and considerably cheaper than the server...

I mean an ass end M3 macbook has the same compile time as an i9-14900k. God knows what an equivalent Xeon/Epyc costs...

Re:Making EC2 boot time 8x faster by immibis on Thursday May 23, 2024 @11:36AM (#40456032)
Maybe your container isn't set up right - Docker contains run directly on the host, just partitioned off from accessing stuff outside of themselves with the equivalent of chroot. Or it could be a Mac-specific thing. Docker only works that way on Linux, and has to emulate Linux on other platforms.
Re:Making EC2 boot time 8x faster by cjk2 on Thursday May 23, 2024 @12:20PM (#40456626)
Why would I use docker? You don't have to use it. I'm just generating static binaries.

Does anyone understand how to do stuff without containers these days?

Re:Making EC2 boot time 8x faster by rfoo on Thursday May 23, 2024 @02:46PM (#40458339)
Because you just said:

> which is considerably faster than on docker

And we are curious why it is like so because we not only understand how to do stuff without containers, we also understand how containers work and your claim sounds off.

Re:Making EC2 boot time 8x faster by cjk2 on Thursday May 23, 2024 @03:46PM (#40459066)
I don't understand what you are saying.

I'm saying it is slower on docker due to container startup, pulling images, overheads, working out what incantations to run, filesystem access, network weirdness, things talking to other things, configuration required, pull limits, API tokens, all sorts.

Versus "go run"

Re:Making EC2 boot time 8x faster by immibis on Thursday May 23, 2024 @10:50PM (#40462375)
But usually it's not "considerably". Obviously setting up the container environment takes time but it should be well under a second per build.
Re:Making EC2 boot time 8x faster by rfoo on Friday May 24, 2024 @10:41AM (#40466749)
Wow! You are right! Running go build on host instead of container is 1.16 times faster! A whopping 435ms difference! Amazing!

    /tmp/gitea $ hyperfine -p 'go clean -cache' 'make backend' 'docker run --rm -v $PWD:/build -v $HOME/.go:/go -w /build golang:1.22.3 make backend'
    Benchmark #1: make backend
      Time (mean ± σ):      2.766 s ±  0.021 s    [User: 8.429 s, System: 1.590 s]
      Range (min … max):    2.732 s …  2.800 s    10 runs

    Benchmark #2: docker run --rm -v $PWD:/build -v $HOME/.go:/go -w /build golang:1.22.3 make backend
      Time (mean ± σ):      3.201 s ±  0.034 s    [User: 9.9 ms, System: 7.7 ms]
      Range (min … max):    3.135 s …  3.235 s    10 runs

    Summary
      'make backend' ran
        1.16 ± 0.01 times faster than 'docker run --rm -v $PWD:/build -v $HOME/.go:/go -w /build golang:1.22.3 make backend'
(For incremental build, tested with `hyperfine --warmup 1 'make backend' 'docker run --rm -v $PWD:/build -v $HOME/.go:/go -v $HOME/.cache/go-build:/root/.cache/go-build -w /build golang:1.22.3 make backend'` it's 812.9 ms vs 1.146s.)
Re:Making EC2 boot time 8x faster by skydhash on Thursday May 23, 2024 @01:44PM (#40457669)
I’m using VMs these day because of conflicts and inconsistencies between tooling. But the VM is dedicated to one project and I set it up just like a real machine (GUI, browser, and stuff). No file sharing. It’s been a blast.
Re:Making EC2 boot time 8x faster by yjftsjthsd-h on Thursday May 23, 2024 @12:05PM (#40456456)
Right, they said they're on a macbook so unless they're going out of their way to run Linux bare-metal it has to use a VM. And AIUI there are extra footguns in that situation, especially that mapping volumes from the host is slower because instead of just telling the kernel to make the directory visible you have to actually share from the host to the VM.

See also: https://reece.tech/posts/osx-docker-performance/

See also: https://docs.docker.com/desktop/settings/mac/

> Shared folders are designed to allow application code to be edited on the host while being executed in containers. For non-code items such as cache directories or databases, the performance will be much better if they are stored in the Linux VM, using a data volume (named volume) or data container.

Re:Making EC2 boot time 8x faster by benwaffle on Thursday May 23, 2024 @03:16PM (#40458774)
Re:Making EC2 boot time 8x faster by cjk2 on Thursday May 23, 2024 @03:41PM (#40459005)
Yep.

And you usually get lumbered with some shitty thing like github actions which consumes one mortal full time to keep it working, goes down twice a month (yesterday wasn't it this week?), takes bloody forever to build anything and is impossible to debug.

Edit: and MORE YAML HELL!