-
Notifications
You must be signed in to change notification settings - Fork 36
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
feat: enable parallel branch building #647
base: main
Are you sure you want to change the base?
Conversation
Out of interest, how many branches do you usually use and how much time do you gain with this PR applied? |
@jenspav I will check the build numbers - will try run them tomorrow. We have around 25+ branches. Completely understand that using other way to interact with repo is not a great way - I would personally also prefer to use just jGit - sadly they don't have support worktrees - and I don't like idea of cloning 25 times a repo, that I already cloned once and have all branches. |
I have a similar issue with a large number of branches. I resolved it by adding some code to my build pipeline to only build branches that changes within the last X days so I can reduce the number of branches. A parallel builder might be handy and would allow more branches to be built.
|
We use feature branches for having architecture decisions that are pending and not implemented yet, so we need to build them always - we merge them to main branch only after they are implemented. Hence we can't rely on time based branches - as sometimes implementation takes longer and HLD/ADD/ADR should be available for teams and architects. |
After trying to test this branch with our own repo, I think I uncovered bug in https://github.com/structurizr/java - but would be grateful if someone can confirm my suspicion - which effectively makes me unable to provide the numbers that you asked for @jenspav. We are extensively using !scripts in our workspace views - for tags filtering. While doing so there is something with jRuby or Structurizr itself that screws with context, when doing this in parallel - in sequential mode works perfectly. To reproduce that when using my branch just do: $ ./gradlew run --args="generate-site -par -g https://github.com/FlyrInc/structurizr-site-generatr.git -b test1,test2,test3,test4,test5 -d test1 -w docs/example/workspace.dsl" test1-5 branches are exactly the same. They contain simple script ( link: https://github.com/FlyrInc/structurizr-site-generatr/blob/test1/docs/example/views.rb ) that is exactly the same on couple of views: tags = defined?(tags) ? tags : ""
def tags_filter(tags=[])
puts "Tags: #{tags}"
end
tags_filter(tags=tags.split(",")) When running this without
Which suggest something happening in |
After getting a fix for jRuby I could finally run some numbers on our usual workspace with 25 branches that you asked for @jenspav. On Apple Macbook Pro M1:
I assume on CI/CD we would have gains around 10-15 minutes based on this patch. |
Thanks for the numbers. To be honest, I prefer to not have the complexity and that this PR introduces upstream. I agree though that the improvements are noticeable, but it's not major. That said, I have a a different angle to look at performance. Currently we recreate the diagram cache for each branch, may be we can reuse the cache properly across branches. We had this at one point, but it got reversed because of issues. See #363 and #349 . Reverting that PR and solving the related issue properly should gain you much more time than building in parallel. |
My understanding is that diagram generation isn't the longest time penalty in our build - it's html generation in kotlinx. |
Thanks. To be sure you could revert #349 and run it against your setup. That way we would get an idea if the time for diagram generation is indeed not the issue. |
Hi,
One of the things that became an issue at some points is that building multiple branches with bigger model takes more and more time (our builds are getting to 40 mins). To solve this problem we would like to propose new flag
--parallel
in generate-site command that would use native git executable to establishgit worktree
for every branch that will be used and build those branches in parallel from separate branch git worktrees. jGit as of today doesn't have a support for worktrees - hence need to use native git executable.This should effectively make builds faster in most scenarios.
Any feedback mostly appreciated.