Skip to content

[9.3] chore(NA): improve performance of kibana dev/build distributable (#256377)#258261

Merged
mistic merged 5 commits intoelastic:9.3from
mistic:backport/9.3/pr-256377
Mar 18, 2026
Merged

[9.3] chore(NA): improve performance of kibana dev/build distributable (#256377)#258261
mistic merged 5 commits intoelastic:9.3from
mistic:backport/9.3/pr-256377

Conversation

@mistic
Copy link
Copy Markdown
Contributor

@mistic mistic commented Mar 18, 2026

Backport

This will backport the following commits from main to 9.3:

Questions ?

Please refer to the Backport tool documentation

…stic#256377)

Closes elastic/kibana-operations#468

This PR reduces the kibana distributable build time by ~2 minutes
through targeted tool replacements and concurrency improvements.

- **JS/CSS minification:** Replaced gulp-terser and gulp-postcss with
@swc/core (the one used at rspack) and lightningcss (also used at
rspack) for asset optimization. Parallelized Brotli compression across
files. Lowered Brotli quality from 11 to 9.
- **Archive creation:** Replaced archiver with tar-fs + native
zlib.createGzip. Lowered gzip level from 9 to 6.
- **Concurrency tuning:** Scaled asyncForEachWithLimit in
build_packages_task.ts to cpus().length. Added missing default
concurrency to scanDelete. Added mergeMap concurrency caps in scanCopy.
- **Copy-on-Write:** Enabled COPYFILE_FICLONE in scanCopy for instant
reflink copies on supported filesystems.

**Regarding new dependencies:**

**Purpose:** The new dependencies are going to be used in tasks related
with optimizing distributable assets (code and css minification) and
also producing gzip files.
**Justification:** The ones we had before (mainly terser) were not
suited for the job in terms of performance and the new ones are already
aligned with what we will want and use for the new optimizer being
planned itself.
**Alternatives explored:** Those are the ones being used by RSPack
itself which is the technology we want to use for bundling going
forward. No others were explored.
**Existing dependencies:** It does but mostly points to the legacy old
known dependencies used in the webpack environment itself.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Chores**
* Added new JS/CSS tooling and packaging packages, install hook entry,
and automated update rules.
  * Extended license allowlist.

* **Performance**
* Improved parallelism across build steps, capped to CPU count and added
pipeline limits.
* Switched to per-file minification/compression, changed archive packing
flow, and lowered gzip compression level for faster builds.

* **Tests**
* Added integration tests validating archive creation, contents, and
file counts.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 3750017)

# Conflicts:
#	.buildkite/scripts/steps/security/third_party_packages.txt
#	package.json
#	renovate.json
#	yarn.lock
@mistic mistic requested a review from kibanamachine as a code owner March 18, 2026 04:28
@mistic mistic added the backport This PR is a backport of another PR label Mar 18, 2026
@mistic mistic enabled auto-merge (squash) March 18, 2026 04:28
kibanamachine and others added 3 commits March 18, 2026 04:49
…ally, or add an exception to src/dev/yarn_deduplicate/index.ts and then commit the changes and push to your branch
@elastic elastic deleted a comment from elasticmachine Mar 18, 2026
…ally, or add an exception to src/dev/yarn_deduplicate/index.ts and then commit the changes and push to your branch
@elastic elastic deleted a comment from elasticmachine Mar 18, 2026
@mistic mistic disabled auto-merge March 18, 2026 06:18
@mistic mistic merged commit 843e4dd into elastic:9.3 Mar 18, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants