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

Update NUM_WORKERS calculation to provide more control of memory per worker #1313

Open
KlaasH opened this issue Jun 21, 2023 · 0 comments
Open

Comments

@KlaasH
Copy link
Collaborator

KlaasH commented Jun 21, 2023

On issue #1311, we avoided assigning the full CPU allocation of the larger EC2 instance to the app task because the number of workers is calculated based on how many CPUs there are and we wanted increasing the instance size to result in the same number of workers with more memory each rather than more workers with the same amount of memory each.

Unfortunately, it turns os.cpus().length returns the number of CPUs assigned to the instance, not the allocation assigned to the task, so increasing the instance size did end up just increasing the worker count, not the per-worker memory. If we want to increase the memory per worker, we'll need to make a change to how NUM_WORKERS is calculated. My thought is that we should switch to using os.totalmem() and defining a constant or an environment variable for how much memory to allocate to each worker. Then we could set the worker count as the highest number that provides at least that much RAM per worker.

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

1 participant