Skip to content

Conversation

@dduportal
Copy link
Contributor

@dduportal dduportal commented Mar 8, 2025

Ref. jenkins-infra/helpdesk#4525

this PR is currently a playground (hence the draft + WiP status) to evaluate if the caching through the S3 PVC is worth it

@dduportal dduportal changed the title wip: first attempt at caching for prep stage wip: attempts at caching Maven local repo Mar 8, 2025
@MarkEWaite
Copy link
Contributor

I would love it if you would be willing to include the JGit 7.2 and Mina SSHD 2.15.0 changes from:

Also no problem if you don't include it, but it would help me know that the changes in those two pull requests are not harmful

@dduportal
Copy link
Contributor Author

I would love it if you would be willing to include the JGit 7.2 and Mina SSHD 2.15.0 changes from:

* [Test Mina SSHD 2.15.0 and JGit 7.2.0 #4663](https://github.com/jenkinsci/bom/pull/4663)

Also no problem if you don't include it, but it would help me know that the changes in those two pull requests are not harmful

I'm not sure to understand your request @MarkEWaite ?
The goal of the PR here is to build a PoC for loading some part of the cache and validate it has no regression using it.

@dduportal
Copy link
Contributor Author

Retrying following @alecharp pointer: running the command mvn -pl sample-plugin dependency:go-offline -Dmaven.repo.local="${CUSTOM_M2_REPO}" to populate a cache based on the list of plugins.

Without using ACP, it tooks around 8m17 to generate a ~1.6Gb maven repo, mapping to a 1.2 Gb tar archive in the S3 PVC.

@dduportal dduportal force-pushed the add-cacher-pipeline branch from 02a1f3c to cc92a25 Compare March 10, 2025 18:22
@dduportal
Copy link
Contributor Author

Retrying following @alecharp pointer: running the command mvn -pl sample-plugin dependency:go-offline -Dmaven.repo.local="${CUSTOM_M2_REPO}" to populate a cache based on the list of plugins.

Without using ACP, it tooks around 8m17 to generate a ~1.6Gb maven repo, mapping to a 1.2 Gb tar archive in the S3 PVC.

With ACP: 2min26

@dduportal
Copy link
Contributor Author

dduportal commented Mar 10, 2025

Retrying following @alecharp pointer: running the command mvn -pl sample-plugin dependency:go-offline -Dmaven.repo.local="${CUSTOM_M2_REPO}" to populate a cache based on the list of plugins.
Without using ACP, it tooks around 8m17 to generate a ~1.6Gb maven repo, mapping to a 1.2 Gb tar archive in the S3 PVC.

With ACP: 2min26

Now it has been bootstrapped: 6s \o/

Let's wait for the result in #4669 (comment) (1.2 instead of 6 Gb file which changes the way S3 behaves - < 5 Gb)

@dduportal dduportal force-pushed the add-cacher-pipeline branch from ce43631 to b0372d6 Compare March 11, 2025 15:26
Signed-off-by: Damien Duportal <[email protected]>
@dduportal
Copy link
Contributor Author

New retry with b0372d6 (and 7b8c4ae) based on @alecharp pointers:

  • Iterate over 3 lines (first PoC have the line specified statically, we could generate the lines from the prep system as future improvement)
  • Expand the dependencies scope to runtime, compile and test

=> resulting m2 local repo is 1.9 Gb, with a 1.6 Gb archive

Copy link
Member

@basil basil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dduportal
Copy link
Contributor Author

jenkins-infra/helpdesk#4442 (comment) FTR

Thanks for the reminder. We had this in mind from the beginning also (you explained it to me during FOSDEM which was a discovery as It helped us understand why the "pre warm" step in "prep" was not sufficient enough).

We did load the cache during all the tests with the following patterns:

  • Ran a (1 line x 50 PCT runs) sequentially with a Maven "go offline" command for each. It generated a 6 Gb archive which is clearly too much.
  • @alecharp helped me to experiment around populating the cache partially with a single or a few command(s) using the "plugin-sample" subproject:
  • First try with 1 line and no scope options (wip: attempts at caching Maven local repo #4667 (comment)) generated a 1.2 Gb archive which was missing 2 lines and test dependencies (at least!). But a good first try which showed promising results on the cache usage.
  • Second try with 3 lines, and adding more scope options (wip: attempts at caching Maven local repo #4667 (comment)) which generated a 1.6 Gb archive: cache usage is still showing good results was used to evaluate the (positive) impact on ACP.

That being said: this cache population is not good enough (as we still had ACP errors even when using it). I want to explore running a modified PCT (3 lines x all PCTs all in parallel) which would only run a basic test to populate the cache without wasting too much machine time then rsync the M2 repo to a shared FS to aggregate all (and limit repetition). Finally, generate the cache archive from the shared FS.

=> Besides the need for many agents, the risk is to have a too big archive at the end. But this could be circumvented by providing the cache in the node VM template (Adding 10 Gb to an AMI is roughly adding 10s to 20s on the VM boot time). It would avoid using S3 or any centralized system (as it would be distributed on each node).

@dduportal
Copy link
Contributor Author

jenkins-infra/helpdesk#4442 (comment) FTR

If it proves worth and scalable, we could explore your proposal by building the cache from many other plugins before entering the BOM.

@dduportal
Copy link
Contributor Author

Closing as the implementation will be somewhere else. Works very well!

@dduportal dduportal closed this Mar 20, 2025
@dduportal dduportal deleted the add-cacher-pipeline branch March 20, 2025 15:27
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