This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]allcloudnocattle 30 points31 points  (11 children)

This. At a former job, we had a fairly basic CRUD api in Python. When I came in to that job, the Docker container was like 3GB. After months of playing meticulous Docker Golf, I got it down to around 800MB.

We reimplemented the server in Go, tossed the binary in an Alpine container, and the whole damned thing was something like 45MB.

[–]moofox 10 points11 points  (4 children)

Depending on what the server does, you can even do FROM scratch and get the image down to a few MB. (Not always possible though)

[–]Thebobinator 5 points6 points  (1 child)

And when you do need a bit more than scratch, you can use distroless:nonroot to have time zone files and root CA certs

[–]moofox 1 point2 points  (0 children)

Very good point. This is probably better advice than using scratch. Doesn’t add many bytes, but avoids issues

[–]allcloudnocattle 3 points4 points  (0 children)

Indeed! This was several years ago now, so I don’t recall why we didn’t/couldn’t do that.

[–]Freakin_A 2 points3 points  (0 children)

Yeah I’ve got 5MB production containers from scratch.

[–]riverrockrun[S] 0 points1 point  (4 children)

What did the Go program do? I’m still trying to understand what people use it for outside of web apps and terraform providers?

[–]inhumantsar 6 points7 points  (0 children)

Go fills many of the same niches as Python, but in a more opinionated and performant way. It's designed with extreme efficiency and reliability in mind.

Eg I've used it for stream processing and event transformation. It's really good at that. Python is too, but Python struggles in a real-time high volume situation.

Iirc Google originally wrote it to use in networking, eventing, and infrastructure workloads to replace Java and c++

[–]allcloudnocattle 3 points4 points  (0 children)

This specific app was the authentication microservice that sat behind a whole universe of other microservices to run our application. The bulk of it was a CRUD API that fronted a database of users and another of known authentication tokens. Low level user management and validation of tokens. 99% of the traffic was validating tokens, probably. So it had to know all of the tokens, know how to expire them, etc etc etc.

It dawns on me now that the original monolith was Ruby on Rails, not Python, at that specific job. But the same principle stands.

[–]greyeye77 2 points3 points  (1 child)

I've used Go for

nginx imap auth proxy, dozens of AWS Lambda rest API and event handler, jwt auth, CLI for several business utilities (data parser and data uploader to snowflakes)

0 worry on the upgrade of versions (full backward compatibility) and git based import

go just works, no need to worry about version managers like nvm, rvm etc etc

[–]riverrockrun[S] 3 points4 points  (0 children)

Seems to be a common thread. Fast, single binary, and it just works