Closed jkmassel closed 1 year ago
Also unrelated to this PR 😄 I'm wondering if it's possible to reach the same speed as awscli.
Also unrelated to this PR 😄 I'm wondering if it's possible to reach the same speed as awscli.
Yeah this is a great point, and part of what #40 was meant to solve 😅. We're using far less CPU now, but we're still downloading from the accelerated endpoint (if it's available on the bucket).
The next step would be to do what awscli
does, which is connection multiplexing. It's actually not too difficult to do, but we'll need HTTP range requests, a way to stitch the files together at the end, and a way to resolve multiple progress objects to display the status. None of it is hard necessarily, but it is a bit tricky. Right now I'm aiming for simplicity and reliability over speed, but it's definitely a future opportunity!
I guess as an addendum – we could cheat and do what Xcodes does, which is use aria2
to manage the download. But that adds complexity which I'm not a huge fan of.
Not sure if URLSessionDownloadTask
has native support of making concurrent HTTP range requests. But I have a feeling that Apple may not go this extra mile. 🥲
do what Xcodes does, which is use aria2 to manage the download
Neat. I didn't know Xcode does this.
But that adds complexity which I'm not a huge fan of.
Was the concern around adding a dependency that's outside of this Swift Package's control? Or there are more?
do what Xcodes does, which is use aria2 to manage the download
Oh – I was referring to https://github.com/RobotsAndPencils/xcodes 😁
Was the concern around adding a dependency that's outside of this Swift Package's control? Or there are more?
So the main issue is that it's not a library you can just embed, it's a separate CLI app that would need to be pre-installed on the VM hosts. Not a huge thing since our automations already can do brew install
but IMHO that would be a layer on top of this if it's available, and it'd still need to fall back to a solid (but slower) default.
Not sure if URLSessionDownloadTask has native support of making concurrent HTTP range requests. But I have a feeling that Apple may not go this extra mile. 🥲
This is correct, alas!
Adds a console output helper that'll make it easier to properly print status messages, errors, and warnings.
Subsequent PRs will use it further.
To Test:
swift run hostmgr vm image remote download xcode-14
, ensure it correctly displays progressswift run hostmgr benchmark network
, ensure it correctly displays progress