Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoscale up/down workers #103

Closed
schmidtw opened this issue Sep 29, 2018 · 2 comments
Closed

Autoscale up/down workers #103

schmidtw opened this issue Sep 29, 2018 · 2 comments

Comments

@schmidtw
Copy link
Member

Ideally the outbound sender worker pools should auto-scale up or down based on the work load present in the queue.

Something along the lines of:

  • Initially create 0 workers
  • As requests show up in the channel/queue workers are created
  • As workers no longer are needed (work isn't in the queue) they stop themselves
@schmidtw
Copy link
Member Author

Based on some conversations with @johnabass it is probably best to not try to re-use workers, but spawn goroutines for them instead up to the specified limit (using a semaphore or atomic counter). Then as they complete their work, they decrement the semaphore/atomic counter & simply exit.

CPU costly things to be aware of & should probably be passed in to the new goroutine:

Do check to make sure that the above can be passed safely as to not create synchronization issues.

Lastly, to help us understand if this is a better approach we should qualify the throughput (delivery rate & CPU usage) through testing before & after.

@schmidtw
Copy link
Member Author

We restructured this code so we don't have a worker pool, but instead spawn 1 time use goroutines.

#119

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant