Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Quarkus - Rethinking what we already know

Quarkus - Rethinking what we already know

Quarkus rethinks how we develop using the frameworks we already know how to use to make developers more productive and deliver more efficient applications. Live code everything, locally or remotely while the application is running in a Kubernetes pod or Docker container. Boot applications in milliseconds while consuming only 10's of MB of RAM.

Presented at the San Francisco JUG

John Clingan

August 26, 2020
Tweet

Other Decks in Programming

Transcript

  1. A different approach to presenting Quarkus “Quarkus feels familiar and

    new at the same time” Tweet circa March 2019
  2. What we already know Spring APIs, Java EE, Eclipse MicroProfile

    @Inject @RestClient GreetingClient client; @GET @Path(“/greeting) @Produces(MediaType.APPLICATION_TEXT) @Fallback(fallbackMethod=”greetFallback”) @Transactional public String greeting() { return client.greeting(); } String greetFallback() { return “Hello”; } @GetMapping(path = "/greet/{id}", produces = "text/plain") public String greeting() { return myBean.getGreeting() } ... @Bean public RestTemplate template(RestTemplateBuilder builder) { return builder.build(); } ... String getGreeting(RestTemplate template) { return restTemplate.getForObject(url, String.class); } Java EE + MicroProfile Spring APIs Jakarta
  3. Rethinking what we already know Combine APIs, imperative and reactive

    too Java EE (Subset) MicroProfile (All specs) Spring APIs (Subset) Quarkus Other JPA (Hibernate) Config Spring Boot Properties Reactive Routes gRPC JAX-RS (RESTeasy) Fault Tolerance Spring Cloud Config Client Qute Quartz CDI (Arc) Health Spring Data JPA Hibernate ORM / MongoDB with Panache Camel JSON-B (Yasson) JWT Auth Spring Web Eclipse Vert.x Redis Client Bean Validation (Hibernate Validator) Reactive Streams Spring Security Mutiny Flyway ... ... ... ... ...
  4. Rethinking what we already know Combine APIs @Inject @RestClient GreetingClient

    client; @GetMapping(path = "/greet/{id}", produces = "text/plain") @Fallback(fallbackMethod=”greetFallback”) @Transactional public String greeting() { return client.greeting(); } String greetFallback() { Return “Hello”; } Java EE + MicroProfile + Spring APIs • Begin with what you know • Ease into other Quarkus benefits • Drop into existing environments • Use specifications when you want to Benefits include ...
  5. What we already know Round trip Java development Edit /

    Save mvn package java -jar Refresh Browser
  6. Rethinking what we already know Live Coding Edit / Save

    Refresh • Any IDE (No IDE plugins/tooling) • Code • property files / static files • pom.xml Works with ... mvn quarkus:dev
  7. Container platform Node NodeJS NodeJS NodeJS NodeJS NodeJS NodeJS NodeJS

    Node Go Go Go Go Go Go Go Go Go Go Go Go Go Go Node HotSpot Heap HotSpot Heap HotSpot Heap HotSpot Heap What we already know Java runs in containers, but others run better
  8. Java Virtual Machine (Hotspot) Application Server App Dynamic Application Frameworks

    Architecture: Microservices Deployment: Single App App Lifecycle: Days Memory: 100MBs+ RAM Startup Time: Seconds No Change Since early 2000’s What we already know Java runtimes wrap existing frameworks
  9. @ @ </> Packaging (maven, gradle…) Build Time Runtime How

    does a framework start? What we already know We need to rethink Java runtimes
  10. @ @ </> Load config file from file system Parse

    it Build Time Runtime How does a framework start? What we already know We need to rethink Java runtimes
  11. @ @ </> Classpath scanning to find annotated classes Attempt

    to load class to enable/disable features Build Time Runtime How does a framework start? What we already know We need to rethink Java runtimes
  12. How does a framework start? @ @ </> Build its

    model of the world. Build Time Runtime What we already know We need to rethink Java runtimes
  13. How does a framework start? @ @ </> Start the

    management (thread, pool…) Build Time Runtime What we already know We need to rethink Java runtimes
  14. Rethinking what we already know Quarkus App Optimized Application Frameworks

    Architecture: Microservices, Serverless Deployment: Single App App Lifecycle: Seconds to Days Memory: 10MBs+ RAM Startup Time: Milliseconds Java Virtual Machine (Hotspot) Optional
  15. How does a Quarkus start? @ @ </> Runtime. Start

    the management (thread, pool…) Build Time Rethinking what we already know Quarkus
  16. What we already know Deploy to Kubernetes apiVersion: v1 kind:

    ServiceAccount metadata: annotations: prometheus.io/path: /metrics prometheus.io/port: 8080 app.quarkus.io/commit-id: 060a82e7af185333ba6acf059dc7afe7a982979e app.quarkus.io/vcs-url: https://github.com/jclingan/jug.git app.quarkus.io/build-timestamp: 2020-08-18 - 23:08:16 +0000 prometheus.io/scrape: "true" labels: app.kubernetes.io/name: jug app.kubernetes.io/version: 1.0.0-SNAPSHOT name: jug --- apiVersion: v1 kind: Service metadata: annotations: prometheus.io/path: /metrics prometheus.io/port: 8080 app.quarkus.io/commit-id: 060a82e7af185333ba6acf059dc7afe7a982979e app.quarkus.io/vcs-url: https://github.com/jclingan/jug.git app.quarkus.io/build-timestamp: 2020-08-18 - 23:08:16 +0000 prometheus.io/scrape: "true" labels: app.kubernetes.io/name: jug app.kubernetes.io/version: 1.0.0-SNAPSHOT name: jug spec: ports: - name: http nodePort: 30202 port: 8080 targetPort: 8080 selector: app.kubernetes.io/name: jug app.kubernetes.io/version: 1.0.0-SNAPSHOT type: NodePort --- apiVersion: apps/v1 kind: Deployment metadata: annotations: prometheus.io/path: /metrics prometheus.io/port: 8080 app.quarkus.io/commit-id: 060a82e7af185333ba6acf059dc7afe7a982979e app.quarkus.io/vcs-url: https://github.com/jclingan/jug.git app.quarkus.io/build-timestamp: 2020-08-18 - 23:08:16 +0000 prometheus.io/scrape: "true" labels: app.kubernetes.io/name: jug app.kubernetes.io/version: 1.0.0-SNAPSHOT name: jug spec: replicas: 1 selector: matchLabels: app.kubernetes.io/name: jug app.kubernetes.io/version: 1.0.0-SNAPSHOT template: metadata: annotations: prometheus.io/path: /metrics prometheus.io/port: 8080 app.quarkus.io/commit-id: 060a82e7af185333ba6acf059dc7afe7a982979e app.quarkus.io/vcs-url: https://github.com/jclingan/jug.git app.quarkus.io/build-timestamp: 2020-08-18 - 23:08:16 +0000 prometheus.io/scrape: "true" labels: app.kubernetes.io/name: jug app.kubernetes.io/version: 1.0.0-SNAPSHOT spec: containers: - env: - name: KUBERNETES_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace - name: QUARKUS_PROFILE value: remotedev - name: QUARKUS_LAUNCH_DEVMODE value: "true" image: jclingan/jug:1.0.0-SNAPSHOT imagePullPolicy: IfNotPresent livenessProbe: failureThreshold: 3 httpGet: path: /health/live port: 8080 scheme: HTTP initialDelaySeconds: 0 periodSeconds: 30 successThreshold: 1 timeoutSeconds: 10 name: jug ports: - containerPort: 8080 name: http protocol: TCP readinessProbe: failureThreshold: 3 httpGet: path: /health/ready port: 8080 scheme: HTTP initialDelaySeconds: 0 periodSeconds: 30 successThreshold: 1 timeoutSeconds: 10 serviceAccount: jug YAML • Deployment • Health Check Probes • Service • Service Account
  17. Rethinking what we already Know Deploy to Kubernetes • Deployment

    ◦ Git commit URL ◦ Commit id ◦ App build timestamp • Health Check Probes • Service / NodePort/Route • Service Account mvn clean install \ -Dquarkus.kubernetes.deploy=tru e
  18. What we already know Round trip Java development w/Kubernetes Edit

    / Save mvn package Refresh Browser docker build / push kubectl apply
  19. Rethinking what we already know Live Coding w/Kubernetes Edit /

    Save Refresh • Any IDE (No IDE plugins/tooling) • Code • property files / static files • pom.xml • Remote development (Ex: Docker and Kubernetes) Works with ... mvn quarkus:remote-dev
  20. What we now know Pick the API framework you know

    or want Live Code. Everything. Locally or remotely
  21. What we now know Pick the API framework you know

    or want Live Code. Everything. Locally or remotely Runtime efficiency
  22. What we now know Pick the API framework you know

    or want Live Code. Everything. Locally or remotely Runtime efficiency Kubernetes Native Java
  23. www.j4k.io An open forum that brings together open source communities,

    developers, vendors and users of apps on K8s, to educate, exchange ideas, and promote solutions & innovations, with an emphasis on cloud-native Java.