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

Export app image and cache image in parallel #1247

Merged
merged 6 commits into from
Dec 14, 2023

Conversation

kritkasahni-google
Copy link
Contributor

Summary

Export cache image and app image in parallel when parallel-export is enabled by platform.

Release notes

Export cache image and app image in parallel when parallel-export is enabled by platform.


Related

Resolves # 1167


Context

Export cache image and app image in parallel when parallel-export is enabled by platform.

cc - credits Woa [email protected] for initiating this work

@kritkasahni-google kritkasahni-google requested a review from a team as a code owner November 14, 2023 23:50
@kritkasahni-google
Copy link
Contributor Author

Issue #1167

@kritkasahni-google
Copy link
Contributor Author

Spec PR buildpacks/spec#380

platform/resolve_inputs.go Outdated Show resolved Hide resolved
@@ -319,9 +319,10 @@ func testExporterFunc(platformAPI string) func(t *testing.T, when spec.G, it spe
h.WithArgs(exportArgs...),
)
h.AssertStringContains(t, output, "Saving "+exportedImageName)

// To detect whether the export of cacheImage and exportedImage is successful
Copy link
Member

Choose a reason for hiding this comment

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

Should we enable parallel export in this test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Taking a look on how to enable that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems to be passing "PASS: TestExporter/acceptance-exporter/0.10/registry_case/first_build/cache/cache_image_case/is_created_with_parallel_export_enabled" -> is this this test enough @natalieparellano ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think latest test-windows is failing due to an unrelated error. It should ideally succeed on retry - I don't have option to retry workflow @natalieparellano . I have added test and fixed warning message for -parallel export option. I will wait for end user testing results to see if we need to make more changes.

return Layer{}, err
}
defer func() {
if closeErr := lw.Close(); err == nil {
Copy link
Member

Choose a reason for hiding this comment

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

Isn't err always nil here?

@natalieparellano
Copy link
Member

This looks good @kritkasahni-google. Thank you for tackling it in all its complexity. I'll report back with the results of some end-user testing.

Co-authored-by: Natalie Arellano <[email protected]>
Signed-off-by: Kritka Sahni <[email protected]>
@kritkasahni-google
Copy link
Contributor Author

This looks good @kritkasahni-google. Thank you for tackling it in all its complexity. I'll report back with the results of some end-user testing.

@natalieparellano Looking forward to test results. I can jump on fixing any issues as soon as you let me know. Thanks for testing!

@kritkasahni-google
Copy link
Contributor Author

I think latest test-windows is failing due to unrelated error -> === NAME TestVersion acceptance_test.go:34: Expected nil: CreateFile C:\Users\RUNNER~1\AppData\Local\Temp\lifecycle-acceptance2810337285\windows-amd64\lifecycle\lifecycle.exe: Access is denied. --- FAIL: TestVersion (45.63s)

Copy link
Member

@natalieparellano natalieparellano left a comment

Choose a reason for hiding this comment

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

Hi @kritkasahni-google - thanks for this. I'm attaching the results of my user-testing - everything works as expected (including cancel, which terminates both export and cache). I tested with the Java/Maven app from the Paketo samples repo. Switching between parallel/not parallel either gives you 1 second faster total build, or 1 second faster access to the app image (while waiting for cache), which makes sense.

@jabrown85 did you want to look at this one again?

|                 | 1st build (average of 3) | 2nd build (average of 3) | Sample log output                                                                                                                                                                                                                                |
| --------------- | ------------------------ | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Parallel export | 3.99                     | 2.95                     | Timer: Exporter started at 2023-12-12T16:07:41Z<br>Timer: Exporter ran for 3.45521449s and ended at 2023-12-12T16:07:44Z<br>Timer: Cache started at 2023-12-12T16:07:41Z<br>Timer: Cache ran for 3.526350332s and ended at 2023-12-12T16:07:44Z  |
| Parallel cache  | 3.72                     | 2.55                     |                                                                                                                                                                                                                                                  |
| Time waiting    | 3.99                     | 2.95                     |                                                                                                                                                                                                                                                  |
|                 |                          |                          |                                                                                                                                                                                                                                                  |
| Seq export      | 2.60                     | 2.27                     | Timer: Exporter started at 2023-12-12T15:28:34Z<br>Timer: Exporter ran for 2.538096476s and ended at 2023-12-12T15:28:37Z<br>Timer: Cache started at 2023-12-12T15:28:37Z<br>Timer: Cache ran for 2.818896323s and ended at 2023-12-12T15:28:40Z |
| Seq cache       | 2.41                     | 1.98                     |                                                                                                                                                                                                                                                  |
| Time waiting    | 5.02                     | 4.25                     |

@kritkasahni-google
Copy link
Contributor Author

Hi @kritkasahni-google - thanks for this. I'm attaching the results of my user-testing - everything works as expected (including cancel, which terminates both export and cache). I tested with the Java/Maven app from the Paketo samples repo. Switching between parallel/not parallel either gives you 1 second faster total build, or 1 second faster access to the app image (while waiting for cache), which makes sense.

@jabrown85 did you want to look at this one again?

|                 | 1st build (average of 3) | 2nd build (average of 3) | Sample log output                                                                                                                                                                                                                                |
| --------------- | ------------------------ | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Parallel export | 3.99                     | 2.95                     | Timer: Exporter started at 2023-12-12T16:07:41Z<br>Timer: Exporter ran for 3.45521449s and ended at 2023-12-12T16:07:44Z<br>Timer: Cache started at 2023-12-12T16:07:41Z<br>Timer: Cache ran for 3.526350332s and ended at 2023-12-12T16:07:44Z  |
| Parallel cache  | 3.72                     | 2.55                     |                                                                                                                                                                                                                                                  |
| Time waiting    | 3.99                     | 2.95                     |                                                                                                                                                                                                                                                  |
|                 |                          |                          |                                                                                                                                                                                                                                                  |
| Seq export      | 2.60                     | 2.27                     | Timer: Exporter started at 2023-12-12T15:28:34Z<br>Timer: Exporter ran for 2.538096476s and ended at 2023-12-12T15:28:37Z<br>Timer: Cache started at 2023-12-12T15:28:37Z<br>Timer: Cache ran for 2.818896323s and ended at 2023-12-12T15:28:40Z |
| Seq cache       | 2.41                     | 1.98                     |                                                                                                                                                                                                                                                  |
| Time waiting    | 5.02                     | 4.25                     |

Thanks @natalieparellano for verifying. @jabrown85 lmk us know if the changes make sense?

@natalieparellano natalieparellano merged commit f8b8669 into buildpacks:main Dec 14, 2023
8 checks passed
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.

2 participants