3 ms·
I actually very recently wrote a project originally as a single binary .net WebAPI, but rewrote it to go because runtime memory usage was comparatively insane.
by JamesSwift 6y ago
I actually very recently wrote a project originally as a single binary .net WebAPI, but rewrote it to go because runtime memory usage was comparatively insane. That is likely WebAPI's fault though, so I'm optimistic about sticking with.net in the future for these single-binary scenarios.
The thing go has though is that single-binary cross-compilation is _much_ easier to grok. It took a lot of reading .net docs to understand what incantations I needed to pass to the compiler.
- aliswe 6y agoWas this on .netcore 2? If yes, then memory usage for moderate apps has gone down significantly. Turns out they just optimized for demanding apps before.
- JamesSwift 6y agoYes, it was on the latest. I even tried enabling 'desktop' mode for memory, which helped but barely. One of my main goals was to have a single binary hosted on heroku free dyno (512mb ram), and this was using ~1gb vs go which idled at ~50mb.
- davidfowl 6y agoWhat was the API doing? 1gb with client GC? I’m assuming a single core as well?
- JamesSwift 6y agoNothing really, it just loaded up a JSON file into memory and then served 2 endpoints to query that structure. I dont have the .net version uploaded, but here is the go version [1]. The 1gb might have been while running load testing on it, I dont remember entirely. It was very consistently hitting it though. [1] - https://github.com/J-Swift/GamesDbMirror-go/blob/master/pkg/server/server.go https://github.com/J-Swift/GamesDbMirror-go/blob/master/pkg/...