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

db method to get all non-stopped workers #3036

Closed
djmitche opened this issue Jun 11, 2020 · 5 comments · Fixed by #3509
Closed

db method to get all non-stopped workers #3036

djmitche opened this issue Jun 11, 2020 · 5 comments · Fixed by #3509

Comments

@djmitche
Copy link
Collaborator

services/worker-manager/src/worker-scanner.js needs to scan non-stopped workers to see what they're up to. Right now, it scans all workers and just ignores those with a 'stopped' status, but that's pretty slow. Let's write a function that returns just the necessary columns, and add an index on state while we're at it.

@djmitche
Copy link
Collaborator Author

Note that this should not ignore stopping!

@djmitche
Copy link
Collaborator Author

In our discussion we were thinking of using a different DB function for src/provisioner.js, but looking at the seen function there, it

  • sums capacity by state and worker pool
  • tracks seen providerIds for each worker pool
  • only cares about non-stopped workers
    It's probably easier to continue to do this in JS with the updated method described in this issue, than to implement a custom DB function that does all of the above.

@imbstack
Copy link
Contributor

The fact that currently we're looping over the workers table to calculate the existing capacity is probabyl causing us to over-provision slightly when the table is modified by the scanner concurrently to us counting in the provisioner. Let's bump the priority of doing this query as described here.

@djmitche djmitche added the db label Jul 27, 2020
@djmitche
Copy link
Collaborator Author

djmitche commented Aug 6, 2020

@imbstack should this end up in the current sprint?

@imbstack
Copy link
Contributor

imbstack commented Aug 6, 2020

I didn't add it at first since it seemed slightly off-topic and doesn't fit nicely into either epic but I think it will happen as part of my refactor so I'll add it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Postgres Migration Phase 2
  
Awaiting triage
Development

Successfully merging a pull request may close this issue.

2 participants