Skip to content

Conversation

@dg0yt
Copy link
Contributor

@dg0yt dg0yt commented May 10, 2025

Alternative to #1658.

Curl is still used for artifacts below the max single write limit (5 GB) and for all downloads. Fetching and uploading azcopy via vcpkg-tools.json (microsoft/vcpkg@c178e54) doesn't need azcopy.

@dg0yt
Copy link
Contributor Author

dg0yt commented May 11, 2025

Testing with https://github.com/microsoft/vcpkg/pull/45461/files.
I couldn't validate the size of the uploaded artifacts, but test-upload-artifacts[core,large] should have 6GB of random data after inflating the input files in the CI scripts. Upload:

Feature Test [1/2] test-upload-artifacts[core]:x64-windows
Installing 1/1 test-upload-artifacts:x64-windows@ci...
Building test-upload-artifacts:x64-windows@ci...
D:\a\_work\1\s\scripts/manual-tests/azcopy\test-upload-artifacts: info: installing overlay port from here
-- Installing: D:/p/test-upload-artifacts_x64-windows/share/test-upload-artifacts/mutable
-- Installing: D:/p/test-upload-artifacts_x64-windows/share/test-upload-artifacts/core-1.dat
-- Installing: D:/p/test-upload-artifacts_x64-windows/share/test-upload-artifacts/core-2.dat
-- Skipping post-build validation due to VCPKG_POLICY_EMPTY_PACKAGE
Starting submission of test-upload-artifacts:x64-windows@ci to 1 binary cache(s) in the background
Elapsed time to handle test-upload-artifacts:x64-windows: 7.2 s
test-upload-artifacts:x64-windows package ABI: 268a0572befaf00d6236da269cb8a65e08793ad1026969edeb3e75c7993320e7

Feature Test [2/2] test-upload-artifacts[core,large]:x64-windows
Removing 1/2 test-upload-artifacts:x64-windows
Elapsed time to handle test-upload-artifacts:x64-windows: 1.49 ms
Installing 2/2 test-upload-artifacts[core,large]:x64-windows@ci...
Building test-upload-artifacts[core,large]:x64-windows@ci...
D:\a\_work\1\s\scripts/manual-tests/azcopy\test-upload-artifacts: info: installing overlay port from here
-- Installing: D:/p/test-upload-artifacts_x64-windows_1/share/test-upload-artifacts/mutable
-- Installing: D:/p/test-upload-artifacts_x64-windows_1/share/test-upload-artifacts/core-1.dat
-- Installing: D:/p/test-upload-artifacts_x64-windows_1/share/test-upload-artifacts/core-2.dat
-- Installing: D:/p/test-upload-artifacts_x64-windows_1/share/test-upload-artifacts/large-1.dat
-- Installing: D:/p/test-upload-artifacts_x64-windows_1/share/test-upload-artifacts/large-2.dat
-- Skipping post-build validation due to VCPKG_POLICY_EMPTY_PACKAGE
Starting submission of test-upload-artifacts[core,large]:x64-windows@ci to 1 binary cache(s) in the background
Elapsed time to handle test-upload-artifacts:x64-windows: 15 s
test-upload-artifacts:x64-windows package ABI: 3bbcb06a2c41b514af918756a0657bc44b97109f5aaad19606ea392ab08fb8fe

All feature tests passed.
Waiting for 2 remaining binary cache submissions...
Completed submission of test-upload-artifacts:x64-windows@ci to 1 binary cache(s) in 1.9 min (1/2)
Completed submission of test-upload-artifacts[core,large]:x64-windows@ci to 1 binary cache(s) in 3.7 min (2/2)

Would azcopy upload 6GB in 3.7 min?

Taking a heavy reference from nightly CI (curl):

Completed submission of gdal[archive,aws-ec2-windows,core,curl,expat,freexl,geos,gif,hdf5,iconv,jpeg,lerc,libkml,libspatialite,libxml2,lzma,netcdf,openjpeg,openssl,pcre2,png,postgresql,qhull,recommended-features,sqlite3,webp,zstd]:[email protected] to 1 binary cache(s) in 2.6 min
...
Completed submission of osgearth:[email protected]#1 to 1 binary cache(s) in 6.1 min

So curl uploads can take much longer. (But it is a different workload.)

FTR download works (curl):

The following packages will be built and installed:
    test-upload-artifacts[core,large]:x64-windows@ci -- D:\a\_work\1\s\scripts/manual-tests/azcopy\test-upload-artifacts
Detecting compiler hash for triplet x64-windows...
Compiler found: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.43.34808/bin/Hostx64/x64/cl.exe
Restored 1 package(s) from HTTP servers in 1.3 min. Use --debug to see more details.
Installing 1/1 test-upload-artifacts[core,large]:x64-windows@ci...
Elapsed time to handle test-upload-artifacts:x64-windows: 199 ms
test-upload-artifacts:x64-windows package ABI: 3bbcb06a2c41b514af918756a0657bc44b97109f5aaad19606ea392ab08fb8fe

Would curl download 6GB in 1.3 min? IDK.

@dg0yt
Copy link
Contributor Author

dg0yt commented May 12, 2025

Verified that azcopy makes the difference by bootstrapping once the pristine vcpkg:

Waiting for 2 remaining binary cache submissions...
Completed submission of test-upload-artifacts:x64-windows@ci to 1 binary cache(s) in 2.4 min (1/2)
warning: curl failed to put file to https://vcpkgbinarycachewus.blob.core.windows.net/cache/49116b1ffec82a1808ab97636c66d0ed6474c1999afd27752801f5289c2a7a67.zip?*** SECRET *** with exit code 0 and http code 413.
Completed submission of test-upload-artifacts[core,large]:x64-windows@ci to 0 binary cache(s) in 3.6 min (2/2)
The following packages will be removed:
    test-upload-artifacts:x64-windows
Removing 1/1 test-upload-artifacts:x64-windows
Computing installation plan...
The following packages will be built and installed:
    test-upload-artifacts[core,large]:x64-windows@ci -- D:\a\_work\1\s\scripts/manual-tests/azcopy\test-upload-artifacts
Detecting compiler hash for triplet x64-windows...
Compiler found: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.43.34808/bin/Hostx64/x64/cl.exe
Restored 0 package(s) from HTTP servers in 57.4 ms. Use --debug to see more details.

So with just curl, uploading test-upload-artifacts[core,large] fails as expected, and restoring (what isn't uploaded) fails as expected.

https://dev.azure.com/vcpkg/public/_build/results?buildId=115599&view=logs&j=7922e5c4-0103-5f8f-ad17-45ce9bb98e80&t=8ceef4ed-9be5-594f-e707-4e1dd58a3d21

@dg0yt dg0yt changed the title Use azcopy for large artifacts Use azcopy for uploading large artifacts May 13, 2025
@dg0yt
Copy link
Contributor Author

dg0yt commented May 13, 2025

It seems that azcopy might be much faster than curl also for medium-sized artifacts:

Completed submission of test-upload-artifacts:arm64-osx@ci to 1 binary cache(s) in 7.6 min (1/2)
Completed submission of test-upload-artifacts[core,large]:arm64-osx@ci to 1 binary cache(s) in 3.2 min (2/2)

First is curl 3 GB, second is azcopy 6 GB. (Assuming tools are selected as intented.)

OTOH the remote may have had a weak moment:

Completed submission of test-upload-artifacts:x64-osx@ci to 1 binary cache(s) in 8.1 min (1/2)
Completed submission of test-upload-artifacts[core,large]:x64-osx@ci to 1 binary cache(s) in 19 min (2/2)

@dg0yt
Copy link
Contributor Author

dg0yt commented May 13, 2025

It might be necessary to look at azopy environment variables. There are knobs for tuning concurrency and memory usage:
https://learn.microsoft.com/en-us/azure/storage/common/storage-ref-azcopy-configuration-settings

vcpkg would transfer one file per call. It is not clear to me if it benefits from the concurrency capabilities. But there might be parallel transfers of blocks.

Would vcpkg run multiple instances of azcopy at the same time? This doesn't seem to be the pattern preferred by azcopy.

@dg0yt
Copy link
Contributor Author

dg0yt commented May 20, 2025

I wish this receives review before I I trigger another 1024 rebuilds of llvm and friends.

Copy link
Member

@vicroms vicroms left a comment

Choose a reason for hiding this comment

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

@AugP @BillyONeal @JavierMatosD @ras0219-msft and myself discussed this PR today.

Overall, we prefer this approach using azcopy and have the following requested change:

  • azcopy needs to be added to vcpkg-tools.json so it can be acquired automatically; we should also investigate what dependencies it requires on Linux.

Not a request for this PR, but as a follow up, we would like to see a new provider that always uses azcopy for its increased efficiency. Said provider can also take advantage of the alternate authentication mechanisms (Microsoft Entra ID for example, via az login or env vars). Then we can use that in our own CI instead.

@dg0yt
Copy link
Contributor Author

dg0yt commented May 28, 2025

  • we should also investigate what dependencies it requires on Linux.

BTW this was developed and tested on Ubuntu 22.04.

$ ldd downloads/tools/azcopy-10.29.0-linux/azcopy_linux_amd64_10.29.0/azcopy 
        linux-vdso.so.1 (0x00007ffc737aa000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f1fe6082000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f1fe607d000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1fe5e54000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f1fe60b4000)

@vicroms
Copy link
Member

vicroms commented Jun 9, 2025

We should move to test this on the registry, trial by fire.

@vicroms
Copy link
Member

vicroms commented Jun 13, 2025

Given the testing in microsoft/vcpkg#45461, I think we are ready to move on with this PR.

We can leave the provisioning of Azurite in CI machines to a follow up PR that also adds an azcopy exclusive provider.

const SanitizedUrl& sanitized_url,
const Path& file)
{
auto azcopy_cmd = Command{"azcopy"};
Copy link
Member

Choose a reason for hiding this comment

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

Note: We can't call fetch_tool naïvely here to get azcopy because this is happening on the background / binary cache submission thread.

@ras0219-msft points out that a potential way to reduce complexity here would be adding an explicit azcopy provider which moves the tool fetch up front like we do for the other binary caching backends e.g. awscli.

Copy link
Contributor Author

@dg0yt dg0yt Jun 17, 2025

Choose a reason for hiding this comment

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

IIUC I'm asked to make changes now.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not asking for changes. Just an observation I made in discussion with @vicroms I didn't want forgotten. (@vicroms is "driving" this one)

Copy link
Member

@vicroms vicroms left a comment

Choose a reason for hiding this comment

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

We believe this is OK as-is, the fact that we cannot prefetch azcopy reinforces the necessity for an azcopy exclusive provider, but that is its own follow-up task.

@vicroms vicroms merged commit 59c905a into microsoft:main Jun 17, 2025
7 checks passed
@dg0yt
Copy link
Contributor Author

dg0yt commented Jun 17, 2025

We believe this is OK as-is, the fact that we cannot prefetch azcopy reinforces the necessity for an azcopy exclusive provider, but that is its own follow-up task.

I can look at such a provide ("x-azcopy") soon. I just couldn't do anything when it wasn't clear if this would be merged or not.

@dg0yt dg0yt deleted the azcopy branch June 17, 2025 05:42
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