News for hackers. Stuff that matters.
Re:Show HN: A HN clone writen in go by dzink on Sunday March 05, 2023 @05:27PM (#35034827)
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.

Re:Show HN: A HN clone writen in go by ilyt on Sunday March 05, 2023 @06:07PM (#35035209)
> 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"

Re:Show HN: A HN clone writen in go by fbdab103 on Sunday March 05, 2023 @10:23PM (#35037184)
Amen 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.

Re:Show HN: A HN clone writen in go by ilyt on Monday March 06, 2023 @07:29AM (#35040205)
It'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
Re:Show HN: A HN clone writen in go by Ylmaz on Monday March 06, 2023 @06:44AM (#35039888)
I 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.
Re:Show HN: A HN clone writen in go by barelyusable on Sunday March 05, 2023 @07:13PM (#35035790)
1) 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.
Re:Show HN: A HN clone writen in go by mroche on Sunday March 05, 2023 @07:46PM (#35036073)
> 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?

Re:Show HN: A HN clone writen in go by dzink on Sunday March 05, 2023 @09:32PM (#35036843)
We’ve been using Go in production for 7 years, and benchmarking every architectural choice.
Re:Show HN: A HN clone writen in go by gazby on Tuesday March 07, 2023 @11:15AM (#35057078)
Anything more tangible you can share? By every indication I've come across, resource consumption of Go templates being problematic is an outdated notion.
Re:Show HN: A HN clone writen in go by EvanDotPro on Sunday March 05, 2023 @08:26PM (#35036390)
> 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.

Re:Show HN: A HN clone writen in go by avinassh on Sunday March 05, 2023 @09:52PM (#35036992)
> 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?

Re:Show HN: A HN clone writen in go by jjice on Sunday March 05, 2023 @10:34PM (#35037257)
Does #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.

Re:Show HN: A HN clone writen in go by brodouevencode on Monday March 06, 2023 @08:10AM (#35040518)
And 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.
Re:Show HN: A HN clone writen in go by itake on Monday March 06, 2023 @09:13AM (#35041217)
2/ 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.

Re:Show HN: A HN clone writen in go by sethammons on Monday March 06, 2023 @02:41PM (#35046520)
Not 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.