package
0.0.0-20240122201314-a58f6c6a0d38
Repository: https://github.com/soypete/production-go-examples.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

Build a worker pool

Using the template provided in main.go build a worker pool using what you learned about go channels and goroutines. This example will accept a number of workers as a flag --workers and then use the workers to perform a task. It should take between 10-15 min?

Step 1 build the worker pool

Fill in the func (wp *workerPool) run() to queue up the amount of workers input via command line arguments.

Step 2 running your code

You can run the following exercise code locally with the following command.

go run main.go --workers=2 

Follow-up questions:

  1. is this a parallel or concurrent process?
  2. do we need channels and go routines to write this program? What are advantages and disadvantages?
  3. did you notice any changes in your pprof metrics?
  4. do multiple routines give you any advantage?