Slide 1

Slide 1 text

Ondro Mihályi @OmniFishEE Piranha Cloud From Eclipse GlassFish to super fast Cloud and Serverless Java

Slide 2

Slide 2 text

Ondro Mihályi @OmniFishEE Application servers Designed for reliability and security Provide a lot of robust features Designed for management during runtime Designed to run for a long time (and restart rarely)

Slide 3

Slide 3 text

Ondro Mihályi @OmniFishEE Application servers Therefore Are usually slow to start

Slide 4

Slide 4 text

Ondro Mihályi @OmniFishEE Java startup time Plain Java starts fast In milliseconds, way faster than application servers

Slide 5

Slide 5 text

Ondro Mihályi @OmniFishEE How fast can Jakarta EE be? Anything close to plain Java start-up times?

Slide 6

Slide 6 text

Ondro Mihályi @OmniFishEE What is Jakarta EE (formerly Java EE) Just an API Common API provided by many servers Collection of smaller APIs Boot time an implementation detail

Slide 7

Slide 7 text

Ondro Mihályi @OmniFishEE API versus implementation Learn and use a single API Choose from multiple implementations

Slide 8

Slide 8 text

Ondro Mihályi @OmniFishEE API versus implementation Learn and use a single API or...

Slide 9

Slide 9 text

Ondro Mihályi @OmniFishEE Eclipse GlassFish Opensource Jakarta EE Full Profile app server Robust Lot of features Easy management

Slide 10

Slide 10 text

Ondro Mihályi @OmniFishEE History of GlassFish 2006-2012 – supported by Sun MS, later Oracle 2013-2017 – maintained by Oracle, no support 2018-now – maintained within the Eclipse Foundation ● supported by multiple companies 2022 – Eclipse GlassFish 7 provides Jakarta EE 10

Slide 11

Slide 11 text

Ondro Mihályi @OmniFishEE The current status of GlassFish Jakarta EE 10 Java 11 to 18 MicroProfile Config Jakarta MVC Embedded GlassFish Lots of fixes and new tests

Slide 12

Slide 12 text

Ondro Mihályi @OmniFishEE GlassFish Embedded Start from a Java app GlassFishRuntime.bootstrap() .newGlassFish().start(); Faster startup Simple Flexible

Slide 13

Slide 13 text

Ondro Mihályi @OmniFishEE Built on well‑known projects GlassFish is modular Jersey (REST) Eclipselink (JPA) Tyrus (WebSockets) Weld (CDI) Exousia (Authorization) Eleos (Authentication) Expressly (EL) Transact (JTA) WaSP (JSP) More modules extracted

Slide 14

Slide 14 text

Ondro Mihályi @OmniFishEE Piranha Cloud Introducing Piranha Cloud Exousia (Authorization) Eleos (Authentication) Expressly (EL) Transact (JTA) WaSP (JSP) Jersey (REST) Eclipselink (JPA) Weld (CDI)

Slide 15

Slide 15 text

Ondro Mihályi @OmniFishEE Piranha Cloud Opensource Subset of Jakarta EE APIs Bare‑bone Fast Highly extensible

Slide 16

Slide 16 text

Ondro Mihályi @OmniFishEE Architecture of Piranha Cloud Bare‑bone Servlet container Jakarta EE profiles Extensions to add features Servlets to add features

Slide 17

Slide 17 text

Ondro Mihályi @OmniFishEE Piranha Cloud extensions Jakarta EE Pluggable functionality Extension groups From GlassFish and other projects Hazelcast, third-party extensions More extensions in a single one

Slide 18

Slide 18 text

Ondro Mihályi @OmniFishEE Piranha Cloud distributions Executable JARs Package multiple extensions Embed HTTP server Run from command line Coreprofile Webprofile Piranha Server

Slide 19

Slide 19 text

Ondro Mihályi @OmniFishEE Embedded Piranha var piranha = new EmbeddedPiranhaBuilder() .servletMapped(MyServlet.class, "/") .build(); piranha.start(); var httpProc = new HttpWebApplicationServerProcessor(piranha); var httpServer = new DefaultHttpServer(8080, httpProc, false); httpServer.start();

Slide 20

Slide 20 text

Ondro Mihályi @OmniFishEE Embedded Piranha without HTTP listener var piranha = new EmbeddedPiranhaBuilder() .servletMapped(MyServlet.class, "/") .build(); piranha.start(); var request = new EmbeddedRequestBuilder().build(); var response = piranha.service(request); System.out.println(response.getResponseAsString());

Slide 21

Slide 21 text

Ondro Mihályi @OmniFishEE Piranha Server architecture Piranha Server HTTP listener Embedded Piranha App 1 Embedded Piranha App 2 Embedded Piranha App 3 /app1 /app3 /app2

Slide 22

Slide 22 text

Ondro Mihályi @OmniFishEE Comparison of startup times (Simple app with a single Jakarta EE Servlet)

Slide 23

Slide 23 text

Ondro Mihályi @OmniFishEE Where startup speed matters? Serverless Minimize cold starts Remove what’s useless Optimize what’s left

Slide 24

Slide 24 text

Ondro Mihályi @OmniFishEE Piranha in AWS Lambda No HTTP listener Init in static block Starts fast Custom Java 17 layer (for now)

Slide 25

Slide 25 text

Ondro Mihályi @OmniFishEE Comparison of startup times – close up (Simple app with a single Jakarta EE Servlet)

Slide 26

Slide 26 text

Ondro Mihályi @OmniFishEE Conclusion? Same Jakarta EE APIs, implementations differ GlassFish has improved Jakarta EE not slow, servers are slow Piranha goes where GlassFish can’t get

Slide 27

Slide 27 text

Ondro Mihályi @OmniFishEE Questions

Slide 28

Slide 28 text

Ondro Mihályi @OmniFishEE OmniFish - Jakarta EE Consulting & Support Jakarta EE Consultancy (migrations, tuning) Jakarta EE Application Development GlassFish Server Support omnifish.ee Jakarta EE Training