Gradle 3.0: Unleash the Daemon!

47
Gradle Summit Gradle 3.0: Unleash the Daemon! Eric Wendelin 2016

Transcript of Gradle 3.0: Unleash the Daemon!

Page 1: Gradle 3.0: Unleash the Daemon!

Gradle SummitGradle 3.0: Unleash the Daemon!

Eric Wendelin

2016

Page 2: Gradle 3.0: Unleash the Daemon!

Eric Wendelin@eriwen

Page 3: Gradle 3.0: Unleash the Daemon!

Long-lived Background Process

Client/Server communicating over TCP locally

Listens for and executes Build Actions

Daemon in a nutshell

Page 4: Gradle 3.0: Unleash the Daemon!

Daemonstration

Page 5: Gradle 3.0: Unleash the Daemon!

2nd build typically 15-75% faster

Page 6: Gradle 3.0: Unleash the Daemon!

faster the more

you use it

Progressive runtime optimizations

Higher class cache hit rate

More effective task I/O caching

Page 7: Gradle 3.0: Unleash the Daemon!

"Discovered the beauty of the

@gradle daemon, and now reaping the

benefits of sub-second builds"

@tylerjharden

Page 8: Gradle 3.0: Unleash the Daemon!

"Enabling the #gradle daemon took

my build from 13s to 1.1s. This should

be the default."

@GDBolinger

Page 9: Gradle 3.0: Unleash the Daemon!

5th build typically 30-90% faster

Page 10: Gradle 3.0: Unleash the Daemon!

Smokin'

fast!

Page 11: Gradle 3.0: Unleash the Daemon!

Daemon in Gradle 3.0

Page 12: Gradle 3.0: Unleash the Daemon!

Daemon in Gradle 3.0

Enabled by default

Resource-aware

More robust, especially on Windows

Better UX

Integrated with Gradle Build Scans

Page 13: Gradle 3.0: Unleash the Daemon!

Daemon in Gradle 3.0

Enabled by default

Resource-aware

More robust, especially on Windows

Better UX

Integrated with Gradle Build Scans

Page 14: Gradle 3.0: Unleash the Daemon!

--daemon

org.gradle.daemon=true

Page 15: Gradle 3.0: Unleash the Daemon!

Daemon in Gradle 3.0

Enabled by default

Resource-aware

More robust, especially on Windows

Better UX

Integrated with Gradle Build Scans

Page 16: Gradle 3.0: Unleash the Daemon!

Resource Awareness

System Memory

Daemon JVM Memory

GC Activity

Other Daemons

Page 17: Gradle 3.0: Unleash the Daemon!

What we've built is a framework for making the Daemon more intelligent

Page 18: Gradle 3.0: Unleash the Daemon!

Daemon in Gradle 3.0

Enabled by default

Resource-aware

More robust, especially on Windows

Better UX

Integrated with Gradle Build Scans

Page 19: Gradle 3.0: Unleash the Daemon!

GRADLE-3018*

GRADLE-3481*

GRADLE-2803

GRADLE-3265

GRADLE-3315

GRADLE-2828

GRADLE-2275*

GRADLE-2415

GRADLE-2629

GRADLE-2367

GRADLE-2273

GRADLE-2271

Reasons not to use the Daemon

* In Progress

Page 20: Gradle 3.0: Unleash the Daemon!

Daemon in Gradle 3.0

Enabled by default

Resource-aware

More robust, especially on Windows

Better UX

Integrated with Gradle Build Scans

Page 21: Gradle 3.0: Unleash the Daemon!

Better UX

Page 22: Gradle 3.0: Unleash the Daemon!

Daemon in Gradle 3.0

Enabled by default

Resource-aware

More robust, especially on Windows

Better UX

Integrated with Gradle Build Scans

Page 23: Gradle 3.0: Unleash the Daemon!

Gradle Build Scans

Page 24: Gradle 3.0: Unleash the Daemon!

Everyday Daemon Use

Page 25: Gradle 3.0: Unleash the Daemon!

When should I use the Daemon?

All projects, everywhereexcept possibly CI

Page 26: Gradle 3.0: Unleash the Daemon!

Daemon in IDEs

All IDEs always use the Daemon through the Gradle Tooling API

Page 27: Gradle 3.0: Unleash the Daemon!

Reusing Daemons across projects

Same Gradle version

Same $JAVA_HOME

Compatible JVM Args

Page 28: Gradle 3.0: Unleash the Daemon!

How do I score one of those sweet,

rare Gradlephant transfer stickers?

Bribery

Page 29: Gradle 3.0: Unleash the Daemon!

Maximizing

Performance

Page 30: Gradle 3.0: Unleash the Daemon!

Effective Daemon Reuse

gradle --status

gradle --info shows Daemon stopped reasons

org.gradle.daemon.idletimeout

Page 31: Gradle 3.0: Unleash the Daemon!

Daemon Performance Logging

org.gradle.daemon.performance.logging=true

~/.gradle/daemon/$VERSION/daemon-$PID.out.log

Page 32: Gradle 3.0: Unleash the Daemon!

Daemon Performance Tuning

org.gradle.daemon. performance.tenured-usage-expire-at=90

org.gradle.daemon. performance.tenured-rate-expire-at=1.2

org.gradle.daemon. performance.permgen-usage-expire-at=80

~/.gradle/daemon/$VERSION/daemon-$PID.out.log

Page 33: Gradle 3.0: Unleash the Daemon!

Build slow, even with Daemon?

Gradle Build Scans to the rescue

Page 34: Gradle 3.0: Unleash the Daemon!

gradle.github.io/performance-guide

Gradle Performance Guide

Page 35: Gradle 3.0: Unleash the Daemon!

None of these?

Page 36: Gradle 3.0: Unleash the Daemon!

News Flash: You're at the freakin' Gradle Summit

Tweet @gradle

discuss.gradle.org

None of these?

Page 37: Gradle 3.0: Unleash the Daemon!

Maximizing Performance

Reuse Daemon as much as possible

Use Build Scans

Gradle Performance Guide

discuss.gradle.org

Page 38: Gradle 3.0: Unleash the Daemon!

Beyond Gradle 3.0

Page 39: Gradle 3.0: Unleash the Daemon!

Beyond Gradle 3.0

Cross-version Daemon Registry

More intelligent caching

Better cache eviction for longer-running Daemons

Page 40: Gradle 3.0: Unleash the Daemon!

Beyond Gradle 3.0

Warms itself up while idle

Automatically adjusts for user behavior through machine learning

Speculative dependency resolution and execution

Page 41: Gradle 3.0: Unleash the Daemon!

The Daemon is the vehicle through which Gradle can

become proactive

Page 42: Gradle 3.0: Unleash the Daemon!

two more things...

Page 43: Gradle 3.0: Unleash the Daemon!

Try it today

gradle wrapper --gradle-version 3.0-milestone-2

Page 44: Gradle 3.0: Unleash the Daemon!

Give feedback

discuss.gradle.org

Page 45: Gradle 3.0: Unleash the Daemon!

gradle.org/jobs

Have ideas?

Page 46: Gradle 3.0: Unleash the Daemon!

@eriwen

Thank You

@mbarnath@ghhale @lhotariEric Wendelin and the Daemon Team

Page 47: Gradle 3.0: Unleash the Daemon!

Learn more at www.gradle.org