78 points by go_advocate 6 months ago flag hide 16 comments
jrandom 6 months ago next
I'm really curious to hear more about why Go is a good fit for high-performance backends. Can anyone provide some examples?
gophers_rocks 6 months ago next
Go's simplicity and strong typing make it great for writing high-performance backends. It also has excellent concurrency primitives built-in, which can help reduce the burden of managing complex concurrent systems. For example, many people in the Go community have reported significant wins by re-writing high-throughput web services in Go.
gophers_rocks 6 months ago next
Sure, here are a few links to articles about performance benchmarks that people have done: <https://blog.golang.org/syscall-profiling>, <https://medium.com/@matryer/performance-of-webhooks-in-go-and-ruby-67d1eacfc0b>, <https://www.section.io/engineering-education/performance-benches-go/>. These benchmarks show that Go can handle significant traffic levels even when compared to other high-performance languages and frameworks.
jrandom 6 months ago prev next
Interesting. Can anyone share any real-world numbers about the performance gains they've seen by switching to Go?
anotheruser 6 months ago prev next
I'm also interested in learning more about how Go's concurrency model can help reduce the burden of managing complex systems. Could someone explain this in a bit more detail?
gophers_rocks 6 months ago next
Sure! Go is built with concurrency in mind and includes built-in support for goroutines and channels. Goroutines are lightweight threads that are scheduled and managed by the Go runtime, which makes it easy to write concurrent code without having to worry too much about explicit thread management. Channels provide a way to have a safe place to communicate between goroutines, making it simple to synchronize the execution of multiple communicating goroutines. By combining goroutines and channels, you can easily build highly concurrent systems that are easy to reason about and maintain.
anotheruser 6 months ago next
Thanks, that makes sense! Can anyone talk about their experiences with debugging concurrent Go programs?
delve_coder 6 months ago next
Debugging concurrent Go programs can be challenging, but there are tools available to help. For example, the Delve debugger allows you to step through concurrent Go code and inspect the state of goroutines and channels at each step. It also includes support for adding breakpoints on channel operations, which can be helpful for debugging concurrent code. Additionally, the `go tool race` command can help you detect data races in your code, which can be a common source of bugs in concurrent code.
newbie 6 months ago prev next
What about tooling in general for Go, and especially for building high-performance backends?
gophers_rocks 6 months ago next
Go has a robust ecosystem of tools that can help you build high-performance backends. For example, the Go standard library includes built-in support for network programming, HTTP, raw socket interaction, and more. There are also many third-party libraries available for tasks like database drivers, message queues, and more. For tooling, Docker and Kubernetes have excellent integration with Go and are commonly used for building scalable and reliable backend systems with Go. In summary, Go has a rich ecosystem of tools and libraries that make it a great choice for building high-performance backends.
tracestack 6 months ago prev next
[adding to gophers_rocks] You might also want to look at tools like the go-torch profiler and the go-critic linter. They can help optimize your code and detect any possible performance bottlenecks. I've used them with considerable success on high-performance backends.
go_skeptic 6 months ago prev next
I've heard some criticism about the garbage collector in Go and how it can impact performance. Is that still an issue?
gc_lover 6 months ago next
The Go garbage collector has improved significantly in recent releases. In addition to performance improvements, recent releases have introduced a concurrent garbage collector that runs as a separate thread, which has significantly reduced the pauses caused by garbage collection. Overall, I've found that the benefits of using Go far outweigh any concerns about garbage collection, especially since it's so well-integrated into the Go runtime.
neutral 6 months ago prev next
Is anyone using Go for their high-performance real-time systems?
systems_gopher 6 months ago next
Yes, I am! I've built a high-performance real-time system with Go that handles thousands of events per second. The key is to tune the garbage collector and use built-in "," primitives like goroutines and channels to manage state and reduce locks. It's a bit different than building traditional real-time systems, but the benefits of Go's simplicity and productivity are well worth the effort.
another_systems_gopher 6 months ago prev next
I also build high-performance, real-time streaming applications with Go. For these applications, I use a third-party library for non-blocking I/O, with which I handle streaming data in real-time without blocking other goroutines. This way, I can process thousands of streams in real-time and format them to my heart's content with the ease and expressiveness of Go's concurrency primitives.