Skip to content

MINOR: Reuse gradle daemon for scala compilation by default - #12280

Merged
ijuma merged 4 commits into
apache:trunkfrom
ijuma:gradle-scala-daemon-reuse
Dec 1, 2022
Merged

ijuma merged 4 commits into
apache:trunkfrom
ijuma:gradle-scala-daemon-reuse

Conversation

@ijuma

@ijuma ijuma commented Jun 10, 2022 •

Copy link
Copy Markdown
Member

The time time to compile was reduced from 5.3 seconds to 0.9 seconds by
changing the keep alive mode from SESSION to DAEMON. We change the
default to the latter and allow the former to be set via a keepAliveMode
property.

Also update the Jenkins build to use keepAliveMode="session" instead of
--no-daemon.

./gradlew compileTestScala -PkeepAliveMode="daemon" --info:

Task :streams:streams-scala:compileTestScala
Watching 928 directories to track changes
Caching disabled for task ':streams:streams-scala:compileTestScala' because:
Build cache is disabled
Task ':streams:streams-scala:compileTestScala' is not up-to-date because:
Input property 'source' file /home/ijuma/src/kafka/streams/streams-scala/src/test/scala/org/apache/kafka/streams/scala/kstream/JoinedTest.scala has changed.
Watching 920 directories to track changes
Watching 919 directories to track changes
Compiling with Zinc Scala compiler.
Prepared Zinc Scala inputs: 0.004 secs
compiling 16 Scala sources to /home/ijuma/src/kafka/streams/streams-scala/build/classes/scala/test ...
done compiling
Completed Scala compilation: 0.925 secs

./gradlew compileTestScala -PkeepAliveMode="session" --info

Task :streams:streams-scala:compileTestScala
Watching 928 directories to track changes
Caching disabled for task ':streams:streams-scala:compileTestScala' because:
Build cache is disabled
Task ':streams:streams-scala:compileTestScala' is not up-to-date because:
Input property 'source' file /home/ijuma/src/kafka/streams/streams-scala/src/test/scala/org/apache/kafka/streams/scala/kstream/JoinedTest.scala has changed.
Watching 920 directories to track changes
Watching 919 directories to track changes
Starting process 'Gradle Worker Daemon 3'. Working directory: /home/ijuma/.gradle/workers Command: /usr/java/jdk-17.0.4.1+1/bin/java -Xss4m -XX:+UseParallelGC --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.nio.file=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.regex=ALL-UNNAMED --add-opens=java.base/java.util.stream=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED --add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED @/home/ijuma/.gradle/.tmp/gradle-worker-classpath3305983246500958050txt -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant worker.org.gradle.process.internal.worker.GradleWorkerMain 'Gradle Worker Daemon 3'
Successfully started process 'Gradle Worker Daemon 3'
Started Gradle worker daemon (0.244 secs) with fork options DaemonForkOptions{executable=/usr/java/jdk-17.0.4.1+1/bin/java, minHeapSize=null, maxHeapSize=2048m, jvmArgs=[-Xss4m, -XX:+UseParallelGC, --add-opens=java.base/java.io=ALL-UNNAMED, --add-opens=java.base/java.lang=ALL-UNNAMED, --add-opens=java.base/java.nio=ALL-UNNAMED, --add-opens=java.base/java.nio.file=ALL-UNNAMED, --add-opens=java.base/java.util=ALL-UNNAMED, --add-opens=java.base/java.util.concurrent=ALL-UNNAMED, --add-opens=java.base/java.util.regex=ALL-UNNAMED, --add-opens=java.base/java.util.stream=ALL-UNNAMED, --add-opens=java.base/java.text=ALL-UNNAMED, --add-opens=java.base/java.time=ALL-UNNAMED, --add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED], keepAliveMode=SESSION}.
Compiling with Zinc Scala compiler.
Prepared Zinc Scala inputs: 0.187 secs
compiling 16 Scala sources to /home/ijuma/src/kafka/streams/streams-scala/build/classes/scala/test ...
done compiling
Completed Scala compilation: 5.307 secs

See gradle/gradle#20579 for more details.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@ijuma
ijuma force-pushed the gradle-scala-daemon-reuse branch from 8d8da85 to 631e2eb Compare June 10, 2022 03:40
@ijuma ijuma mentioned this pull request Nov 29, 2022
3 tasks
@ijuma ijuma changed the title MINOR: Reuse gradle daemon for scala compilation (WIP) MINOR: Reuse gradle daemon for scala compilation by default Nov 29, 2022
@ijuma
ijuma force-pushed the gradle-scala-daemon-reuse branch from df5b366 to cb2ed12 Compare November 29, 2022 15:13
@ijuma
ijuma marked this pull request as ready for review November 29, 2022 15:13
@ijuma
ijuma force-pushed the gradle-scala-daemon-reuse branch from cb2ed12 to d910fd0 Compare November 29, 2022 15:25
ijuma added a commit to ijuma/kafka that referenced this pull request Nov 29, 2022
The highlights are:
* Support for Java 19
* Support for incremental compilation following a compilation failure
* Flag for individual task rerun (eg "gradle test --rerun")
* Re-use Scala compiler between runs (will be enabled via apache#12280)

Release notes: https://docs.gradle.org/7.6/release-notes.html
@ijuma
ijuma requested review from omkreddy and showuon November 30, 2022 13:26
ijuma added a commit that referenced this pull request Nov 30, 2022
The highlights are:
* Support for Java 19
* Support for incremental compilation following a compilation failure
* Flag for individual task rerun (eg "gradle test --rerun")
* Re-use Scala compiler between runs (will be enabled via #12280)

Release notes: https://docs.gradle.org/7.6/release-notes.html

Also adjusted the directory used by `retry_zinc` for the build output from
`build` to `logs` as `gradlew clean` was causing unintended deletion of
the file used by that tool to decide if a retry is required.

Reviewers: Manikumar Reddy <[email protected]>
@ijuma
ijuma force-pushed the gradle-scala-daemon-reuse branch from d910fd0 to 5a02194 Compare November 30, 2022 13:26
@ijuma
ijuma requested a review from rajinisivaram November 30, 2022 13:28

@omkreddy omkreddy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ijuma Thanks for the PR. LGTM

@ijuma

ijuma commented Dec 1, 2022

Copy link
Copy Markdown
Member Author

There is quite a lot of unit test flakiness, but it doesn't seem related to this PR (it's happening in trunk too).

@ijuma
ijuma merged commit 52bb677 into apache:trunk Dec 1, 2022
@ijuma
ijuma deleted the gradle-scala-daemon-reuse branch December 1, 2022 13:33
guozhangwang pushed a commit to guozhangwang/kafka that referenced this pull request Jan 25, 2023
The highlights are:
* Support for Java 19
* Support for incremental compilation following a compilation failure
* Flag for individual task rerun (eg "gradle test --rerun")
* Re-use Scala compiler between runs (will be enabled via apache#12280)

Release notes: https://docs.gradle.org/7.6/release-notes.html

Also adjusted the directory used by `retry_zinc` for the build output from
`build` to `logs` as `gradlew clean` was causing unintended deletion of
the file used by that tool to decide if a retry is required.

Reviewers: Manikumar Reddy <[email protected]>
guozhangwang pushed a commit to guozhangwang/kafka that referenced this pull request Jan 25, 2023
…2280)

The time time to compile was reduced from 5.3 seconds to 0.9 seconds by
changing the keep alive mode from `SESSION` to `DAEMON`. We change the
default to the latter and allow the former to be set via a `keepAliveMode`
property.

Also update the Jenkins build to use `keepAliveMode="session"` instead of
`--no-daemon`.

./gradlew compileTestScala -PkeepAliveMode="daemon" --info:

> Task :streams:streams-scala:compileTestScala
> Watching 928 directories to track changes
> Caching disabled for task ':streams:streams-scala:compileTestScala' because:
>   Build cache is disabled
> Task ':streams:streams-scala:compileTestScala' is not up-to-date because:
>   Input property 'source' file /home/ijuma/src/kafka/streams/streams-scala/src/test/scala/org/apache/kafka/streams/scala/kstream/JoinedTest.scala has changed.
> Watching 920 directories to track changes
> Watching 919 directories to track changes
> Compiling with Zinc Scala compiler.
> Prepared Zinc Scala inputs: 0.004 secs
> compiling 16 Scala sources to /home/ijuma/src/kafka/streams/streams-scala/build/classes/scala/test ...
> done compiling
> Completed Scala compilation: 0.925 secs

./gradlew compileTestScala -PkeepAliveMode="session" --info

> Task :streams:streams-scala:compileTestScala
> Watching 928 directories to track changes
> Caching disabled for task ':streams:streams-scala:compileTestScala' because:
>   Build cache is disabled
> Task ':streams:streams-scala:compileTestScala' is not up-to-date because:
>   Input property 'source' file /home/ijuma/src/kafka/streams/streams-scala/src/test/scala/org/apache/kafka/streams/scala/kstream/JoinedTest.scala has changed.
> Watching 920 directories to track changes
> Watching 919 directories to track changes
> Starting process 'Gradle Worker Daemon 3'. Working directory: /home/ijuma/.gradle/workers Command: /usr/java/jdk-17.0.4.1+1/bin/java -Xss4m -XX:+UseParallelGC --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.nio.file=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.regex=ALL-UNNAMED --add-opens=java.base/java.util.stream=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED --add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED @/home/ijuma/.gradle/.tmp/gradle-worker-classpath3305983246500958050txt -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant worker.org.gradle.process.internal.worker.GradleWorkerMain 'Gradle Worker Daemon 3'
> Successfully started process 'Gradle Worker Daemon 3'
> Started Gradle worker daemon (0.244 secs) with fork options DaemonForkOptions{executable=/usr/java/jdk-17.0.4.1+1/bin/java, minHeapSize=null, maxHeapSize=2048m, jvmArgs=[-Xss4m, -XX:+UseParallelGC, --add-opens=java.base/java.io=ALL-UNNAMED, --add-opens=java.base/java.lang=ALL-UNNAMED, --add-opens=java.base/java.nio=ALL-UNNAMED, --add-opens=java.base/java.nio.file=ALL-UNNAMED, --add-opens=java.base/java.util=ALL-UNNAMED, --add-opens=java.base/java.util.concurrent=ALL-UNNAMED, --add-opens=java.base/java.util.regex=ALL-UNNAMED, --add-opens=java.base/java.util.stream=ALL-UNNAMED, --add-opens=java.base/java.text=ALL-UNNAMED, --add-opens=java.base/java.time=ALL-UNNAMED, --add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED], keepAliveMode=SESSION}.
> Compiling with Zinc Scala compiler.
> Prepared Zinc Scala inputs: 0.187 secs
> compiling 16 Scala sources to /home/ijuma/src/kafka/streams/streams-scala/build/classes/scala/test ...
> done compiling
> Completed Scala compilation: 5.307 secs

See gradle/gradle#20579 for more details.

Reviewers: Manikumar Reddy <[email protected]>
airlock-confluentinc Bot pushed a commit to confluentinc/kafka that referenced this pull request Jul 25, 2025
The highlights are:
* Support for Java 19
* Support for incremental compilation following a compilation failure
* Flag for individual task rerun (eg "gradle test --rerun")
* Re-use Scala compiler between runs (will be enabled via apache#12280)

Release notes: https://docs.gradle.org/7.6/release-notes.html

Also adjusted the directory used by `retry_zinc` for the build output from
`build` to `logs` as `gradlew clean` was causing unintended deletion of
the file used by that tool to decide if a retry is required.

Reviewers: Manikumar Reddy <[email protected]>
airlock-confluentinc Bot pushed a commit to confluentinc/kafka that referenced this pull request Jul 25, 2025
The highlights are:
* Support for Java 19
* Support for incremental compilation following a compilation failure
* Flag for individual task rerun (eg "gradle test --rerun")
* Re-use Scala compiler between runs (will be enabled via apache#12280)

Release notes: https://docs.gradle.org/7.6/release-notes.html

Also adjusted the directory used by `retry_zinc` for the build output from
`build` to `logs` as `gradlew clean` was causing unintended deletion of
the file used by that tool to decide if a retry is required.

Reviewers: Manikumar Reddy <[email protected]>
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.

2 participants