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

rw test api Jest memory performance and benchmarks; api test leaking #4360

Open
thedavidprice opened this issue Feb 3, 2022 · 3 comments
Open

Comments

@thedavidprice
Copy link
Contributor

thedavidprice commented Feb 3, 2022

Background

Originally reported by @zygopleural here:

Web memory leak resolved and API memory leak mitigated via:

Because the API memory leak is not fully resolved, we want to benchmark and watch performance as well as keep this issue open for further work toward complete resolution.

This Issue uses the original reproduction with the new benchmarks.

related benchmark issue #4356

Expected behaviour

yarn redwood test should use ~ same heap size for each test unless the user has specifically done something wrong.

i.e. the heap size should not increase with each consecutive test or run (i.e. leak)

What currently happens

rw test web:
The heap size is stable

Note: /web not tested in the reproduction and example below. But stability demonstrated here after config updates

rw test api:
Even after mitigation in #4096 the heap size increases along with quantity of tests

Steps to reproduce

Option 1: Clone the Reproduction Repo

Note: if cloned, do check the version of Redwood packages, which might need upgrading for testing

Option 2. Create new app and run commands

1. Creat App

yarn create redwood-app --typescript test

2. Add some models to ./api/db/schema.prisma

Excuse the silly models, just something quick to generate tests.

model Man {
  id   String @id @default(cuid())
  name String
}

model Woman {
  id   String @id @default(cuid())
  name String
}

model Boy {
  id   String @id @default(cuid())
  name String
}

model Girl {
  id   String @id @default(cuid())
  name String
}

model Dog {
  id   String @id @default(cuid())
  name String
}

model Cat {
  id   String @id @default(cuid())
  name String
}

3. Generate some tests

yarn redwood generate sdl --crud man
yarn redwood generate sdl --crud woman
yarn redwood generate sdl --crud boy
yarn redwood generate sdl --crud girl
yarn redwood generate sdl --crud dog
yarn redwood generate sdl --crud cat

4. Run tests

yarn redwood test --logHeapUsage

Benchmarks as of v0.44

Initial test (watch mode)

Screen Shot 2022-02-02 at 5 19 38 PM

Second Run (watch

Screen Shot 2022-02-02 at 5 20 09 PM

mode)

Third Run (watch mode)

Screen Shot 2022-02-02 at 5 20 24 PM

@callingmedic911
Copy link
Collaborator

callingmedic911 commented Feb 24, 2022

EDIT: Moved to #4569

@callingmedic911
Copy link
Collaborator

callingmedic911 commented Feb 24, 2022

Just realised I was supposed to put details in #4356 (Closed now). This issue is related to api. Moving my comment to a separate issue.

@pi0neerpat
Copy link
Contributor

pi0neerpat commented Apr 12, 2022

Brb downloading more RAM
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

4 participants