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

Reuse test worker processes for better performance. #789

Closed
jamestalmage opened this issue Apr 25, 2016 · 1 comment
Closed

Reuse test worker processes for better performance. #789

jamestalmage opened this issue Apr 25, 2016 · 1 comment
Labels
enhancement new functionality future we'll get back to this eventually performance

Comments

@jamestalmage
Copy link
Contributor

Currently AVA guarantees a fresh process for every test file. This has real benefits, but comes with a hefty performance penalty. The maintainers have discussed, and we have decided to provide a way to opt-in to reusing a process for multiple test files.

General outline

  • Determine how many child processes to use based on os.cpus()

  • Provide a per-file means of opting into the behavior. One idea for such an opt-in mechanism is to simply change the import, and use static analysis to determine behavior.

    // reuses the shared processes with other tests
    import test from "ava/shared"; 
  • Randomize which tests are sent to which process, and in which order (this provides some protection against writing bad tests that interfere with other tests). It might be wise to consider creating a log of that randomized order and saving it to disk so it can be reproduced.

  • Use Node's vm module to provide some protection against cross-test pollution.

Priority

We think this is important, but we are going to defer it for the time being and work on #785 first. Parts of that are required to make this happen anyway. Once that is landed, we will re-evaluate this and begin work on it.

I am locking this issue for the time being. As stated, this is a priority, and we are working towards it. We just don't want the team distracted by bikeshedding on this issue.

@avajs avajs locked and limited conversation to collaborators Apr 25, 2016
@sindresorhus sindresorhus added enhancement new functionality performance future we'll get back to this eventually labels Apr 26, 2016
@novemberborn
Copy link
Member

novemberborn commented Aug 28, 2017

We should have an option to run tests in a sandbox in the main process. We should explore that before running the sandbox inside workers. I've been pruning our issue backlog, there might be an issue for sandbox support already, but if not I'll make sure to open it. Closing this as overly complex for now.


2018-01-9: See #1332 which covers running test files in the same process.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement new functionality future we'll get back to this eventually performance
Projects
None yet
Development

No branches or pull requests

3 participants