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

Confused on MaxConcurrency #173

Open
josh-chan opened this issue Dec 18, 2020 · 2 comments
Open

Confused on MaxConcurrency #173

josh-chan opened this issue Dec 18, 2020 · 2 comments

Comments

@josh-chan
Copy link

  • setup a workerpool with 10 Concurrency,
  • I have 5 servers running the worker process
  • most of time, only 1 server is running 10 jobs, other servers are idle

I expect every server has 10 concurrency jobs running. how can I do this?

@josh-chan
Copy link
Author

@taylorchu how about v2 handle this?

@taylorchu
Copy link
Contributor

taylorchu commented Dec 19, 2020

In v2, we don't have perfect load balancing but the workload should be more evenly distributed.

Some details in v2:

  1. because each worker will prefetch multiple jobs in bulk by a fixed amount of execution time (to reduce load on redis and
    kernel system calls), it depends on how the max execution time per job is defined. For example, if we prefetch 60s chunk of jobs, and your max execution time is 10s. each worker goroutine will fetch at most 6 jobs. This might cause the other workers to be idle if you only have 6 jobs in total, but this should be a rare case.
  2. in a normal case, all 5 * 10 = 50 worker goroutines will compete evenly on who can run that 10 concurrent jobs across 5 servers at any given time.

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

No branches or pull requests

2 participants