[MNG-7129] Incremental build and shared cache feature#526
Conversation
…en-3.6.3 to MNG-7129/maven-3.6.3-incremental
Squashed commit of the following:
commit 21c620a34ddbbf84b3c44014b069a7b222cf91a7
Author: Maximilian Novikov <maximilian.novikov@db.com>
Date: Tue Aug 10 19:41:41 2021 +0200
Merge pull request apache#3 in ABFX/maven-forked from code-cleanup-2 to incremental-maven-3.6.3
Squashed commit of the following:
commit 3401739ec9eb957fb03887f6a3c24477c9c3327b
Author: Alexander Ashitkin <alexander.ashitkin@db.com>
Date: Tue Aug 10 13:37:13 2021 -0400
cleanup db specifics
commit 5d32f00559951445ecaf7d5ec4d847541c10e7e9
Author: Alexander Ashitkin <alexander.ashitkin@db.com>
Date: Tue Aug 10 11:05:28 2021 -0400
cleanup db specifics
commit fcec28f82c0d447de64032c610b39fa75bb344b0
Merge: 6fd401af2 5b0dc1858
Author: Alexander Ashitkin <alexander.ashitkin@db.com>
Date: Mon Aug 9 13:22:16 2021 +0100
Pull request apache#9: Remote cache setup
Merge in BND/maven-forked from feature/remote-cache-setup to incremental-maven-3.6.3
* commit '5b0dc1858cf4ca499502f0741b2f3bf2ac55530c':
remote cache setup - fail fast, baseline build, diff reporting, documentation.
commit 5b0dc1858cf4ca499502f0741b2f3bf2ac55530c
Author: Alexander Ashitkin <alexander.ashitkin@db.com>
Date: Mon Mar 22 03:30:03 2021 +0100
remote cache setup - fail fast, baseline build, diff reporting, documentation.
commit 6fd401af285692df568312ee66ee00edfe21f1cc
Author: Maximilian Novikov <maximilian.novikov@db.com>
Date: Tue Apr 13 17:36:49 2021 +0100
Pull request apache#8: Incremental Maven - added non-overrideable cache entries
Merge in BND/maven-forked from non-overritable-build-info to incremental-maven-3.6.3
Squashed commit of the following:
commit 405bbef8a59cabc0b83e9a64717f65fbd6fb9e3d
Author: maximilian.novikov@db.com <maximilian.novikov@db.com>
Date: Mon Apr 12 20:18:27 2021 +0200
Incremental Maven - added non-overrideable cache entries - review fixes
commit 197704672756e558fb3521e16859d0be324044b8
Author: maximilian.novikov@db.com <maximilian.novikov@db.com>
Date: Fri Apr 9 11:35:48 2021 +0200
Incremental Maven - added non-overrideable cache entries
commit 64c4b1f5cbdf920ad43560f34cc5be56d4557acf
Author: Alexander Ashitkin <alexander.ashitkin@db.com>
Date: Tue Mar 9 04:10:20 2021 +0100
injected version
commit 727e507ae2fd90dce7011f3f1c76eb4969577d5e
Author: maximilian.novikov@db.com <maximilian.novikov@db.com>
Date: Wed Jan 13 16:17:25 2021 +0100
Incremental Maven - Java 11 fix
commit b2f297566d5afcb0a285985cb5540685a28cafec
Author: maximilian.novikov@db.com <maximilian.novikov@db.com>
Date: Tue Jan 12 14:10:08 2021 +0100
Incremental Maven - initial commit
|
Massive! I already see room for improvement. |
|
Hi, Looks very promishing, congrats!
Hope it makes sense. |
|
If I recall correclty there were one or two existing classes that needed to be extended to be able to support the cache. Could we move those to a separate PR? That will make reduce the amount of code to validate the rest of the and gives us enough time to experiment with it. |
@olamy any news on this? need help? |
| @@ -0,0 +1,49 @@ | |||
| package org.apache.maven.caching; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ | |||
|
|
||
| ### Minimal config | ||
|
|
||
| Absolutely minimal config which enables incremental maven with local cache |
There was a problem hiding this comment.
should state to put the content in .mvn/maven-cache-config.xml file
from first PR review, most code is put in this caching is injected in
I fear swiching these updates to core extension will be hard... on how to learn the code, I don't see the PR being split in multiple PRs, but perhaps the unique commit being split in multiple one source of noisy modifications (and many new dependencies addition) is using jaxb to read XML config files instead of using our usual Modello |
| mojoExecutionListener.beforeMojoExecution( mojoExecutionEvent ); | ||
|
|
||
| mojo.execute(); | ||
| if ( mojoExecution.canRun( mojo, session ) ) |
There was a problem hiding this comment.
most of the modifications for this class seem to be purely formatting: restoring initial formatting would ease review
|
Hi
Small clarifications to review comments:
From my perspective there are folowing implementation related streams of work:
Thank you |
2 weeks for a PoC and a month for 1st working version in prod :) |
How many FTEs? |
~1.5 |
|
Hi Alex,
Excellent work and an elaborat.
Unfortunately the xxHash algorithm is not in the list
https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html
We must guarantee that every java would support it.
T
…On Wed, Aug 25, 2021 at 1:05 PM Alex ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In Documentation/CACHE-HOWTO.md
<#526 (comment)>:
> +Cache configuration provides you additional control over incremental maven behavior. Follow it step by step to
+understand how it works and figure out your optimal config
+
+### Minimal config
+
+Absolutely minimal config which enables incremental maven with local cache
+
+```xml
+<?xml version="1.0" encoding="UTF-8" ?>
+<cache xmlns="org:apache:maven:cache:config:v1"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="org:apache:maven:cache:config:v1 cache-config.xsd">
+
+ <configuration>
+ <enabled>true</enabled>
+ <hashAlgorithm>XX</hashAlgorithm>
[image: benchmark]
<https://camo.githubusercontent.com/35f343cf91b12df3cc73f30216e26ccda56c8983a62d0714014e0a3e07b63b35/68747470733a2f2f686162726173746f726167652e6f72672f776562742f69792f6f352f7a6a2f69796f357a6a6a36366665723179796d7176672d6163783961756d2e706e67>
Setup:
- run on Oracle JDK 1.8.0.201 on Windows and Linux
- use 100 jar files with different size from 3 KB to 90 MB, total size
474 MB
- read in single thread, calculate hash for each file and total
checksum
- separate folder for each algorithm to avoid disk cache testing
- 100 rounds to minimize CPU interference from external loads
- time in seconds, candle body is 25-75 percentile, shadow is min/max
values
Results:
- xxHash shows stable time (3-4 sec) on both Windows and Linux
platforms
- xxHash with Memory Mapped buffer (XXMM) gives another small gain on
Linux, useful on CI
- SHA-256 about 4 times slower with a difference of 10 seconds even on
this small test
P.S. also tested 5157 files with total size 2.6 GB, difference between
xxHash and SHA-256 was about 1.5-2 min
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#526 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAH7ER2RHTUYOLVYHGF46E3T6TE53ANCNFSM5CPVYJEA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email>
.
|
Used open-source implementation: |
FYI it is trivial to fork and takes only <150 lines and enables to drop the unsafe usage and other deps - it only depends on bytebuffer or alike - which requires some careness on recent java versions - does not dramatically change performances compared to sha algorithms. |
Unfortunately it's not 150 lines of code, I removed all unused code and it still depends on Unsafe and ByteBuffer |
|
@qweek had this kind of thing in mind: https://gist.github.com/rmannibucau/756156a53e792f2b68c3339db8ee97a6. Depending on bytebuffer is fine (it is in the JRE), unsafe is acceptable even if not needed and depends how you integrate with JVM - Java agreed to keep it but some version(s) can require some integration so I preferred to drop it in the project I'm using it. |
|
PR merged to branch: thanks a lot for the great contribution |
|
@rmannibucau I see what you mean: it will kill a few optimizations, generate more objects and probably we need to change ByteOrder (default byte buffer order is BIG_ENDIAN and algorithm order is LITTLE_ENDIAN). But you're right, it's much cleaner and simpler, thank you for sharing your vision. |
|
@maximilian-novikov-db , how does this work with Idea? |
|
To familiarize yourself with the feature we recommend to start with the provided doc: https://github.com/deutschebank/maven/blob/7d1b8c094f2145909978142a0faa4257a244dc22/Documentation/CACHE.md
An example of nginx config for remote cache: