Payara Server or Payara Micro?

Payara is a Java EE 8 / Jakarata EE 8 compliant application server, also implementing MicroProfile. Next to the traditional Payara Server, the company also provides you with the option of running your enterprise applications with Payara Micro. Since both editions of Payara can run your Jakarta EE based enterprise applications, which edition should you use, and when? This depends on your situation of course, but before you are able to answer this question for yourself, let’s take a look at how both editions are being used.

Payara Server

The traditional application server allows you to run your Jakarta EE based enterprise applications (WAR or EAR). It is possible to deploy, undeploy and manage your applications when the server is running. The application server can also be configured and tailored to your environment. This means that the application server can take the lion’s share of the work and configuration, while you can keep your applications clean, small and tidy. This is the idea behind Jakarta EE: always try to keep your applications as small as possible, only containing your Jakarta EE based business logic compiled against the various API’s whose implementations are provided by the application server.

Payara Micro

Contrary to the Payara Server, this edition of Payara is provided as a “hollow” JAR. This means that Payara is provided as a single JAR file, containing the tools to run your application server with a java -jar command. As a parameter of this command, you can provide the application to run in this process like this:

java -jar payara-micro-5.193.jar --deploy my-javaee-app.war

You also have the option of packaging your application together with Payara Micro as a single “Uber” JAR:

mvn payara-micro:bundle

Choosing your Payara

Now that you know how to use both editions of Payara, let’s consider which edition to use in what situation. You see, running either edition of Payara on your development, test or production environment should work. The clients of your running servers should in no way notice, or be impacted by the edition that you have chosen.

What cán matter is how you ship and run your applications on Payara. It depends on how you are running Payara in a microservices environment, possibly using Docker, and even an orchestrator like Kubernetes. Or maybe you are traditionally deploying your application on a Payara Server which is running on a server that is being fully managed by you. Either way, both editions of Payara are tailored for their runtime environments, but it is not necessarily true that you can’t use Payara Server for building and deploying microservices. Nor is it necessarily true that you can’t run a “monolith” with Payara Micro. I would like to spend another blog on these contemplations and get into the details, since they are way out of scope for this blog post. For now, let’s focus on where you can definitely benefit from both of them: your local development environment.

Developing with Payara Server

You can easily run your Payara Server integrated in your IDE like Eclipse IDE, Netbeans or IntelliJ. For example, if you configure and manage Payara Server in your IDE like shown below, every time that you want to deploy a new version of your application, your IDE will take care of this process. It will compile and build a new WAR with Maven and deploy it on the managed Payara Server.

Developing with Payara Micro

I have already shown how to start Payara Micro on the command line, pointing to the exact location of the application to deploy. Fortunately, like Payara Server, it also supports (re)deploying an application on a running instance that can even be integrated in your IDE. This takes a little more effort than integrating Payara Server, but can be done by following these steps:

https://blog.payara.fish/how-to-run-and-debug-your-payara-micro-application-with-intellij-idea

Twelve Factor Apps

It often takes only a few (milli)seconds from building the application to redeploying it on both editions of Payara, which increases development speed. And since it doesn’t feel that you have to wait for the deployment to finish, you shouldn’t lose your focus every time a deployment is running. This can save you a lot of personal energy and keep programming a fun thing to do.

So is there any other reason for using either Payara Server or Payara Micro for development, other than ease of integration in the IDE? There is: ideally it matches the edition that is being used in your test, acceptance and production environments. This approach is to avoid encountering any inconsistencies between the editions after development. The tenth rule of Twelve Factor apps dictates this advise:

Make the tools gap small: keep development and production as similar as possible

Still, we haven’t been able to identify any reason to use either Payara edition, other than choosing one and ideally sticking with it in your development process. So where are the deviations between the two?

Profiles

As described in the beginning of this article, Payara Server and Payara Micro can run your Jakarta EE and/or MicroProfile applications. But here’s the catch: Payara Server is based on the “Full” profile, and Payara Micro is based on the “Web” profile. This means that Payara Micro contains a subset of the full Jakarta EE platform. As a result, you can’t use any specifications in your applications that are not supported by the “Web” profile when deploing on Payara Micro.

In order to use the Full profile in your Jakarta EE applications, you can use the following Maven dependency:

<dependency>
    <groupId>jakarta.platform</groupId>
    <artifactId>jakarta.jakartaee-api</artifactId>
    <scope>provided</scope>
</dependency>

And for the Web profile:

<dependency>
    <groupId>jakarta.platform</groupId>
    <artifactId>jakarta.jakartaee-web-api</artifactId>
    <scope>provided</scope>
</dependency>

Operational Management

Another aspect that you can use to base your choice on, is how you are going to manage the running application servers after development. Do you want to, and are you able to, log in to the server’s management console(s) to monitor and manage the running instance? In that case Payara Server should be your choice, since this edition provides lots of operational management tools, also available via a GUI.

Are you shipping and deploying your application in such a way that you are unable to log in to the running instances? This is a very likely situtation when your running instances are being managed by an orchestrator, like Kubernetes. Payara Micro has been designed for these exact environments by being stripped of operational management tools and providing just enough application server runtime to run the applications. This is the reason behind the huge file size diffence between the two editions.

The definitive guide to Payara

To conclude, either Payara edition can be used to develop and run Jakarta EE  and MicroProfile applications. The best choice for your situation however, can basically be defined by following this flow:

Download

Interested in using Payara yourself? You can download both editions at https://www.payara.fish.