3 ms·
> 1. Go has a major bottleneck and that’s the growth of its memory size when it’s under pressure. Templates bloat the memory quickly and make the site less perf
by ilyt 4y ago
> 1. Go has a major bottleneck and that’s the growth of its memory size when it’s under pressure. Templates bloat the memory quickly and make the site less performant at scale (aka if you put it on Heroku, you’d need more Dinos to support the traffic, which costs more.). Instead of GO templating, you can produce static pages and fill them up with JS Ajax or React, or whatever your front end flavor is and make that call a Go API you produce with the framework instead. This also helps you turn your site into an app if needed as well.
It will most likely be fast enough. If not there are libs that will compile your templates to Go code with very minimal overhead, or templating libraries that are much faster than builtin one.
I'd think adding megabytes of JS garbage just to run site would be opposite of "HN clone"
- Ylmaz 4y agoI have to agree with you. I see this as a tendency for sites to start getting back to basics. Large frontend frameworks often cause more problems than they solve.
- deleted 4y ago[deleted]
- fbdab103 4y agoAmen to that. Half the reason I like this site is it loads instantly. Not showing spinning wheels just to display some text. As for "working at scale", this post itself is id ~35 million. You could likely fit all of that into ram on a modestly sized server.
- ilyt 4y agoIt's idiotic complaint really. I switched from Go templates to pre-compiled ones because of engineering wankery of personal project where I wanted to have page render take less than 1ms, and with templates it took like 3-4ms. Even with something complex at say 50ms per page you're looking at ~200req/sec/core which is a lot of traffic