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

Download artifacts concurrently #11244

Closed
yaroot opened this issue Sep 30, 2021 · 7 comments · Fixed by #11531
Closed

Download artifacts concurrently #11244

yaroot opened this issue Sep 30, 2021 · 7 comments · Fixed by #11531

Comments

@yaroot
Copy link
Contributor

yaroot commented Sep 30, 2021

Proposal

Download artifacts concurrently

Use-cases

I put all the jars separately in job artifacts array instead of one giant tarball.

For JVM programs the dependencies accounts for majority of the resulting program and does not change often between builds. This way each build only results in tiny jars for the actual code change, one would not need to delete any build ever.

But the job initialization is slower because now you have a lot of small files to download. I understand this is very specific to jvm (the only case I could think of), and not affecting most use cases, I could have a go if it's deemed worthy.

// example artifacts array

[
  {
    "destination": "local/lib/HikariCP-5.0.0.jar",
    "mode": "file",
    "options": {
      "checksum": "sha256:cfab85c04fcb590ae4cfdbe1b1e87cfd7277c4ba378229422d8e8bce989a97d6"
    },
    "source": "https://artifacts.example.com/cf/ab/85c04fcb590ae4cfdbe1b1e87cfd7277c4ba378229422d8e8bce989a97d6"
  },
  {
    "destination": "local/lib/case-insensitive_2.13-1.1.4.jar",
    "mode": "file",
    "options": {
      "checksum": "sha256:3b0eae646754430caf86c38e9583c9e3b92c227e14f72a840f0629fe84445c68"
    },
    "source": "https://artifacts.example.com/3b/0e/ae646754430caf86c38e9583c9e3b92c227e14f72a840f0629fe84445c68"
  },
  {
    "destination": "local/lib/cats-core_2.13-2.6.1.jar",
    "mode": "file",
    "options": {
      "checksum": "sha256:263d5982aa88702a3c8024d792f9dcc237cd0c6da3cca610c1fcc107c337b49a"
    },
    "source": "https://artifacts.example.com/26/3d/5982aa88702a3c8024d792f9dcc237cd0c6da3cca610c1fcc107c337b49a"
  },
  ...
]

// task command would be `java -cp local/lib org.example.Foo`
@lgfa29
Copy link
Contributor

lgfa29 commented Oct 2, 2021

Thanks @yaroot.

After a quick look, it seems like we could parallelize this loop with Goroutines.

I've placed it in our backlog for us to investigate further.

@rcoder rcoder removed this from Needs Triage in Nomad - Community Issues Triage Oct 7, 2021
@schmichael
Copy link
Member

Just a note to the implementer: we should cap the number of concurrent downloads (3?) to ensure a single allocation can't overwhelm the network or disk downloading a large number of artifacts. A client configuration parameter for this would be appropriate, but I don't think necessary.

@yaroot
Copy link
Contributor Author

yaroot commented Oct 8, 2021

Per task group configuration would be nice, it's very dependent on hardware and types of artifacts.

@danishprakash
Copy link
Contributor

mind If I pick this up?

@gowthamgts
Copy link
Contributor

@danishprakash I'm almost done with the implementation. testing it right now. you wanna take over?

@danishprakash
Copy link
Contributor

@gowthamgts oh no, it's fine. I thought of picking it up since there wasn't much activity on this issue but please continue since you've already started with the work.

gowthamgts added a commit to gowthamgts/nomad-1 that referenced this issue Nov 18, 2021
@shoenig shoenig added this to the 1.3.0 milestone Feb 15, 2022
schmichael added a commit that referenced this issue Apr 20, 2022
* add concurrent download support - resolves #11244

* format imports

* mark `wg.Done()` via `defer`

* added tests for successful and failure cases and resolved some goleak

* docs: add changelog for #11531

* test typo fixes and improvements

Co-authored-by: Michael Schurter <mschurter@hashicorp.com>
@github-actions
Copy link

github-actions bot commented Oct 9, 2022

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants