What would be the best way to handle many I/O connections in GoLang?
I’m trying to make a game server in Go that is planned to handle 1~2k connections at a time. The server will read/send tcp packets. The question is when do I need to use a goroutine? Do I use one goroutine per connection or do I make something like Netty in java? (I know Threads in Java and goroutines in Go are different so that’s why I’m asking here) And do I use a goroutine to dispatch packets (even when using one goroutine per connection because it’s faster I guess?)
Cannot read from Go channel after closing it
I am learning concurrency with Go and I’ve been facing an issue to build a simple concurrent web crawler. The crawling happens in a goroutine (crawl) that is called as many times as the number of URLs to crawl. The URLs to crawl are passed in a channel, and for each crawled page, I extract the title and send it to a resultPage.
Understanding concurrent channel read behavior
I wrote the code below to check the distribution of channel elements between two functions:
How to timeout concurrent calls when iterating through a list of items
I was looking into a problem where I need to process a bunch of items in a list. Now I need only the results from the items which can be processed in the configured time, and other results need to be discarded. I wrote this program and a very simple version of it worked, but scaling up the logic, I got stuck because either the switch case “all done” is always executed, or “timeout” is executed but still gives all results.