Payara Micro: Here's How to Boost Speed and Efficiency

Photo of Luqman Saeed by Luqman Saeed

Payara Micro is designed from the ground-up to be nimble for lightweight, fast deployments. As such, it is ideal for microservices and cloud environments. However, there may be instances where you may want to squeeze every bit of performance out of it. In such cases, the minimalist configuration of Payara Micro comes in handy.

Thanks to this, you can cut Payara Micro's footprint and speed up startup times, improving the efficiency of your app even more. In effect, depending on your application, you may be able to slash the startup time by up to a third! Here's how.

Why Go Minimalist?

If you're running Payara Micro in a container or a resource-constrained environment, every megabyte and millisecond counts. Minimalist configurations help you optimize resource usage and get your apps up and running quickly in such tight environments. 

Disabling Clustering and Hazelcast

Two common areas to streamline are clustering and Hazelcast. Clustering is great for load balancing and high availability, but it adds overhead. If you don't need these features, you can safely disable clustering to reduce memory usage and improve startup time. Hazelcast provides a distributed data grid for caching and session replication. If these features are not useful within your application, you can disable Hazelcast too.

How to Do It

Here's the command-line option to disable both clustering and Hazelcast:

java -jar payara-micro.jar --noHazelcast

You can also pass these options in a domain.xml file or through the MicroProfile Config API.

As an example, the start time for Payara Micro with Hazelcast is about 4.4 seconds the first time.

Payara Micro 6.2024.5 #badassmicrofish (build 18) ready in 4,432 (ms)

Starting the same instance without Hazelcast using the above command, the startup time drops to about 1.5 seconds.

Payara Micro 6.2024.5 #badassmicrofish (build 18) ready in 1,578 (ms)

Other Optimizations

JVM Options: Experiment with JVM options, such as garbage collection settings and class data sharing, to optimize memory usage.

Wrap-up

Minimalist configurations are a great way to squeeze the most out of Payara Micro, especially in resource-constrained environments. By carefully choosing which features to enable, you can further optimize startup speed and efficiency without sacrificing the core functionality of your application. Download Payara Micro now to get started! Happy Coding!

 Payara Platform  Download Here 

 

 

Related Posts

Comments