Java performance monitoring encompasses technologies that track how well Java applications are performing and when there are any performance slowdowns, they diagnose and highlight what is causing the slowdown.
Java is the primary programming language used for modern applications. See our APM survey which has detailed statistics about the popularity of different application technologies.
Java technology can be used for server applications and client applications. While Java performance monitoring focuses on server applications mainly, some of the performance monitoring concepts are also applicable for client applications also.
The JVM is the heart of any Java application. The JVM is the runtime engine of the Java Platform which allows any program written in Java to run on any computer that has a native JVM.
Yes, monitoring of the JVM is possible and is in fact very important. Application developers, Application operations staff and others need to monitor all JVMs used in production. Typically, JVM monitoring is used on Java Management Extensions (JMX) interfaces supported by the JVM. To learn how to monitor the JVM, see https://www.eginnovations.com/jvm-monitoring
JVM monitoring must track the overall CPU usage of the JVM and if there is a high CPU usage scenario, it should highlight which thread(s) is (are) taking CPU. Read more about troubleshooting Java CPU usage issues here.
JVM monitoring also must track the state of all threads running in the JVM. If there are excessive runnable, blocked, deadlocked threads, these situations need to be highlighted to IT admins. Read more about Java threads here.
Monitoring of heap memory usage in the JVM is extremely important. If the JVM is not sized correctly and if the heap usage is close to 100%, the performance of Java applications running on the JVM will be extremely slow. See how to address JVM memory issues in our top 10 Java performance issues blog.
Finally, Java Garbage Collection (GC) needs to be monitored as well. Excessive GC may be an indicator of memory leaks in the application.
No. Monitoring of the JVM is not sufficient. Most applications are run on Java application servers like Tomcat, JBoss, WebLogic, WebSphere, etc. Performance bottlenecks in these application servers can affect application performance. For instance, the maximum number of threads to be used by the application server is a configuration setting. If this value is too low, this will cause performance bottlenecks. Check out these blogs to see how to tune JBoss, Tomcat and WebLogic application servers for maximum performance.
Thread level monitoring at the JVM level can provide some indicator of application code issues. Monitoring of the Java application server may also provide metrics about application components – e.g., which servlet is taking more time to respond. To get deeper insights into application logic, Java transaction tracing is necessary. This is usually done using byte-code instrumentation. To learn more about Java application transaction tracing, see here.
Yes, both JVM monitoring and Java transaction monitoring can provide code-level insights. You can see which thread is a problem, which line of code it is running. With transaction tracing, you can see if a specific database query is taking more time or if an external service call (e.g., a request to an external payment gateway) is taking more time.
Monitoring the application server and JVM is not very expensive. Typical CPU overhead is 0.1-0.3% on an average. Transaction tracing is more expensive as every request has to be traced. Resource usage for this is 1-3%.
Java Server Pages (JSPs) are converted to compiled code and processed. Hence, all the Java monitoring techniques mentioned above are applicable.
Yes, JVMs do expose SNMP interfaces for external monitoring tools. However, the depth and breadth of metrics collected is very limited. For example, it is not possible to see an entire stack trace with SNMP. Hence, SNMP is not recommended for Java performance monitoring.
Yes, there are many free tools for monitoring Java applications. Here is an interesting blog that describes the most popular free Java monitoring tools.
Commercial tools have different licensing models. While some license by CPU cores, sockets, etc. on a server, others require a license for each Java application instance. eG Enterprise Java performance monitoring is licensed by OS (for physical machines and virtual machines) and by nodes (for containerized environments). This makes eG Enterprise a lot more cost-effective than other solutions.