Why and How to get control of Concurrency?
This script is going to make you control your code's concurrency. Hi! This is going to be my meticulous attempt to incite the interest and curiosity that piqued in me too, while I was exploring Con...

Source: DEV Community
This script is going to make you control your code's concurrency. Hi! This is going to be my meticulous attempt to incite the interest and curiosity that piqued in me too, while I was exploring Concurrency patterns in Golang. It delineates the key idea behind controlled concurrency, provides deadlock insights, discusses optimisations & presents a correct concurrency control pattern. Prerequisite: Knowledge of Golang syntax, how concurrency works & slight theoretical knowledge of how channels in Go work is useful to get the comprehensive guide work out for you. Would you like to give some thoughts over this question before we start? Ask yourself: Suppose you have 100,000 goroutines working concurrently, and they all do some CPU work, some DB call, some network I/O, what happens? ... What happens to the Memory usage, the GC pressure? What happens to the External system(eg. DB)? Let's mentally simulate this: Each Goroutine starts small (nearly 2KB stack) but 100K -> 200MB+ stac