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

feat: split js_image_layer into fine grained layers #1712

Merged
merged 1 commit into from
May 10, 2024

Conversation

gregmagolan
Copy link
Member

@gregmagolan gregmagolan commented May 8, 2024

Resolves #1641.

This change splits the output of js_image_layer into 5 layers:

  1. node layer contains Node.js and the node fs patches
  2. package_store_3p layers containers all 3p deps in the .aspect_rules_js package store
  3. package_store_1p layers containers all 1p deps in the .aspect_rules_js package store
  4. node_modules layer contains all node_modules/foo symlinks into the packages tore
  5. app layer contains everything that doesn't fall into any of the above layers

@gregmagolan gregmagolan requested a review from thesayyn May 8, 2024 00:26
Copy link

aspect-workflows bot commented May 8, 2024

Test

All tests were cache hits

190 tests (100.0%) were fully cached saving 51s.


Test

e2e/bzlmod

All tests were cache hits

4 tests (100.0%) were fully cached saving 467ms.


Test

e2e/gyp_no_install_script

All tests were cache hits

2 tests (100.0%) were fully cached saving 693ms.


Test

e2e/js_image_oci

All tests were cache hits

1 test (100.0%) was fully cached saving 9s.


Test

e2e/npm_link_package

All tests were cache hits

2 tests (100.0%) were fully cached saving 845ms.


Test

e2e/npm_link_package-esm

All tests were cache hits

2 tests (100.0%) were fully cached saving 773ms.


Test

e2e/npm_translate_lock

All tests were cache hits

1 test (100.0%) was fully cached saving 73ms.


Test

e2e/npm_translate_lock_empty

All tests were cache hits

1 test (100.0%) was fully cached saving 73ms.


Test

e2e/npm_translate_lock_multi

All tests were cache hits

2 tests (100.0%) were fully cached saving 271ms.


Test

e2e/npm_translate_lock_partial_clone

All tests were cache hits

1 test (100.0%) was fully cached saving 117ms.


Test

e2e/npm_translate_lock_subdir_patch

All tests were cache hits

1 test (100.0%) was fully cached saving 248ms.


Test

e2e/npm_translate_package_lock

All tests were cache hits

1 test (100.0%) was fully cached saving 73ms.


Test

e2e/npm_translate_yarn_lock

All tests were cache hits

1 test (100.0%) was fully cached saving 73ms.


Test

e2e/package_json_module

All tests were cache hits

1 test (100.0%) was fully cached saving 511ms.


Test

e2e/pnpm_lockfiles

All tests were cache hits

6 tests (100.0%) were fully cached saving 2s.


Test

e2e/pnpm_workspace

All tests were cache hits

8 tests (100.0%) were fully cached saving 3s.


Test

e2e/pnpm_workspace_rerooted

All tests were cache hits

6 tests (100.0%) were fully cached saving 2s.


Test

e2e/repo_mapping

All tests were cache hits

2 tests (100.0%) were fully cached saving 451ms.


Test

e2e/rules_foo

All tests were cache hits

2 tests (100.0%) were fully cached saving 393ms.


Test

e2e/vendored_node

All tests were cache hits

1 test (100.0%) was fully cached saving 187ms.


Buildifier      Format

@gregmagolan gregmagolan force-pushed the js_image_layer_split_node_modules branch 5 times, most recently from ed8bd25 to 6727245 Compare May 8, 2024 01:34
@thesayyn
Copy link
Member

thesayyn commented May 8, 2024

I think we should put node and node_modules into same layer as those are less likely to change.

@thesayyn
Copy link
Member

thesayyn commented May 8, 2024

hmm how about; node_modules_links + package_store_3p + node they all go into the same layer, as they won't change frequently?

@gregmagolan gregmagolan force-pushed the js_image_layer_split_node_modules branch 2 times, most recently from 1e4fb86 to 95db098 Compare May 8, 2024 03:03
@gregmagolan
Copy link
Member Author

hmm how about; node_modules_links + package_store_3p + node they all go into the same layer, as they won't change frequently?

They could; node_modules_links include 1p links but won't change as much as the actual contents of the 1p links. Is there a downside to more fine grained layers?

@gregmagolan gregmagolan force-pushed the js_image_layer_split_node_modules branch from 95db098 to 87ed10f Compare May 8, 2024 03:12
@thesayyn
Copy link
Member

thesayyn commented May 8, 2024

Other than network round trip not really, more the better, but i am afraid that we are splitting it too much that it will be confusing.

@gregmagolan
Copy link
Member Author

gregmagolan commented May 8, 2024

Other than network round trip not really, more the better, but i am afraid that we are splitting it too much that it will be confusing.

Its transparent for users of rules_oci tho right since tars = [":layers",], in oci_image. Just the rules_docker example has them listed explicitly and we don't care about rules_docker ease-of-use since that rule set is abandonware now.

@thesayyn
Copy link
Member

thesayyn commented May 8, 2024

Makes sense, i guess this is fine, fine grained layering will give users more power.

@gregmagolan gregmagolan force-pushed the js_image_layer_split_node_modules branch 8 times, most recently from 0f35785 to b66324b Compare May 8, 2024 06:10
@gregmagolan gregmagolan marked this pull request as ready for review May 8, 2024 06:12
@matthewjh
Copy link

Completely agree with fine-grained layering along these lines - it should save a lot of bandwidth and time for orgs that have 100+ services.

Thanks @gregmagolan!

@gregmagolan gregmagolan mentioned this pull request May 8, 2024
21 tasks
@gregmagolan gregmagolan changed the title feat: split js_image_layer into 5 layers feat: split js_image_layer into fine grained layers May 8, 2024
@thesayyn
Copy link
Member

thesayyn commented May 8, 2024

I think this PR has a bad rebase, @gregmagolan could you fix that before i can take a look?

@gregmagolan gregmagolan force-pushed the js_image_layer_split_node_modules branch from b66324b to a1823d0 Compare May 9, 2024 01:37
@gregmagolan
Copy link
Member Author

I think this PR has a bad rebase, @gregmagolan could you fix that before i can take a look?

Ahh yes, the base branch was rebased which messed up the commits. All clean again now.

@gregmagolan gregmagolan merged commit f99cee8 into 2.x May 10, 2024
105 checks passed
@gregmagolan gregmagolan deleted the js_image_layer_split_node_modules branch May 10, 2024 04:31
jbedard pushed a commit to jbedard/rules_js that referenced this pull request May 14, 2024
jbedard pushed a commit to jbedard/rules_js that referenced this pull request May 16, 2024
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

Successfully merging this pull request may close these issues.

3 participants