Welcome to Perforce's Java Productivity Toolkit demonstration, with a microservices-based application running in Docker. Today we'll be walking through the two products in the Java Productivity Toolkit, JRebel and XRebel, and we'll show how this will improve your development process.
JRebel with Microservices and Docker
(:24)JRebel is the first product that we will be reviewing in this demonstration. JRebel is a JVM plugin that skips the rebuild and redeploy steps, offering real-time change visibility while maintaining application state. It works out of the box with all popular IDEs, application servers, VMs, and build tools. To demonstrate JRebel, we're using a microservices-based version of the Spring Pet Clinic demo application. Each service is running in its own Docker container.
To show JRebel in action, let's make a change that affects two of our services. We're going to add a new end-point into the visit service, and add a tab in the UI. To do this, we need to change the UI service to add the visits tab. Next, we're going to open the visit service and add an end-point that returns all visits. After saving the files, let's update the services with JRebel by clicking the remote server sync button. On the server side, JRebel will pick up the code changes and reload them immediately, without the need to rebuild or restart the Docker containers. So, that was the JRebel development process without rebuilding or restarting the application.
XRebel with Microservices and Docker
(1:37) XRebel is the second product that we will be taking a look at today. XRebel is a JVM plugin that provides developers real-time feedback on application performance to easily track code impact across distributed development environments. It monitors database interactions, messaging and background jobs for excessive resource usage, and easily finds hidden exceptions. Here you can see the XRebel tool bar on the bottom left part of the browser. XRebel provides an application profiling view displaying a trace tree that will show you slow or otherwise interesting methods invoked by your HTTP requests. The percentage right next to the method name indicates the time spent in the method and all the methods below in the call hierarchy. The satellite icon indicates a call to a remote service.
In the current case, the UI component is calling a visit service to get the visits data. XRebel will allow us to track the request throughout all services that are running on the XRebel agent. The second major feature of XRebel is the IO view. Here, XRebel will show the IO queries executed by your request, including calls to SQL and NoSQL databases and JMS. For SQL queries, XRebel shows the original query syntax, execution time, and the number of rows returned. Similar queries are grouped together, so N + 1 problems are easy to spot.
Using JRebel and XRebel With Microservices and Docker
(3:03) Now that we've looked at each product individually, I would like to show how these two products together can improve the development experience to provide ultimate Java productivity. Let's head over to the veterinarians page. Within the XRebel toolbar, we can quickly notice that we are spending a significant amount of time calling the vets service. And if we open the profiling view, we can see that we are spending over 200 milliseconds calling the vets microservice, and if we look into the method calls within that service, we can see that the time spent in the initialized method is significant. And if we proceed to the IO view, we can see that each vet specialty row is fetched with a separate query. That is a classic N + 1 problem that can really hurt the performance. Inside of IntelliJ we will resolve this by specifying the batch size. JRebel will help by reloading this without a restart. I'll save the file and press the JRebel remote sync button to push the changes to the vet service.
Proceed to the application and refresh the page. XRebel shows the performance of the vet service call improved considerably. As you can see, the powerful combination of JRebel and XRebel improves the development process by removing the service restarts and identifying issues on the fly.
Try JRebel and XRebel for Free
(4:19) If you want a more hands-on experience with the Java Productivity Toolkit, you can try JRebel and XRebel with a free 10-day trial. Please visit us at jrebel.com to get started.