Skip to content

NX 17 slow cache restore #21037

Description

@SebastianPodgajny

Current Behavior

After migration to NX 17.2.8 from 16.8.1 I noticed that library build from cache is very slow

Expected Behavior

If nothing changed in lib restore from cache should be fast

GitHub Repo

No response

Steps to Reproduce

  1. Run nx run lib:build
  2. Run nx build for same target again
  3. Compare with 16.8.1

Nx Report

Node   : 20.10.0
OS     : darwin-arm64
npm    : 10.2.3

nx (global)        : 17.2.8
nx                 : 17.2.8
@nx/js             : 17.2.8
@nx/jest           : 17.2.8
@nx/linter         : 17.2.8
@nx/eslint         : 17.2.8
@nx/workspace      : 17.2.8
@nx/angular        : 17.2.8
@nx/cypress        : 17.2.8
@nx/devkit         : 17.2.8
@nx/eslint-plugin  : 17.2.8
@nx/plugin         : 17.2.8
@nx/storybook      : 17.2.8
@nrwl/tao          : 17.2.8
@nx/web            : 17.2.8
@nx/webpack        : 17.2.8
typescript         : 5.2.2
---------------------------------------
Community plugins:
@compodoc/compodoc    : 1.1.19
@ngrx/component       : 16.0.1
@ngrx/component-store : 16.0.1
@ngrx/effects         : 16.0.1
@ngrx/router-store    : 16.0.1
@ngrx/schematics      : 16.0.1
@ngrx/store           : 16.0.1
@ngrx/store-devtools  : 16.0.1
@storybook/angular    : 7.6.7
---------------------------------------
Local workspace plugins:
	 @xyz/workspace-plugin

Failure Logs

Nx 16.8.1 195ms

ng build common

   ✔    2/2 dependent project tasks succeeded [2 read from cache]

   Hint: you can run the command with --verbose to see the full dependent project outputs

 ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————


> nx run common:build  [local cache]

Building Angular Package

------------------------------------------------------------------------------
Building entry point '@xyz/common'
------------------------------------------------------------------------------

------------------------------------------------------------------------------
Building entry point '@xyz/common/keyboard'
------------------------------------------------------------------------------

------------------------------------------------------------------------------
Built Angular Package
 - from: /Users/WebstormProjects/libs/common
 - to:   /Users/WebstormProjects/dist/libs/common
------------------------------------------------------------------------------

Build at: 2024-01-05T14:26:43.691Z - Time: 1427ms


 ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 >  NX   Successfully ran target build for project common and 2 tasks it depends on (195ms)

   Nx read the output from the cache instead of running the command for 3 out of 3 tasks.

Nx 17.2.8 4s

ng build common

   ✔    2/2 dependent project tasks succeeded [2 read from cache]

   Hint: you can run the command with --verbose to see the full dependent project outputs

 ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————


> nx run common:build  [existing outputs match the cache, left as is]

Building Angular Package

------------------------------------------------------------------------------
Building entry point '@xyz/common'
------------------------------------------------------------------------------

------------------------------------------------------------------------------
Building entry point '@xyz/common/keyboard'
------------------------------------------------------------------------------

------------------------------------------------------------------------------
Built Angular Package
 - from: /Users/WebStorm/libs/common
 - to:   /Users/WebStorm/dist/libs/common
------------------------------------------------------------------------------

Build at: 2024-01-05T15:29:06.002Z - Time: 1515ms


 ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 >  NX   Successfully ran target build for project common and 2 tasks it depends on (4s)

   Nx read the output from the cache instead of running the command for 3 out of 3 tasks.


### Package Manager Version

_No response_

### Operating System

- [X] macOS
- [ ] Linux
- [ ] Windows
- [ ] Other (Please specify)

### Additional Information

_No response_

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions