Slide 1

Slide 1 text

Holly Cummins Øredev November 6, 2024 less waste, more joy, and a lot more green how quarkus makes java better

Slide 2

Slide 2 text

@holly-cummins.bsky.social what #RedHat

Slide 3

Slide 3 text

@holly-cummins.bsky.social what #RedHat

Slide 4

Slide 4 text

quarkus applications start fast quarkus + graalvm 0.014 Seconds quarkus + open jdk 0.75 Seconds traditional cloud-native stack 4.3 Seconds https://quarkus.io/blog/runtime-performance/ rest application

Slide 5

Slide 5 text

quarkus + GraalVM 13 MB quarkus + OpenJDK 74 MB traditional Cloud-Native Stack 140 MB rest application https://quarkus.io/blog/runtime-performance/ quarkus improves memory utilization

Slide 6

Slide 6 text

@holly_cummins machine quarkus quarkus quarkus quarkus quarkus quarkus quarkus quarkus quarkus quarkus quarkus quarkus quarkus quarkus container orchestration machine traditional cloud-native java stack traditional cloud-native java stack traditional cloud-native java stack traditional cloud-native java stack quarkus applications have high deployment density. quarkus native, but quarkus on jvm is also way smaller than traditional java

Slide 7

Slide 7 text

@holly_cummins traditional cloud-native java stack traditional cloud-native java stack traditional cloud-native java stack traditional cloud-native java stack node.js node.js node.js node.js node.js node.js node.js go go machine go go go go go go go go go go go go go go go go go go go quarkus quarkus quarkus quarkus quarkus quarkus quarkus quarkus quarkus quarkus quarkus quarkus quarkus quarkus … and not just when comparing to other java frameworks container orchestration machine machine machine https:/ /developers.redhat.com/blog/2017/03/14/java-inside-docker/

Slide 8

Slide 8 text

let’s talk about throughput. https://www.redhat.com/en/resources/mi-quarkus-lab-validation-idc-analyst-paper 48 concurrent connections traditional cloud native stack 3555 req/s

Slide 9

Slide 9 text

let’s talk about throughput. quarkus native 3212 req/s https://www.redhat.com/en/resources/mi-quarkus-lab-validation-idc-analyst-paper 48 concurrent connections traditional cloud native stack 3555 req/s

Slide 10

Slide 10 text

let’s talk about throughput. quarkus native 3212 req/s https://www.redhat.com/en/resources/mi-quarkus-lab-validation-idc-analyst-paper a trade-off of throughput against footprint 48 concurrent connections traditional cloud native stack 3555 req/s

Slide 11

Slide 11 text

@holly-cummins.bsky.social native compilation trade-offs quarkus native 3212 req/s https://www.redhat.com/en/resources/mi-quarkus-lab-validation-idc-analyst-paper 48 concurrent connections traditional cloud native stack 3555 req/s throughput startup time + footprint

Slide 12

Slide 12 text

@holly-cummins.bsky.social native compilation trade-offs quarkus native 3212 req/s https://www.redhat.com/en/resources/mi-quarkus-lab-validation-idc-analyst-paper 48 concurrent connections traditional cloud native stack 3555 req/s throughput startup time + footprint

Slide 13

Slide 13 text

but … traditional cloud native stack 3555 req/s quarkus native 3212 req/s https://www.redhat.com/en/resources/mi-quarkus-lab-validation-idc-analyst-paper a trade-off of throughput against footprint 48 concurrent connections

Slide 14

Slide 14 text

but … traditional cloud native stack 3555 req/s quarkus on jvm 6389 req/s quarkus native 3212 req/s https://www.redhat.com/en/resources/mi-quarkus-lab-validation-idc-analyst-paper a trade-off of throughput against footprint 48 concurrent connections

Slide 15

Slide 15 text

but … traditional cloud native stack 3555 req/s quarkus on jvm 6389 req/s quarkus native 3212 req/s https://www.redhat.com/en/resources/mi-quarkus-lab-validation-idc-analyst-paper no trade-off, just better :) a trade-off of throughput against footprint 48 concurrent connections

Slide 16

Slide 16 text

@holly-cummins.bsky.social we beat the trade-off. throughput startup time + footprint

Slide 17

Slide 17 text

@holly-cummins.bsky.social we beat the trade-off. throughput startup time + footprint

Slide 18

Slide 18 text

@holly-cummins.bsky.social we beat the trade-off. throughput startup time + footprint it’s a double-win.

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

@holly_cummins #RedHat developer joy

Slide 21

Slide 21 text

@holly_cummins #RedHat developer joy -auto-provision services

Slide 22

Slide 22 text

@holly_cummins #RedHat developer joy -auto-provision services -live coding

Slide 23

Slide 23 text

@holly_cummins #RedHat developer joy -auto-provision services -live coding -continuous (fast!) testing

Slide 24

Slide 24 text

@holly_cummins #RedHat developer joy -auto-provision services -live coding -continuous (fast!) testing -less boilerplate

Slide 25

Slide 25 text

@holly-cummins.bsky.social how #RedHat

Slide 26

Slide 26 text

@holly-cummins.bsky.social

Slide 27

Slide 27 text

@holly-cummins.bsky.social

Slide 28

Slide 28 text

@holly-cummins.bsky.social

Slide 29

Slide 29 text

@holly-cummins.bsky.social profile shave shave profile shave profile shave profile shave profile

Slide 30

Slide 30 text

@holly-cummins.bsky.social profile shave shave profile shave profile shave profile shave profile shave profile

Slide 31

Slide 31 text

@holly-cummins.bsky.social performance is a series of puzzles

Slide 32

Slide 32 text

@holly-cummins.bsky.social “OAAS: obsession as a service” - Francesco Nigro, obsessive performance engineer

Slide 33

Slide 33 text

@holly-cummins.bsky.social why don’t java apps do well on techempower benchmark? example performance puzzle

Slide 34

Slide 34 text

@holly-cummins.bsky.social sometimes, the root cause is not obvious

Slide 35

Slide 35 text

@holly-cummins.bsky.social sometimes, the root cause is not obvious

Slide 36

Slide 36 text

@holly-cummins.bsky.social clue 1

Slide 37

Slide 37 text

@holly-cummins.bsky.social we ran hyperparameter optimisation clue 1

Slide 38

Slide 38 text

@holly-cummins.bsky.social we ran hyperparameter optimisation clue 1 it suggested this:

Slide 39

Slide 39 text

@holly-cummins.bsky.social we ran hyperparameter optimisation -XX:TieredStopAtLevel=1 clue 1 it suggested this:

Slide 40

Slide 40 text

@holly-cummins.bsky.social we ran hyperparameter optimisation -XX:TieredStopAtLevel=1 clue 1 it suggested this: disables C2 compiler

Slide 41

Slide 41 text

@holly-cummins.bsky.social we ran hyperparameter optimisation -XX:TieredStopAtLevel=1 well-known for making long-running apps slower clue 1 it suggested this: disables C2 compiler

Slide 42

Slide 42 text

small number of cores Netty http handling clue 2

Slide 43

Slide 43 text

lots of cores Netty http handling clue 2

Slide 44

Slide 44 text

what’s going on here? lots of cores example: type pollution clue 2

Slide 45

Slide 45 text

@holly-cummins.bsky.social to find out, Francesco Nigro and Andrew Haley read 20,000 lines of ASM ASM clue 3

Slide 46

Slide 46 text

@holly-cummins.bsky.social cache pollution diagnosis

Slide 47

Slide 47 text

@holly-cummins.bsky.social “type pollution” diagnosis

Slide 48

Slide 48 text

@holly_cummins if (a instanceof Thing) problematic pattern:

Slide 49

Slide 49 text

@holly_cummins if (a instanceof Thing) problematic pattern: !!

Slide 50

Slide 50 text

@holly_cummins if (a instanceof Thing) problematic pattern: affects : !!

Slide 51

Slide 51 text

@holly_cummins if (a instanceof Thing) – Quarkus core – Netty – Hibernate ORM – Hibernate Reactive – Vert.x – Smallrye Mutiny – Smallrye Common – Vert.x Web – Infinispan – Camel – Drools – Optaplanner – Java Class Library problematic pattern: affects : !!

Slide 52

Slide 52 text

@holly_cummins if (a instanceof Thing) – Quarkus core – Netty – Hibernate ORM – Hibernate Reactive – Vert.x – Smallrye Mutiny – Smallrye Common – Vert.x Web – Infinispan – Camel – Drools – Optaplanner – Java Class Library problematic pattern: affects : !! – Java Class Library!

Slide 53

Slide 53 text

@holly-cummins.bsky.social avoiding the problematic pattern sped quarkus up a lot (in many-core case)

Slide 54

Slide 54 text

@holly-cummins.bsky.social #RedHat private static int extractSize(Object it) { if (it instanceof Collection) { return ((Collection>) it).size(); } else if (it instanceof Map) { return ((Map, ?>) it).size(); } else if (it.getClass().isArray()) { return Array.getLength(it); } else if (it instanceof Integer) { return ((Integer) it); } return 10; } slow on many-core systems

Slide 55

Slide 55 text

@holly-cummins.bsky.social #RedHat private static int extractSize(Object it) { if (it instanceof Collection) { return ((Collection>) it).size(); } else if (it instanceof Map) { return ((Map, ?>) it).size(); } else if (it.getClass().isArray()) { return Array.getLength(it); } else if (it instanceof Integer) { return ((Integer) it); } return 10; } // Note that we intentionally use "instanceof" to test interfaces as the last resort in order to mitigate the "type pollution” // See https://github.com/RedHatPerf/type-pollution-agent for more information if (it instanceof AbstractCollection) { return ((AbstractCollection>) it).size(); } else if (it instanceof AbstractMap) { return ((AbstractMap, ?>) it).size(); } else if (it instanceof Collection) { return ((Collection>) it).size(); } else if (it instanceof Map) { return ((Map, ?>) it).size(); } return 10; } slow on many-core systems 30% more throughput

Slide 56

Slide 56 text

@holly-cummins.bsky.social #RedHat private static int extractSize(Object it) { if (it instanceof Collection) { return ((Collection>) it).size(); } else if (it instanceof Map) { return ((Map, ?>) it).size(); } else if (it.getClass().isArray()) { return Array.getLength(it); } else if (it instanceof Integer) { return ((Integer) it); } return 10; } // Note that we intentionally use "instanceof" to test interfaces as the last resort in order to mitigate the "type pollution” // See https://github.com/RedHatPerf/type-pollution-agent for more information if (it instanceof AbstractCollection) { return ((AbstractCollection>) it).size(); } else if (it instanceof AbstractMap) { return ((AbstractMap, ?>) it).size(); } else if (it instanceof Collection) { return ((Collection>) it).size(); } else if (it instanceof Map) { return ((Map, ?>) it).size(); } return 10; } but …

Slide 57

Slide 57 text

@holly-cummins.bsky.social #RedHat private static int extractSize(Object it) { if (it instanceof Collection) { return ((Collection>) it).size(); } else if (it instanceof Map) { return ((Map, ?>) it).size(); } else if (it.getClass().isArray()) { return Array.getLength(it); } else if (it instanceof Integer) { return ((Integer) it); } return 10; } // Note that we intentionally use "instanceof" to test interfaces as the last resort in order to mitigate the "type pollution” // See https://github.com/RedHatPerf/type-pollution-agent for more information if (it instanceof AbstractCollection) { return ((AbstractCollection>) it).size(); } else if (it instanceof AbstractMap) { return ((AbstractMap, ?>) it).size(); } else if (it instanceof Collection) { return ((Collection>) it).size(); } else if (it instanceof Map) { return ((Map, ?>) it).size(); } return 10; } but …

Slide 58

Slide 58 text

@holly-cummins.bsky.social #RedHat private static int extractSize(Object it) { if (it instanceof Collection) { return ((Collection>) it).size(); } else if (it instanceof Map) { return ((Map, ?>) it).size(); } else if (it.getClass().isArray()) { return Array.getLength(it); } else if (it instanceof Integer) { return ((Integer) it); } return 10; } // Note that we intentionally use "instanceof" to test interfaces as the last resort in order to mitigate the "type pollution” // See https://github.com/RedHatPerf/type-pollution-agent for more information if (it instanceof AbstractCollection) { return ((AbstractCollection>) it).size(); } else if (it instanceof AbstractMap) { return ((AbstractMap, ?>) it).size(); } else if (it instanceof Collection) { return ((Collection>) it).size(); } else if (it instanceof Map) { return ((Map, ?>) it).size(); } return 10; } not a fan of the fix but …

Slide 59

Slide 59 text

@holly-cummins.bsky.social #RedHat private static int extractSize(Object it) { if (it instanceof Collection) { return ((Collection>) it).size(); } else if (it instanceof Map) { return ((Map, ?>) it).size(); } else if (it.getClass().isArray()) { return Array.getLength(it); } else if (it instanceof Integer) { return ((Integer) it); } return 10; } // Note that we intentionally use "instanceof" to test interfaces as the last resort in order to mitigate the "type pollution” // See https://github.com/RedHatPerf/type-pollution-agent for more information if (it instanceof AbstractCollection) { return ((AbstractCollection>) it).size(); } else if (it instanceof AbstractMap) { return ((AbstractMap, ?>) it).size(); } else if (it instanceof Collection) { return ((Collection>) it).size(); } else if (it instanceof Map) { return ((Map, ?>) it).size(); } return 10; } not a fan of the fix non-idiomatic but …

Slide 60

Slide 60 text

@holly-cummins.bsky.social #RedHat private static int extractSize(Object it) { if (it instanceof Collection) { return ((Collection>) it).size(); } else if (it instanceof Map) { return ((Map, ?>) it).size(); } else if (it.getClass().isArray()) { return Array.getLength(it); } else if (it instanceof Integer) { return ((Integer) it); } return 10; } // Note that we intentionally use "instanceof" to test interfaces as the last resort in order to mitigate the "type pollution” // See https://github.com/RedHatPerf/type-pollution-agent for more information if (it instanceof AbstractCollection) { return ((AbstractCollection>) it).size(); } else if (it instanceof AbstractMap) { return ((AbstractMap, ?>) it).size(); } else if (it instanceof Collection) { return ((Collection>) it).size(); } else if (it instanceof Map) { return ((Map, ?>) it).size(); } return 10; } not a fan of the fix non-idiomatic difficult to maintain but …

Slide 61

Slide 61 text

@holly-cummins.bsky.social #RedHat private static int extractSize(Object it) { if (it instanceof Collection) { return ((Collection>) it).size(); } else if (it instanceof Map) { return ((Map, ?>) it).size(); } else if (it.getClass().isArray()) { return Array.getLength(it); } else if (it instanceof Integer) { return ((Integer) it); } return 10; } // Note that we intentionally use "instanceof" to test interfaces as the last resort in order to mitigate the "type pollution” // See https://github.com/RedHatPerf/type-pollution-agent for more information if (it instanceof AbstractCollection) { return ((AbstractCollection>) it).size(); } else if (it instanceof AbstractMap) { return ((AbstractMap, ?>) it).size(); } else if (it instanceof Collection) { return ((Collection>) it).size(); } else if (it instanceof Map) { return ((Map, ?>) it).size(); } return 10; } not a fan of the fix non-idiomatic difficult to maintain machine efficiency my team’s efficiency but …

Slide 62

Slide 62 text

@holly-cummins.bsky.social sometimes, you need to un-connect the dots

Slide 63

Slide 63 text

@holly-cummins.bsky.social sometimes, you need to un-connect the dots

Slide 64

Slide 64 text

@holly-cummins.bsky.social sometimes, you need to un-connect the dots

Slide 65

Slide 65 text

@holly-cummins.bsky.social African wild ass sometimes, you need to un-connect the dots

Slide 66

Slide 66 text

@holly-cummins.bsky.social sometimes, you need to un-connect the dots

Slide 67

Slide 67 text

@holly-cummins.bsky.social sometimes, you need to un-connect the dots

Slide 68

Slide 68 text

@holly-cummins.bsky.social sometimes, you need to un-connect the dots

Slide 69

Slide 69 text

@holly-cummins.bsky.social #RedHat challenge assumptions

Slide 70

Slide 70 text

@holly-cummins.bsky.social #RedHat string comparison: who says you have to read strings left-to-right? challenge assumptions

Slide 71

Slide 71 text

@holly-cummins.bsky.social #RedHat string comparison: who says you have to read strings left-to-right? QUARKUS_REPEATED_PREFIX_FOO QUARKUS_REPEATED_PREFIX_BAR challenge assumptions

Slide 72

Slide 72 text

@holly-cummins.bsky.social #RedHat string comparison: who says you have to read strings left-to-right? QUARKUS_REPEATED_PREFIX_FOO QUARKUS_REPEATED_PREFIX_BAR challenge assumptions

Slide 73

Slide 73 text

@holly-cummins.bsky.social #RedHat challenge outdated architectural ssumptions

Slide 74

Slide 74 text

@holly_cummins Don’t be dynamic.

Slide 75

Slide 75 text

@holly_cummins Don’t be dynamic. (Wait, what??)

Slide 76

Slide 76 text

@holly-cummins.bsky.social #RedHat old Java frameworks were optimised for …

Slide 77

Slide 77 text

@holly-cummins.bsky.social #RedHat long-lived processes old Java frameworks were optimised for …

Slide 78

Slide 78 text

@holly-cummins.bsky.social #RedHat long-lived processes annual (!) deployments old Java frameworks were optimised for …

Slide 79

Slide 79 text

@holly-cummins.bsky.social #RedHat long-lived processes annual (!) deployments late-binding old Java frameworks were optimised for …

Slide 80

Slide 80 text

@holly-cummins.bsky.social #RedHat long-lived processes annual (!) deployments late-binding re-configurable without restart old Java frameworks were optimised for …

Slide 81

Slide 81 text

@holly-cummins.bsky.social #RedHat application frameworks were optimised for dynamism

Slide 82

Slide 82 text

@holly-cummins.bsky.social #RedHat application frameworks were optimised for dynamism dynamism has a cost

Slide 83

Slide 83 text

@holly-cummins.bsky.social #RedHat load code onto a server then

Slide 84

Slide 84 text

@holly-cummins.bsky.social #RedHat load code onto a server then

Slide 85

Slide 85 text

@holly-cummins.bsky.social #RedHat load code onto a server then public static void main(String... args) { int exitCode = new CommandLine(new ModuleBuildDurationReport()).execute(args ); System.exit(exitCode); }

Slide 86

Slide 86 text

@holly-cummins.bsky.social #RedHat load code onto a server then public static void main(String... args) { int exitCode = new CommandLine(new ModuleBuildDurationReport()).execute(args ); System.exit(exitCode); }

Slide 87

Slide 87 text

@holly-cummins.bsky.social #RedHat load code onto a server then

Slide 88

Slide 88 text

@holly-cummins.bsky.social #RedHat cloud apps are immutable now

Slide 89

Slide 89 text

@holly-cummins.bsky.social #RedHat cloud apps are immutable now

Slide 90

Slide 90 text

@holly-cummins.bsky.social #RedHat cloud apps are immutable now CI

Slide 91

Slide 91 text

@holly-cummins.bsky.social #RedHat cloud apps are immutable now CI

Slide 92

Slide 92 text

@holly-cummins.bsky.social #RedHat cloud apps are immutable now CI public static void main(String... args) { int exitCode = new CommandLine(new ModuleBuildDurationReport()).execute(args ); System.exit(exitCode); }

Slide 93

Slide 93 text

@holly-cummins.bsky.social #RedHat cloud apps are immutable now CI public static void main(String... args) { int exitCode = new CommandLine(new ModuleBuildDurationReport()).execute(args ); System.exit(exitCode); }

Slide 94

Slide 94 text

@holly-cummins.bsky.social #RedHat cloud apps are immutable now CI

Slide 95

Slide 95 text

@holly-cummins.bsky.social #RedHat cloud apps are immutable now CI

Slide 96

Slide 96 text

@holly-cummins.bsky.social #RedHat a highly dynamic runtime in a container is pointless

Slide 97

Slide 97 text

@holly_cummins Java dynamism

Slide 98

Slide 98 text

@holly_cummins Java dynamism build time

Slide 99

Slide 99 text

@holly_cummins Java dynamism build time runtime

Slide 100

Slide 100 text

@holly_cummins Java dynamism build time runtime

Slide 101

Slide 101 text

@holly_cummins Java dynamism packaging (maven, gradle…) build time runtime

Slide 102

Slide 102 text

@holly_cummins Java dynamism build time runtime

Slide 103

Slide 103 text

@holly_cummins Java dynamism build time runtime

Slide 104

Slide 104 text

@holly_cummins Java dynamism > build time runtime load and parse • config files • properties • yaml • xml • etc.

Slide 105

Slide 105 text

@holly_cummins Java dynamism > build time runtime

Slide 106

Slide 106 text

@holly_cummins Java dynamism @ @ > build time runtime • classpath scanning and annotation discovery • attempt to load class to enable/disable features

Slide 107

Slide 107 text

@holly_cummins Java dynamism @ @ > build time runtime

Slide 108

Slide 108 text

@holly_cummins Java dynamism @ @ > build time runtime build a metamodel of the world

Slide 109

Slide 109 text

@holly_cummins Java dynamism @ @ > build time runtime

Slide 110

Slide 110 text

@holly_cummins Java dynamism @ @ > build time runtime start • thread pools • I/O • etc.

Slide 111

Slide 111 text

@holly_cummins Java dynamism @ @ > build time runtime ready to do work!

Slide 112

Slide 112 text

@holly_cummins what if we start the application more than once? @ @ >

Slide 113

Slide 113 text

@holly_cummins what if we start the application more than once? @ @ > @ @ >

Slide 114

Slide 114 text

@holly_cummins what if we start the application more than once? @ @ > @ @ > @ @ >

Slide 115

Slide 115 text

@holly_cummins what if we start the application more than once? @ @ > @ @ > @ @ > @ @ >

Slide 116

Slide 116 text

@holly_cummins what if we start the application more than once? @ @ > @ @ > @ @ > @ @ >

Slide 117

Slide 117 text

@holly_cummins what if we start the application more than once? @ @ > @ @ > @ @ > @ @ > so much work gets redone every time

Slide 118

Slide 118 text

@holly-cummins.bsky.social Hibernate speed example: JTA auto-wiring

Slide 119

Slide 119 text

@holly-cummins.bsky.social Hibernate speed example: JTA auto-wiring Class.forName(“LikelyJTAImplementation”);

Slide 120

Slide 120 text

@holly-cummins.bsky.social Hibernate speed example: JTA auto-wiring Class.forName(“LikelyJTAImplementation”);

Slide 121

Slide 121 text

@holly-cummins.bsky.social Hibernate speed example: JTA auto-wiring Class.forName(“LikelyJTAImplementation”);

Slide 122

Slide 122 text

@holly-cummins.bsky.social Hibernate speed example: JTA auto-wiring Class.forName(“LikelyJTAImplementation”); Class.forName(“APossibleJTAImplementation”);

Slide 123

Slide 123 text

@holly-cummins.bsky.social Hibernate speed example: JTA auto-wiring Class.forName(“LikelyJTAImplementation”); Class.forName(“APossibleJTAImplementation”); Class.forName(“AnotherJTAImplementation”);

Slide 124

Slide 124 text

@holly-cummins.bsky.social Hibernate speed example: JTA auto-wiring Class.forName(“LikelyJTAImplementation”); Class.forName(“APossibleJTAImplementation”); Class.forName(“AnotherJTAImplementation”); …

Slide 125

Slide 125 text

@holly-cummins.bsky.social Hibernate speed example: JTA auto-wiring Class.forName(“LikelyJTAImplementation”); Class.forName(“APossibleJTAImplementation”); Class.forName(“AnotherJTAImplementation”); Class.forName(“NicheJTAImplementation”); …

Slide 126

Slide 126 text

@holly-cummins.bsky.social Hibernate speed example: JTA auto-wiring Class.forName(“LikelyJTAImplementation”); Class.forName(“APossibleJTAImplementation”); Class.forName(“AnotherJTAImplementation”); Class.forName(“NicheJTAImplementation”); Class.forName(“VeryNicheJTAImplementation”); …

Slide 127

Slide 127 text

@holly-cummins.bsky.social Hibernate speed example: JTA auto-wiring Class.forName(“LikelyJTAImplementation”); Class.forName(“APossibleJTAImplementation”); Class.forName(“AnotherJTAImplementation”); Class.forName(“NicheJTAImplementation”); Class.forName(“VeryNicheJTAImplementation”); … ~129 auto-wiring attempts

Slide 128

Slide 128 text

@holly-cummins.bsky.social Hibernate speed example: JTA auto-wiring Class.forName(“LikelyJTAImplementation”); Class.forName(“APossibleJTAImplementation”); Class.forName(“AnotherJTAImplementation”); Class.forName(“NicheJTAImplementation”); Class.forName(“VeryNicheJTAImplementation”); … ~129 auto-wiring attempts every single start.

Slide 129

Slide 129 text

@holly-cummins.bsky.social it’s not just JTA this happens for lots of internal service bindings

Slide 130

Slide 130 text

@holly-cummins.bsky.social JVM footprint example: Hibernate

Slide 131

Slide 131 text

@holly-cummins.bsky.social JVM spends time loading classes for specific databases JVM class for unused database class for unused database class for unused database class for unused database class for unused database class for unused database class for unused database class for unused database class for unused database class for unused database class for unused database class for unused database class for unused database class for unused database class for unused database class for unused database footprint example: Hibernate

Slide 132

Slide 132 text

@holly-cummins.bsky.social JVM spends time loading classes for specific databases JVM class for unused database class for unused database class for unused database class for unused database class for unused database class for unused database class for unused database class for unused database class for unused database class for unused database class for unused database class for unused database class for unused database class for unused database class for unused database class for unused database turns out they’re never used footprint example: Hibernate

Slide 133

Slide 133 text

@holly-cummins.bsky.social JVM spends time loading classes for specific databases JVM turns out they’re never used JIT spends time unloading classes footprint example: Hibernate

Slide 134

Slide 134 text

@holly-cummins.bsky.social Hibernate example: ~500 classes which are only useful if you're running an Oracle database loaded and then unloaded

Slide 135

Slide 135 text

@holly-cummins.bsky.social Hibernate example: ~500 classes which are only useful if you're running an Oracle database loaded and then unloaded every single start.

Slide 136

Slide 136 text

@holly-cummins.bsky.social the true cost of loaded classes isn’t just memory + start time

Slide 137

Slide 137 text

@holly-cummins.bsky.social the true cost of loaded classes isn’t just memory + start time method dispatching:

Slide 138

Slide 138 text

@holly-cummins.bsky.social interface the true cost of loaded classes isn’t just memory + start time method dispatching:

Slide 139

Slide 139 text

@holly-cummins.bsky.social unused implementation the one we want interface unused implementation unused implementation the true cost of loaded classes isn’t just memory + start time method dispatching:

Slide 140

Slide 140 text

@holly-cummins.bsky.social unused implementation the one we want interface unused implementation unused implementation the true cost of loaded classes isn’t just memory + start time method dispatching:

Slide 141

Slide 141 text

@holly-cummins.bsky.social unused implementation the one we want interface megamorphic call slow dispatching unused implementation unused implementation the true cost of loaded classes isn’t just memory + start time method dispatching:

Slide 142

Slide 142 text

@holly-cummins.bsky.social the true cost of loaded classes isn’t just memory + start time the one we want interface

Slide 143

Slide 143 text

@holly-cummins.bsky.social the true cost of loaded classes isn’t just memory + start time the one we want monomorphic call fast dispatching interface

Slide 144

Slide 144 text

@holly-cummins.bsky.social how do we fix all this?

Slide 145

Slide 145 text

@holly_cummins @ @ > build time runtime what if we initialize at build time?

Slide 146

Slide 146 text

@holly_cummins @ @ > build time runtime what if we initialize at build time?

Slide 147

Slide 147 text

@holly_cummins @ @ > build time runtime start • thread pools • I/O • etc. what if we initialize at build time?

Slide 148

Slide 148 text

@holly_cummins @ @ > build time runtime ready to do work! start • thread pools • I/O • etc. what if we initialize at build time?

Slide 149

Slide 149 text

@holly_cummins @ @ > repeated starts are now efficient

Slide 150

Slide 150 text

@holly_cummins @ @ > repeated starts are now efficient

Slide 151

Slide 151 text

@holly_cummins @ @ > repeated starts are now efficient

Slide 152

Slide 152 text

@holly_cummins @ @ > repeated starts are now efficient

Slide 153

Slide 153 text

@holly_cummins @ @ > repeated starts are now efficient

Slide 154

Slide 154 text

@holly_cummins @ @ > repeated starts are now efficient

Slide 155

Slide 155 text

@holly_cummins @ @ > repeated starts are now efficient less wasted work

Slide 156

Slide 156 text

@holly_cummins the quarkus way enables native compilation native (graalvm) @ @ > jvm build time

Slide 157

Slide 157 text

@holly_cummins the quarkus way enables native compilation native (graalvm) @ @ > jvm build time

Slide 158

Slide 158 text

@holly-cummins.bsky.social

Slide 159

Slide 159 text

@holly-cummins.bsky.social doing more up-front

Slide 160

Slide 160 text

@holly-cummins.bsky.social doing more up-front - speeds up start

Slide 161

Slide 161 text

@holly-cummins.bsky.social doing more up-front - speeds up start - shrinks memory footprint

Slide 162

Slide 162 text

@holly-cummins.bsky.social doing more up-front - speeds up start - shrinks memory footprint - improves throughput (!)

Slide 163

Slide 163 text

@holly-cummins.bsky.social implementation corollary: libraries must participate in the build process, not just the runtime process

Slide 164

Slide 164 text

@holly-cummins.bsky.social implementation corollary: libraries must participate in the build process, not just the runtime process you need an extensible build process

Slide 165

Slide 165 text

@holly_cummins have the right plug-points, so the whole ecosystem can become faster

Slide 166

Slide 166 text

@holly-cummins.bsky.social build steps + build items extensible builds

Slide 167

Slide 167 text

@holly-cummins.bsky.social build steps + build items extensible builds any extension can make

Slide 168

Slide 168 text

@holly_cummins #Quarkus #RedHat

Slide 169

Slide 169 text

@holly_cummins #Quarkus #RedHat build steps

Slide 170

Slide 170 text

@holly_cummins #Quarkus #RedHat

Slide 171

Slide 171 text

@holly_cummins #Quarkus #RedHat build items

Slide 172

Slide 172 text

@holly_cummins #Quarkus #RedHat

Slide 173

Slide 173 text

@holly_cummins #Quarkus #RedHat framework automatically determines correct execution order and injects parameters

Slide 174

Slide 174 text

@holly_cummins #Quarkus #RedHat build items are communication mechanism between build steps framework automatically determines correct execution order and injects parameters

Slide 175

Slide 175 text

No content

Slide 176

Slide 176 text

@holly_cummins isn’t long compilation kind of terrible for developers? @ @ >

Slide 177

Slide 177 text

@holly_cummins isn’t long compilation kind of terrible for developers? not if you have live coding :) @ @ >

Slide 178

Slide 178 text

@holly_cummins framework works out required level of reload live coding

Slide 179

Slide 179 text

@holly_cummins file reload live coding

Slide 180

Slide 180 text

@holly_cummins file reload live coding SASS changes detected, will rebuild: [META-INF/ resources/public/stylesheets/live.scss] Files changed but restart not needed - notified extensions in: 0.043s

Slide 181

Slide 181 text

@holly_cummins file reload JVM agent reload live coding

Slide 182

Slide 182 text

@holly_cummins file reload JVM agent reload live coding Application restart not required, replacing classes via instrumentation Live reload performed via instrumentation, no restart needed, total time: 0.180s

Slide 183

Slide 183 text

@holly_cummins full restart file reload JVM agent reload live coding

Slide 184

Slide 184 text

@holly_cummins full restart file reload JVM agent reload live coding Restarting quarkus due to changes in Application$RenardeRequest.class, Application.class, Application$ApplicationGlobals.class, Application$Templates.class. Live reload total time: 1.415s

Slide 185

Slide 185 text

@holly_cummins full restart file reload JVM agent reload not noticeable (quarkus starts fast) live coding Restarting quarkus due to changes in Application$RenardeRequest.class, Application.class, Application$ApplicationGlobals.class, Application$Templates.class. Live reload total time: 1.415s

Slide 186

Slide 186 text

@holly_cummins fast start enables live coding

Slide 187

Slide 187 text

@holly-cummins.bsky.social how to make people efficient

Slide 188

Slide 188 text

@holly-cummins.bsky.social how to make people efficient - make it hard to get wrong

Slide 189

Slide 189 text

@holly-cummins.bsky.social how to make people efficient - make it hard to get wrong - strong typing

Slide 190

Slide 190 text

@holly-cummins.bsky.social how to make people efficient - make it hard to get wrong - strong typing - garbage collection

Slide 191

Slide 191 text

@holly-cummins.bsky.social how to make people efficient - make it hard to get wrong - strong typing - garbage collection - give them a tight feedback loop

Slide 192

Slide 192 text

@holly-cummins.bsky.social how to make people efficient - make it hard to get wrong - strong typing - garbage collection - give them a tight feedback loop - for manual testing - for automated testing

Slide 193

Slide 193 text

@holly-cummins.bsky.social how to make people efficient - make it hard to get wrong - strong typing - garbage collection - give them a tight feedback loop - for manual testing - for automated testing - allow less typing

Slide 194

Slide 194 text

@holly-cummins.bsky.social how to make people efficient - make it hard to get wrong - strong typing - garbage collection - give them a tight feedback loop - for manual testing - for automated testing - allow less typing thank you, Java - strong typing - garbage collection

Slide 195

Slide 195 text

@holly-cummins.bsky.social how to make people efficient - make it hard to get wrong - strong typing - garbage collection - give them a tight feedback loop - for manual testing - for automated testing - allow less typing thank you, Java - strong typing - garbage collection we just covered this

Slide 196

Slide 196 text

@holly_cummins index, index, index (and let your ecosystem use the index)

Slide 197

Slide 197 text

@holly-cummins.bsky.social most frameworks need to…

Slide 198

Slide 198 text

@holly-cummins.bsky.social most frameworks need to… -find all classes + interfaces + methods + fields annotated with @a

Slide 199

Slide 199 text

@holly-cummins.bsky.social most frameworks need to… -find all classes + interfaces + methods + fields annotated with @a -find all classes implementing or extending b

Slide 200

Slide 200 text

@holly-cummins.bsky.social most frameworks need to… -find all classes + interfaces + methods + fields annotated with @a -find all classes implementing or extending b java doesn’t help us nothing in the reflection package does this

Slide 201

Slide 201 text

@holly-cummins.bsky.social jandex

Slide 202

Slide 202 text

@holly-cummins.bsky.social jandex “offline reflection”

Slide 203

Slide 203 text

@holly-cummins.bsky.social we have an index now what?

Slide 204

Slide 204 text

@holly-cummins.bsky.social challenge assumptions.

Slide 205

Slide 205 text

@holly-cummins.bsky.social challenge assumptions. what if developers didn’t have to … ?

Slide 206

Slide 206 text

@holly-cummins.bsky.social #RedHat package com.example; import org.jboss.logging.Logger; public class Thing { private static final Logger log = Logger.getLogger(Thing.class); public void doSomething() { log.info("It works!"); } } example: logging

Slide 207

Slide 207 text

@holly-cummins.bsky.social #RedHat package com.example; import org.jboss.logging.Logger; public class Thing { private static final Logger log = Logger.getLogger(Thing.class); public void doSomething() { log.info("It works!"); } } example: logging import io.quarkus.logging.Log; Log

Slide 208

Slide 208 text

@holly_cummins

Slide 209

Slide 209 text

@holly_cummins don’t make humans tell the computer what the computer already knows

Slide 210

Slide 210 text

@holly-cummins.bsky.social “but isn’t that dynamism expensive?”

Slide 211

Slide 211 text

@holly-cummins.bsky.social no. “but isn’t that dynamism expensive?”

Slide 212

Slide 212 text

@holly-cummins.bsky.social no. - use Jandex to find use-sites of the Log class “but isn’t that dynamism expensive?”

Slide 213

Slide 213 text

@holly-cummins.bsky.social no. - use Jandex to find use-sites of the Log class - inject a static logger field $logger “but isn’t that dynamism expensive?”

Slide 214

Slide 214 text

@holly-cummins.bsky.social no. - use Jandex to find use-sites of the Log class - inject a static logger field $logger - replace all calls of Log.method with calls to $logger.method “but isn’t that dynamism expensive?”

Slide 215

Slide 215 text

@holly-cummins.bsky.social no. - use Jandex to find use-sites of the Log class - inject a static logger field $logger - replace all calls of Log.method with calls to $logger.method … all at build time “but isn’t that dynamism expensive?”

Slide 216

Slide 216 text

@holly-cummins.bsky.social logging: compiled version public class MyService { // injected private static final Logger $logger = Logger.getLogger(Thing.class) public void doSomething() { $logger.info(“It works!”); } }

Slide 217

Slide 217 text

@holly-cummins.bsky.social what if… you could inherit boilerplate Hibernate queries from a superclass, instead of having to write them all? example: hibernate

Slide 218

Slide 218 text

@holly-cummins.bsky.social #RedHat @ApplicationScoped public class GreetingRepository { public Entity findByName(int name) { return find("name", name).firstResult(); } void persist(Entity entity) {} void delete(Entity entity) {} Entity findById(Id id) {} List list(String query, Sort sort, Object... params) { return null; } Stream stream(String query, Object... params) { return null; } long count() { return 0; } long count(String query, Object... params) { return 0; } } example: hibernate with panache

Slide 219

Slide 219 text

@holly-cummins.bsky.social #RedHat example: hibernate with panache @ApplicationScoped public class GreetingRepository implements PanacheRepository { public Entity findByName(int name) { return find("name", name).firstResult(); } }

Slide 220

Slide 220 text

@holly-cummins.bsky.social #RedHat DAO example: hibernate with panache @ApplicationScoped public class GreetingRepository implements PanacheRepository { public Entity findByName(int name) { return find("name", name).firstResult(); } } repository pattern

Slide 221

Slide 221 text

@holly-cummins.bsky.social #RedHat example: hibernate with panache

Slide 222

Slide 222 text

@holly-cummins.bsky.social #RedHat example: hibernate with panache active record pattern @Entity public class Greeting extends PanacheEntity { public String name; public LocalDate issued; @Version public int version; public static List getTodaysGreetings() { return list("date", LocalDate.now()); } }

Slide 223

Slide 223 text

@holly-cummins.bsky.social why was this even hard? public class PanacheEntity { public static List listAll() { // but… how do we know which entity to query? throw new UnobtainiumException(); } }

Slide 224

Slide 224 text

@holly-cummins.bsky.social why was this even hard? public class PanacheEntity { public static List listAll() { // but… how do we know which entity to query? throw new UnobtainiumException(); } } signature can be generic

Slide 225

Slide 225 text

@holly-cummins.bsky.social why was this even hard? public class PanacheEntity { public static List listAll() { // but… how do we know which entity to query? throw new UnobtainiumException(); } } implementation cannot be generic signature can be generic

Slide 226

Slide 226 text

@holly-cummins.bsky.social here’s what we do @Entity public class Order extends PanacheEntity { // … original class // injected in the bytecode // we add a Order.listAll method public static List listAll() { return DbOperations.listAll(Order.class); } }

Slide 227

Slide 227 text

@holly-cummins.bsky.social machine efficiency unlocked human efficiency we broke the tradeoff

Slide 228

Slide 228 text

@holly_cummins #RedHat but magic

Slide 229

Slide 229 text

@holly_cummins #RedHat magic should always be optional + debuggable

Slide 230

Slide 230 text

@holly-cummins.bsky.social why #RedHat

Slide 231

Slide 231 text

@holly-cummins.bsky.social happiness is the most important thing

Slide 232

Slide 232 text

@holly-cummins.bsky.social happiness is the most important thing

Slide 233

Slide 233 text

@holly-cummins.bsky.social happiness is the most important thing developer

Slide 234

Slide 234 text

@holly-cummins.bsky.social lower resource usage saves money

Slide 235

Slide 235 text

@holly-cummins.bsky.social lower resource usage saves money

Slide 236

Slide 236 text

@holly-cummins.bsky.social lower resource usage saves money smaller memory footprint

Slide 237

Slide 237 text

@holly-cummins.bsky.social lower resource usage saves money smaller memory footprint less cpu usage

Slide 238

Slide 238 text

@holly_cummins #RedHat does being faster and lighter mean quarkus is greener?

Slide 239

Slide 239 text

@holly_cummins #RedHat waste is killing the planet

Slide 240

Slide 240 text

@holly_cummins #RedHat e-waste is killing the planet

Slide 241

Slide 241 text

@holly_cummins #RedHat energy waste is killing the planet

Slide 242

Slide 242 text

@holly_cummins #RedHat inefficient software is killing the planet

Slide 243

Slide 243 text

@holly-cummins.bsky.social sustainability saving planet doing stuff we want to do

Slide 244

Slide 244 text

@holly-cummins.bsky.social sustainability saving planet doing stuff we want to do

Slide 245

Slide 245 text

@holly-cummins.bsky.social the vrroooom model gives hope but …

Slide 246

Slide 246 text

@holly-cummins.bsky.social

Slide 247

Slide 247 text

@holly-cummins.bsky.social invented by Dr. Vroom (really!)

Slide 248

Slide 248 text

@holly-cummins.bsky.social naming is the hardest problem in computer science invented by Dr. Vroom (really!)

Slide 249

Slide 249 text

@holly-cummins.bsky.social naming is the hardest problem in computer science

Slide 250

Slide 250 text

@holly-cummins.bsky.social my vrroooom model

Slide 251

Slide 251 text

No content

Slide 252

Slide 252 text

@holly-cummins.bsky.social #RedHat

Slide 253

Slide 253 text

@holly-cummins.bsky.social #RedHat these two columns are almost the same

Slide 254

Slide 254 text

@holly-cummins.bsky.social #RedHat Energy 1 10 100 Time 1 10 100 energy efficiency across programming languages Python Rust Java Go

Slide 255

Slide 255 text

@holly-cummins.bsky.social #RedHat Energy 1 10 100 Time 1 10 100 the trend line is more or less straight energy efficiency across programming languages Python Rust Java Go

Slide 256

Slide 256 text

@holly-cummins.bsky.social #RedHat vrrrooom model: speed is a useful proxy for energy efficiency

Slide 257

Slide 257 text

@holly_cummins #RedHat capacity Source: John O’Hara Setup: • REST + CRUD • large heap • RAPL energy measurement Assumptions: • US energy mix climate impact at low load (single instance) lower is better

Slide 258

Slide 258 text

@holly_cummins #RedHat capacity Source: John O’Hara Setup: • REST + CRUD • large heap • RAPL energy measurement Assumptions: • US energy mix climate impact at low load (single instance) line length shows max throughput lower is better

Slide 259

Slide 259 text

@holly_cummins #RedHat capacity Source: John O’Hara Setup: • REST + CRUD • large heap • RAPL energy measurement Assumptions: • US energy mix climate impact at low load (single instance) quarkus on JVM has the lowest carbon … because it has the highest throughput line length shows max throughput lower is better

Slide 260

Slide 260 text

@holly_cummins #RedHat saving planet coding how we wanna code we beat the tradeoff

Slide 261

Slide 261 text

@holly_cummins #RedHat saving planet coding how we wanna code we beat the tradeoff

Slide 262

Slide 262 text

@holly_cummins #RedHat tl;dpa (too long didn’t pay attention) deployment density lower cloud bill frictionless development experience Medium Nano auto-provision services live coding continuous testing don’t make people tell the computer what the computer already knows greener reducing waste indexes moving work so it hurts less only doing work once

Slide 263

Slide 263 text

slides Holly Cummins Red Hat https://hollycummins.com/quarkus-joy-oredev @holly-cummins.bsky.social