Azure / Azure/bicep

Improve efficiency of restore module logic

Open
#10,615 0 comments 0 reactions 0 assignees View on GitHub
investigate
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 2h
Merged PRs (30d)
79

Description

Current implementation to pull modules from OCI Registry acquires a lock after downloading the blobs, instead we should acquire a lock before downloading the blobs so that we are wasting IO resources.

Notice how in [TryWriteModuleContentAsync](https://github.com/Azure/bicep/blob/adeab531f8b39c1bc1d7a3d14008203133578587/src/Bicep.Core/Registry/ExternalModuleRegistry.cs#L39), the lock is acquired but the implementation of [WriteModuleContent](https://github.com/Azure/bicep/blob/adeab531f8b39c1bc1d7a3d14008203133578587/src/Bicep.Core/Registry/OciModuleRegistry.cs#L210) in the OciModuleRegistry class the OciArtifactResult has already been downloaded by the time the function is invoked

Contributor guide

Open the contributing guide

Research direction

Start with TryWriteModuleContentAsync in src/Bicep.Core/Registry/ExternalModuleRegistry.cs and follow its call into WriteModuleContent in src/Bicep.Core/Registry/OciModuleRegistry.cs. Confirm where OciArtifactResult is downloaded and where the lock is acquired; done means the lock is held before blob downloads so concurrent restores do not waste IO.

Written by the indexing model from the issue text.

Assessment

Domain
backend
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.