How dev mode differs from a production application
This document explains how the dev mode in Quarkus differs from a production application.
Feature sets aside, the Quarkus application that is run under dev mode differs architecturally from the production application (i.e. the one that is run using
java -jar …).
In dev mode, Quarkus uses a ClassLoader hierarchy (explained in detail here) that enables the live reload of user code without requiring a rebuild and restart of the application.
In a production application, the aforementioned class loading infrastructure is entirely absent - there is a single, purpose built ClassLoader that loads (almost) all classes and dependencies.
In keeping with the mantra of providing developer joy, Quarkus provides a host of features when dev mode is enabled. The most important features are:
This mightily important feature needs no introduction and has already been mentioned in the architectural differences section.
Quarkus provides a very useful UI accessible from the browser at
/q/dev-ui. This UI allows a developer to see the state of the application, but also provides access to various actions that can change that state (depending on the extensions that are present). Examples of such operations are:
Changing configuration values
Running Database migration scripts
Clearing of caches
Running scheduled operations
Building a container
A new Dev UI has been implemented in Quarkus 3.x. Not all the features are available yet. You can still access the previous version of the Dev UI using: http://localhost:8080/q/dev-ui/.
In an effort to make development errors very easy to diagnose, Quarkus provides various detailed error pages when running in dev mode.
quarkus-hibernate-orm extension will run the
import.sql script in
src/main/resources when Quarkus is running in dev mode. More details can be found here.
When testing or running in dev mode Quarkus can even provide you with a zero config database out of the box, a feature we refer to as Dev Services. More information can be found here.
quarkus-smallrye-openapi extension will expose the Swagger UI when Quarkus is running in dev mode. Additional information can be found here.
quarkus-smallrye-graphql extension will expose the GraphQL UI when Quarkus is running in dev mode. More details can be found here.
quarkus-smallrye-health extension will expose the Health UI when Quarkus is running in dev mode. This section provides additional information.
quarkus-mailer extension will enable an in-memory mock mail server when Quarkus is running in dev mode. See this for more details.
The gRPC Reflection Service is enabled in dev mode by default. That lets you use tools such as
grpcurl. In production mode, the reflection service is disabled. You can enable it explicitly using
In dev mode,
quarkus.grpc.server.instanceshas no effect.
In dev mode, minimizing the runtime footprint of the application is not the primary objective (although Quarkus still starts plenty fast and consumes little memory) - the primary objective is enabling developer joy. Therefore, many more classes are loaded and build time operations also take place every time a live-reload is performed.
In contrast, in a production application the main objective for Quarkus is to consume the least amount of memory and startup in the smallest amount of time. Thus, when running the production application, build time operations are not performed (by definition) and various infrastructure classes needed at build time are not present at all at runtime. Furthermore, the purpose built ClassLoader that comes with the fast-jar package type ensures that class lookup is done as fast as possible while also keeping the minimum amount of jars in memory.
Perhaps the most important reason why dev mode applications should not be run in production is that the dev mode allows reading information that could be confidential (via the Dev-UI) while also giving access to operations that could be destructive (either by exposing endpoints that should not be available in production application or via the Dev-UI).
When a native executable is created (explained in detail here), it is always built from a production application.