Improving Java Performance
In this article, we'll touch on some common areas for performance issues and share some good resources to guide you in your Java performance optimization.
Join the DZone community and get the full member experience.Join For Free
Java is a fun language to develop in but, at scale, it can give you headaches. One can run into a number of problems that can affect the way a Java app runs. In this article, we'll touch on some common areas for performance issues and share some good resources to guide you in your Java performance optimization.
Some Common Issues
As outlined in this e-book, performance issues may occur in the following areas: database, memory, concurrency. Database-related headaches frequently include long response times, caching issues (either no caching, improper configuration and distribution), and an insufficient number of database connections. When it comes to memory, Stop-To-Wait (STW) garbage collections and memory leaks can make for an unpleasant experience. Meanwhile, concurrency can also get us in trouble with three thread-related issues: thread deadlocks, thread gridlocks, and thread pool configuration gridlocks.
All the problems outlined above inevitably affect the most important aspect of our apps - their performance. To help you sort through the wide range of advice for troubleshooting Java performance issues, we have chosen a few additional articles to get you started.
How to Avoid Them
One list of tips comes from Thorben Janssen in his Dzone article - 11, to be precise, in which he warns us about unnecessary optimization and recommends to come up with a performance test, as well as tackle the most serious issues first, and much more.
Ten more coding specific tips on getting the most out of Java can be found on the Jooq.org blog: the use of StringBuilder, primitives and the stack, avoiding recursion, among others.
More advice can also be found in the e-book by Pierre-Hugues Charbonneau (referenced on Dzone), in which he discusses JVM internals, class loading, troubleshooting and monitoring, garbage collection, Java concurrency, application budgeting, as well as tools.
The Happy Ending
Running Java applications at scale requires the ability to identify and resolve performance issues which include tuning your application's use of resources. Based on your app's architecture and resource usage, there are a number of tools and techniques at your disposal for creating happy end-users and great UI experiences. Happy end-users === happy coders (and their bosses)! We hope these few articles can be of use to you.
If you enjoyed this article and want to learn more about Java Collections, check out this collection of tutorials and articles on all things Java Collections.
Published at DZone with permission of Nataliya Muriy, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.