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

feature: enable async sandboxing/digests #7947

Merged
merged 1 commit into from
Jun 13, 2023

Conversation

rgrinberg
Copy link
Member

These seem to speed up builds in practice

Signed-off-by: Rudi Grinberg me@rgrinberg.com

@Alizter
Copy link
Collaborator

Alizter commented Jun 12, 2023

Have you got some benchmarks for the speedup?

@rgrinberg
Copy link
Member Author

We do. Let's see if @snowleopard can share them.

@@ -1,5 +1,8 @@
(env
(_
(env-vars
(DUNE_CONFIG__BACKGROUND_SANDBOXES disabled)
(DUNE_CONFIG__BACKGROUND_DIGESTS disabled))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this diff?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because otherwise the tests aren't deterministic. In particular the ones that rely on --display=short. I'll eventually get rid of that flag in the tests and re-enable this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you saying that before this change builds we're somehow fully deterministic? That seems unlikely.

Copy link
Collaborator

@snowleopard snowleopard Jun 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess they were non-deterministic but perhaps in ways unobservable in current tests. And now non-determinism increases.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, they were deterministic enough for the test output to be reliable. With these toggles enabled, it's no longer the case.

Copy link
Collaborator

@snowleopard snowleopard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Internally, we get ~5% speed up on some builds from background sandboxes, and ~4% speed up from background digests (though this one only when writing into shared cache).

@snowleopard
Copy link
Collaborator

That builds are becoming less deterministic makes me less excited about changing this default. Though probably still makes sense.

@rgrinberg
Copy link
Member Author

That builds are becoming less deterministic makes me less excited about changing this default. Though probably still makes sense.

Yeah, it's regrettable but I think it's a flaw with our test suite rather than the feature. The execution trace of a build that runs external commands isn't deterministic and we rely on it just because it's easy.

@rgrinberg rgrinberg added this to the 3.9.0 milestone Jun 13, 2023
These seem to speed up builds in practice

Signed-off-by: Rudi Grinberg <me@rgrinberg.com>

<!-- ps-id: 0c0e7734-a90d-4b4c-818f-cd6d392c7603 -->
@rgrinberg rgrinberg force-pushed the ps/rr/feature__enable_async_sandboxing_digests branch from 7bbc067 to 1c9a625 Compare June 13, 2023 09:54
@rgrinberg rgrinberg merged commit 90f1d24 into main Jun 13, 2023
39 of 41 checks passed
@rgrinberg rgrinberg deleted the ps/rr/feature__enable_async_sandboxing_digests branch June 13, 2023 09:56
@Alizter
Copy link
Collaborator

Alizter commented Jun 13, 2023

A comment about the use of --display short in the test suite: It can be useful to quickly see what a build has actually done. In some tests if we just remove the argument then we would have to add ls commands checking targets have been built.

Perhaps we could instead log which targets are built and print them in a deterministic way to get the same effect.

@rgrinberg
Copy link
Member Author

Simplest would be to just sort the output from --display short. But we should still avoid relying on it. Even without this issue, the output from it so too unstable between dune versions. It causes a lot of spurious changes.

@Alizter
Copy link
Collaborator

Alizter commented Jun 13, 2023

Maybe its my own personal preference, but I prefer it when I make a change and it changes an unrelated test, since it makes me aware of the scope of the changes. When tests continue to pass without notice we have less information about the original change.

@rgrinberg
Copy link
Member Author

That works when your test suite is small, but quickly breaks down when past a certain size. We've had plenty of bugs slip through our test suite just because the changes that introduced the bug included massive test diffs that nobody bothered to read carefully.

emillon added a commit to emillon/opam-repository that referenced this pull request Jun 23, 2023
CHANGES:

- Validate file extension for `$ dune ocaml top-module`. (ocaml/dune#8005, fixes ocaml/dune#8004, @3Rafal)

- Include the time it takes to read/write state files when `--trace-file` is
  enabled (ocaml/dune#7960, @rgrinberg)

- Add `dune show` command group which is an alias of `dune describe`. (ocaml/dune#7946,
  @Alizter)

- Include source tree scans in the traces produced by `--trace-file` (ocaml/dune#7937,
  @rgrinberg)

- Cinaps: The promotion rules for cinaps would only offer one file at a time no
  matter how many promotions were available. Now we offer all the promotions at
  once (ocaml/dune#7901, @rgrinberg)

- Do not re-run OCaml syntax files on every iteration of the watch mode. This
  is too memory consuming. (ocaml/dune#7894, fix ocaml/dune#6900, @rgrinberg)

- Remove some compatibility code for old version of dune that generated
  `.merlin` files. Now dune will never remove `.merlin` files automatically
  (ocaml/dune#7562)

- Add `dune show env` command and make `dune printenv` an alias of it. (ocaml/dune#7985,
  @Alizter)

- Add additional metadata to the traces provided by `--trace-file` whenever
  `--trace-extended` is passed (ocaml/dune#7778, @rleshchinskiy)

- Extensions used in `(dialect)` can contain periods (e.g., `cppo.ml`). (ocaml/dune#7782,
  fixes ocaml/dune#7777, @nojb)

- Allow `(include_subdirs qualified)` to be used when libraries define a
  `(modules ...)` field (ocaml/dune#7797, fixes ocaml/dune#7597, @anmonteiro)

- `$ dune describe` is now a command group, so arguments to subcommands must be
  passed after subcommand itself. (ocaml/dune#7919, @Alizter)

- The `interface` and `implementation` fields of a `(dialect)` are now optional
  (ocaml/dune#7757, @gpetiot)

- Add commands `dune show targets` and `dune show aliases` that display all the
  available targets and aliases in a given directory respectively. (ocaml/dune#7770,
  grants ocaml/dune#265, @Alizter)

- Allow multiple globs in library's `(stdlib (internal_modules ..))`
  (@anmonteiro, ocaml/dune#7878)

- Attach melange rules to the default alias (ocaml/dune#7926, @haochenx)

- In opam constraints, reject `(and)` and `(or)` with no arguments at parse
  time (ocaml/dune#7730, @emillon)

- Compute digests and manage sandboxes in background threads (ocaml/dune#7947,
  @rgrinberg)

- Add `(build_if)` to the `(test)` stanza. When it evaluates to false, the
  executable is not built. (ocaml/dune#7899, fixes ocaml/dune#6938, @emillon)

- Add necessary parentheses in generated opam constraints (ocaml/dune#7682, fixes ocaml/dune#3431,
  @Lucccyo)
emillon added a commit to emillon/opam-repository that referenced this pull request Jun 28, 2023
CHANGES:

- Validate file extension for `$ dune ocaml top-module`. (ocaml/dune#8005, fixes ocaml/dune#8004, @3Rafal)

- Include the time it takes to read/write state files when `--trace-file` is
  enabled (ocaml/dune#7960, @rgrinberg)

- Add `dune show` command group which is an alias of `dune describe`. (ocaml/dune#7946,
  @Alizter)

- Include source tree scans in the traces produced by `--trace-file` (ocaml/dune#7937,
  @rgrinberg)

- Cinaps: The promotion rules for cinaps would only offer one file at a time no
  matter how many promotions were available. Now we offer all the promotions at
  once (ocaml/dune#7901, @rgrinberg)

- Do not re-run OCaml syntax files on every iteration of the watch mode. This
  is too memory consuming. (ocaml/dune#7894, fix ocaml/dune#6900, @rgrinberg)

- Add `--all` option to `dune rpc status` to show all Dune RPC servers running.
  (ocaml/dune#8011, fix ocaml/dune#7902, @Alizter)

- Remove some compatibility code for old version of dune that generated
  `.merlin` files. Now dune will never remove `.merlin` files automatically
  (ocaml/dune#7562)

- Add `dune show env` command and make `dune printenv` an alias of it. (ocaml/dune#7985,
  @Alizter)

- Add additional metadata to the traces provided by `--trace-file` whenever
  `--trace-extended` is passed (ocaml/dune#7778, @rleshchinskiy)

- Extensions used in `(dialect)` can contain periods (e.g., `cppo.ml`). (ocaml/dune#7782,
  fixes ocaml/dune#7777, @nojb)

- Allow `(include_subdirs qualified)` to be used when libraries define a
  `(modules ...)` field (ocaml/dune#7797, fixes ocaml/dune#7597, @anmonteiro)

- `$ dune describe` is now a command group, so arguments to subcommands must be
  passed after subcommand itself. (ocaml/dune#7919, @Alizter)

- The `interface` and `implementation` fields of a `(dialect)` are now optional
  (ocaml/dune#7757, @gpetiot)

- Add commands `dune show targets` and `dune show aliases` that display all the
  available targets and aliases in a given directory respectively. (ocaml/dune#7770,
  grants ocaml/dune#265, @Alizter)

- Allow multiple globs in library's `(stdlib (internal_modules ..))`
  (@anmonteiro, ocaml/dune#7878)

- Attach melange rules to the default alias (ocaml/dune#7926, @haochenx)

- In opam constraints, reject `(and)` and `(or)` with no arguments at parse
  time (ocaml/dune#7730, @emillon)

- Compute digests and manage sandboxes in background threads (ocaml/dune#7947,
  @rgrinberg)

- Add `(build_if)` to the `(test)` stanza. When it evaluates to false, the
  executable is not built. (ocaml/dune#7899, fixes ocaml/dune#6938, @emillon)

- Add necessary parentheses in generated opam constraints (ocaml/dune#7682, fixes ocaml/dune#3431,
  @Lucccyo)
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

3 participants