Skip to content

IPC message contents don't scale well with large monorepos #33995

@abejfehr

Description

@abejfehr

Current Behavior

When running many quick tasks with a lot of logs in CI (jest tests) on a really large monorepo (2000+ projects), despite having a really large machine (128-core CPU) at a modest parallelism (21), stdout messages were frequently dropped from tasks, and tasks seemed to take longer than expected to run.

Upon further investigation, some tasks were waiting ~20+ seconds before they could even start, but then the task would finish in the expected ~2 seconds.

Turns out that the main NX process is spending all its time serializing taskGraph, which gets sent via IPC to all the child processes like this, but taskGraph is 140MB+ in our repo for full runs.

Expected Behavior

Every child process shouldn't need to receive taskGraph, especially if taskGraph is large, and especially if you're not making use of batch executors.

To mitigate for myself I'm planning on patching NX to just send an empty taskGraph instead. The tests still run and in less than half the time as before.

GitHub Repo

No response

Steps to Reproduce

  1. Have a very large project with tons of dependencies, etc
  2. Run many tasks in parallel
  3. See the main NX process suffer because it's spending so much time trying to serialize and send taskGraph

Nx Report

NX   Report complete - copy this into the issue template

Node           : 24.11.1
OS             : darwin-arm64
Native Target  : aarch64-macos
pnpm           : 10.26.0

nx (global)            : 22.0.0-canary.20251015-f37c13b
nx                     : 20.8.1
@nx/js                 : 20.3.1
@nx/jest               : 20.3.1
@nx/eslint             : 20.3.1
@nx/workspace          : 20.3.1
@nx/devkit             : 20.3.1
@nx/eslint-plugin      : 20.3.1
@nx/module-federation  : 20.3.1
@nx/playwright         : 20.3.1
@nx/plugin             : 20.3.1
@nx/react              : 20.3.1
@nx/react-native       : 20.3.1
@nx/vite               : 20.3.1
@nx/web                : 20.3.1
@nx/webpack            : 20.3.1
typescript             : 5.8.3

---------------------------------------
Registered Plugins:
@nx/playwright/plugin
@nx/playwright/plugin
@nx/playwright/plugin
@nx/playwright/plugin
---------------------------------------
Community plugins:
@nx/s3-cache : 2.0.1
---------------------------------------
Cache Usage: 178.98 KB / 46.04 GB
---------------------------------------
The following packages should match the installed version of nx
  - @nx/[email protected]
  - @nx/[email protected]
  - @nx/[email protected]
  - @nx/[email protected]
  - @nx/[email protected]
  - @nx/[email protected]
  - @nx/[email protected]
  - @nx/[email protected]
  - @nx/[email protected]
  - @nx/[email protected]
  - @nx/[email protected]
  - @nx/[email protected]
  - @nx/[email protected]
  - @nx/[email protected]

To fix this, run `nx migrate [email protected]`

Failure Logs

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions