# Pool Go Routines To Process Task Oriented Work

DevFeed: [Pool Go Routines To Process Task Oriented Work](<https://devfeed.tech/articles/pool-go-routines-to-process-task-oriented-work-22072.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2013/09/pool-go-routines-to-process-task.html>)

Published: 2013-09-14T00:00:00Z

Content type: article

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [threadpools](<https://devfeed.tech/topics/threadpools.md>), [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [scheduling](<https://devfeed.tech/topics/scheduling.md>)

Tags: [applications](<https://devfeed.tech/tags/applications.md>), [ardan-labs](<https://devfeed.tech/tags/ardan-labs.md>), [bandwidth](<https://devfeed.tech/tags/bandwidth.md>), [blog](<https://devfeed.tech/tags/blog.md>), [channel](<https://devfeed.tech/tags/channel.md>), [cpu](<https://devfeed.tech/tags/cpu.md>), [go](<https://devfeed.tech/tags/go.md>), [go-programming](<https://devfeed.tech/tags/go-programming.md>), [go-runtime](<https://devfeed.tech/tags/go-runtime.md>), [golang](<https://devfeed.tech/tags/golang.md>), [goroutines](<https://devfeed.tech/tags/goroutines.md>), [impact](<https://devfeed.tech/tags/impact.md>), [less](<https://devfeed.tech/tags/less.md>), [manage](<https://devfeed.tech/tags/manage.md>), [number](<https://devfeed.tech/tags/number.md>), [operating-system](<https://devfeed.tech/tags/operating-system.md>), [pattern](<https://devfeed.tech/tags/pattern.md>), [performance](<https://devfeed.tech/tags/performance.md>), [performance-tuning](<https://devfeed.tech/tags/performance-tuning.md>), [processing](<https://devfeed.tech/tags/processing.md>), [programming](<https://devfeed.tech/tags/programming.md>), [queue](<https://devfeed.tech/tags/queue.md>), [queues](<https://devfeed.tech/tags/queues.md>), [resources](<https://devfeed.tech/tags/resources.md>), [storage](<https://devfeed.tech/tags/storage.md>)

## AI overview

A Go work pool limits and reuses goroutines so task processing does not overwhelm available resources. In the described pattern, the main routine submits 100 tasks; the pool queues them and assigns each to an available goroutine, which returns to the pool when finished. The goroutine count and queue capacity can be configured to tune performance. The excerpt argues that launching goroutines without limits can slow work and harm system responsiveness, and says tuning should consider both completion speed and the overall impact on the application and platform. The author notes a preference for an unbuffered-channel implementation, but this excerpt does not describe that alternative.

## Source excerpt

After working in Go for some time now, I learned how to use an unbuffered channel to build a pool of goroutines. I like this implementation better than what is implemented in this post. That being said, this post still has value in what it describes. External resource on github.com: https://github.com/goinggo/work On more than one occasion I have been asked why I use the Work Pool pattern. Why not just start as many Go routines as needed at any given time to get the work done? My answer is always the same. Depending on the type of work, the computing resources you have available and the constraints that exist within the platform, blindly throwing Go routines to perform work could make things slower and hurt overall system performance and responsiveness. Every application, system and platform has a breaking point. Resources are not unlimited, whether that is memory, CPU, storage, bandwidth, etc. The ability for our applications to reduce and reuse resources is important. Work pools provide a pattern that can help applications manage resources and provide performance tuning options. Here is the pattern behind the work pool: