fortran-lang / playground

An interactive Fortran playground
MIT License
34 stars 12 forks source link

Consider smaller base docker image #10

Closed everythingfunctional closed 2 years ago

everythingfunctional commented 2 years ago

It ought to be possible to use a more minimal docker image as the base, rather than needing a whole linux distro.

Referencing comment from #2.

awvwgk commented 2 years ago

Alpine is known as one of the smallest distros, not sure how well GFortran works with musl-libc instead of GLIBC, though.

certik commented 2 years ago

I think it works, I think we use gfortran with alpine at the CI for LFortran.

milancurcic commented 2 years ago

As I understand it, the base image Is always based on some "whole" Linux distro. Here's a summary of current latest sizes for popular distros:

$ docker images
REPOSITORY    TAG       IMAGE ID       CREATED        SIZE
debian        latest    d2780094a226   2 weeks ago    124MB
ubuntu        latest    27941809078c   4 weeks ago    77.8MB
alpine        latest    e66264b98777   6 weeks ago    5.53MB
fedora        latest    98ffdbffd207   8 weeks ago    163MB
centos        latest    5d0da3dc9764   9 months ago   231MB

CentOS is the most bloated one. I think it makes sense to go with the distro that has the leanest base image, that gives you the tools that you need, and that you're comfortable working with.

That said, I don't think the size in memory meaningfully impacts the startup time. All of these containers start on my computer in about the same time: 0.7 s.

If a container is spun up for each request, the container startup time will be the bottleneck for all response times. For modern web apps, this is too long because the time is noticeable. For longer-running programs (> few seconds) it may not matter, but for simplest stuff a-la "hello world" that most newcomers would first try it would be too long. ~0.1 s response time is reasonable and close to appearing instantaneous, which is what we should aim for. For this reason, it's possible that Docker is not a tool that fits this problem.

Would you consider compiling and running Fortran code in a chroot instead of a Docker container, as proposed by @everythingfunctional on an earlier call?

ashirrwad commented 2 years ago

I'll try implementing using chroot and also try executing on a container thats already running. I've made the image size smaller ~ 162MBs. I think keeping a container running would be easier to host compared to chroot. But we'll use the one thats the quickest. I'll get back with the results.

everythingfunctional commented 2 years ago

Addressed by #12.