only by a given function, to perhaps apply threshold or limit the ones that are more time consuming? runtime.NumGoroutine() returns a total count of routines running at a time. So far, I have been able to easily keep track of other routines because the programs are small. But how do you manage, when your programs and no. of other supporting routines grow.
by counting 😅
you can use a goroutine pool to limit concurrency
Thank you. Looking this up.
usually, you don't really care how many goroutine there are, unless it really becomes a problem multiple million goroutines should be fine (if you have the memory to accomodate'em), usually.
I appreciate and agree with this. However, I was thinking of a cases like video encoding or a heavy resource consuming tasks where user generally have an option to limit the number of those running at a time.
goroutine pools 🙂 or semaphores
Awesome.Thanks!
Обсуждают сегодня