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

Poor performance in pnpm monorepo #2

Open
nick-fields opened this issue Dec 11, 2024 · 1 comment
Open

Poor performance in pnpm monorepo #2

nick-fields opened this issue Dec 11, 2024 · 1 comment

Comments

@nick-fields
Copy link

I love the idea of this. I saw the Reddit and Earthly posts and wanted to give it a shot.

Test results were not good in a large pnpm monorepo. The test was simple, 1 setup job and a dependent lint job that relied on setup to cache the dependencies, repeated using both the default GitHub actions/node cache and then ucache. Both on empty caches. When I rerun the workflow (using the Re-run all jobs button in the GitHub UI), the results are the same for ucache but even faster for setup using the default GitHub cache (due to cache hit).

I suspect I'm just missing some configuration somewhere.

Repo

  • Node 18.19.0
  • PNPM 9.4.0
  • 57 workspaces
  • 680MB of dependencies

Results

Actions Cache Ucache
Overall time 11m43s 25m44s
Install job time 2m44s 8m31s
Lint job time 8m46s 16m56s

image

Workflow

name: Ucache Demo
on:
  push:

jobs:
  setup-ucache:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v4
      - uses: pnpm/action-setup@v4
        with:
          version: 9.4.0
      - uses: actions/setup-node@v4
        with:
          node-version-file: ./.nvmrc
      - uses: earthly/setup-ucacher@main
        with:
          log-level: info
      - run: ucacher pnpm install

  setup-actions-cache:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v4
      - uses: pnpm/action-setup@v4
        with:
          version: 9.4.0
      - uses: actions/setup-node@v4
        with:
          node-version-file: ./.nvmrc
          cache: "pnpm"
      - run: pnpm install

  lint-ucache:
    runs-on: ubuntu-22.04
    needs: setup-ucache
    steps:
      - uses: actions/checkout@v4
        with:
          show-progress: false
      - uses: pnpm/action-setup@v4
        with:
          version: 9.4.0
      - uses: actions/setup-node@v4
        with:
          node-version-file: ./.nvmrc
      - uses: earthly/setup-ucacher@main
      - run: ucacher pnpm install
      - run: ucacher pnpm lint-quiet

  lint-actions-cache:
    runs-on: ubuntu-22.04
    needs: setup-actions-cache
    steps:
      - uses: actions/checkout@v4
        with:
          show-progress: false
      - uses: pnpm/action-setup@v4
        with:
          version: 9.4.0
      - uses: actions/setup-node@v4
        with:
          node-version-file: ./.nvmrc
          cache: "pnpm"
      - run: pnpm install
      - run: pnpm lint-quiet

Notes

I see these warnings when any ucache command is run. Maybe some additional config is missing?

[ucacher] cache miss: (env: LOG_LEVEL, different environment variable)
[ucacher] cache miss: (env: INVOCATION_ID, different environment variable)
[ucacher] cache miss: (env: GITHUB_ENV, different environment variable)
[ucacher] cache miss: (env: RUNNER_NAME, different environment variable)
[ucacher] cache miss: (env: SYSTEMD_EXEC_PID, different environment variable)
[ucacher] cache miss: (env: GITHUB_RUN_ATTEMPT, different environment variable)
[ucacher] cache miss: (env: GITHUB_TOKEN, different environment variable)
[ucacher] cache miss: (env: GITHUB_STEP_SUMMARY, different environment variable)
[ucacher] cache miss: (env: GITHUB_JOB, different environment variable)
[ucacher] cache miss: (env: RUNNER_TRACKING_ID, different environment variable)
[ucacher] cache miss: (env: ACTIONS_RUNTIME_TOKEN, different environment variable)
[ucacher] cache miss: (env: GITHUB_PATH, different environment variable)
[ucacher] cache miss: (env: GITHUB_STATE, different environment variable)
[ucacher] cache miss: (env: GITHUB_OUTPUT, different environment variable)
[ucacher] cache miss: (env: JOURNAL_STREAM, different environment variable)
@idelvall
Copy link
Member

I love the idea of this. I saw the Reddit and Earthly posts and wanted to give it a shot.

That's great, thanks for giving it a try and sharing your feedback!

I see these warnings when any ucache command is run. Maybe some additional config is missing?

Yes, you are getting cache misses due to those env entries changing their values across builds. You should ignore them in order to get a cache hit

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

No branches or pull requests

2 participants