5 ms·
Nice work. Here is some feedback: 1. Go has a major bottleneck and that’s the growth of its memory size when it’s under pressure. Templates bloat the memory qu
by dzink 4y ago
Nice work. Here is some feedback:
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.
2. Saw somewhere you had database incremented user ids and other models? Not safe as it allows any bad actor to peruse your user base. Always do UUID as a scramble that can’t be iterated on.
Keep hammering. For everyone who says you don’t need a framework in Go, there are at least a few newbies who learn how to set up and run their Go server and stack from your framework.
- itake 4y ago2/ encrypt your ids before rendering them and decrypt them for queries. No need to store a huge string when int64 does the exact same. Also, nothing wrong with incremental ids. Twitter and fb are doing just fine.
- sethammons 4y agoNot exposing user ids is a good thing. UUIDs may be a bad thing depending on needs. They cause poor locality in storage which can increase seek time.
- 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
- barelyusable 4y ago1) You can also restart the server for 1s every month to achieve the same. Probably unnecessary because there's probably more than 12 features/fixes a year you'll want to push anyway.
- mroche 4y ago> 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... Do you have any references where one could read up on such issues and how to navigate them?
- EvanDotPro 4y ago> Keep hammering. For everyone who says you don’t need a framework in Go, there are at least a few newbies who learn how to set up and run their Go server and stack from your framework. This. A million times this. Please don't be discouraged by any negative responses you get here.
- avinassh 4y ago> 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 any resources or benchmark numbers to back this claim?
- jjice 4y agoDoes #2 actually apply if there's no private data being stored? If posts could be private/unlisted and I could just increment the id to find some, I'd agree with you. Look at HN for example. Everything is public and they use incrementing ids for posts and comments.
- brodouevencode 4y agoAnd it's a bit of security through obscurity. There is a value to to that but for something that's not storing sensitive data then who cares.