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

Add rebar_parallel pool, use in DAG scans #2768

Merged
merged 2 commits into from
May 15, 2023

Conversation

ferd
Copy link
Collaborator

@ferd ferd commented Jan 23, 2023

This addresses #2767 by creating a pool mechanism in rebar_parallel that keeps as similar of an interface as possible as the queue mechanism, with the one caveat that it allows the asynchronous creation of tasks rather than requiring them all at start time.

The mechanism is not tested super deeply, which is probably a mistake, but I wanted to get a reviewable PR first.

The mechanism is also added to the rebar_compiler_dag module to cover use cases that were handled by spawning an unbounded number of processes before, which would cause problem with low file descriptors being allocated and lots of files being used and open in parallel. The pool mechanism puts an upper bound on processing but also on resource usage.

So this PR may also come with a performance regression, and if so we'd want to override the default 1-per-scheduler pool options to use a lot more and hit a middleground in performance vs. resource usage.

@ferd ferd changed the title Add rebar_parallel pool, use in DAG scans WIP: Add rebar_parallel pool, use in DAG scans Jan 23, 2023
@ferd ferd changed the title WIP: Add rebar_parallel pool, use in DAG scans Add rebar_parallel pool, use in DAG scans Jan 26, 2023
@tsloughter
Copy link
Collaborator

Have you gotten around to check any performance numbers?

@ferd
Copy link
Collaborator Author

ferd commented Feb 12, 2023

I've found nothing significant on my own devices, I get more variation across runs than across implementations, but I no longer have a significant code base on my usual development path.

This addresses erlang#2767 by creating
a pool mechanism in rebar_parallel that keeps as similar of an interface
as possible as the queue mechanism, with the one caveat that it allows
the asynchronous creation of tasks rather than requiring them all at
start time.

The mechanism is not tested super deeply, which is probably a mistake,
but I wanted to get a reviewable PR first.

The mechanism is also added to the rebar_compiler_dag module to cover
use cases that were handled by spawning an unbounded number of processes
before, which would cause problem with low file descriptors being
allocated and lots of files being used and open in parallel. The pool
mechanism puts an upper bound on processing but also on resource usage.

So this PR may also come with a performance regression, and if so we'd
want to override the default 1-per-scheduler pool options to use a lot
more and hit a middleground in performance vs. resource usage.
@ferd ferd merged commit cc0c1a9 into erlang:main May 15, 2023
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

Successfully merging this pull request may close these issues.

None yet

2 participants