- 3,727,964 Users
- 2,245,512 Discussions
- 7,853,218 Comments
- 380.6K All Categories
- 16 Data
- 362.2K Big Data Appliance
- 7 Data Science
- 2.4K Databases
- 690 General Database Discussions
- 32 Multilingual Engine
- 499 MySQL Community Space
- 10 NoSQL Database
- 7.7K Oracle Database Express Edition (XE)
- 2.8K ORDS, SODA & JSON in the Database
- 424 SQLcl
- 69 SQL Developer Data Modeler
- 185.2K SQL & PL/SQL
- 21.1K SQL Developer
- 2.7K Development
- 3 Developer Projects
- 32 Programming Languages
- 135.9K Development Tools
- 18 DevOps
- 3K QA/Testing
- 388 Java
- 16 Java Learning Subscription
- 14 Database Connectivity
- 72 Java Community Process
- 3 Java 25
- 14 Java APIs
- 141.2K Java Development Tools
- 15 Java EE (Java Enterprise Edition)
- 153K Java Essentials
- 135 Java 8 Questions
- 86.2K Java Programming
- 79 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 18 Java SE
- 13.8K Java Security
- 4 Java User Groups
- 18 Programs
- 157 LiveLabs
- 36 Workshops
- 13 Software
- 7 Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 4 Deutsche Oracle Community
- 18 Español
- 1.9K Japanese
- 4 Portuguese
Improving the Performance of Java EE Applications
by Josh Juneau
Incorporate performance tuning into your development lifecycle.
Java Magazine March/April 2015 Edition
Imagine that your application, after months of development time and lots of testing, is finally ready for production deployment. The application goes live, and for the first few minutes everything seems like a success.
Suddenly you receive a phone call from one of the users telling you that they can’t access the application, because it appears to load indefinitely. Moments later you receive another call, and yet another. It seems as though your application doesn’t allow concurrent access to enough users. This is a nightmare scenario in which the application development team must make critical performance tuning decisions under the gun, and they must make each of the changes to the production environment directly.
Where do you begin in this situation? What could be wrong? Is a server configuration preventing enough connections for your production environment, or does the application code contain a bottleneck that causes the users to wait?
Many applications are not tuned for performance until after they’ve been put into production. Unfortunately, many organizations do not deem performance tuning to be an essential part of the development lifecycle, but rather, treat it as a triage step when things go wrong. To make matters worse, Java EE performance tuning can sometimes be much like finding a needle in a haystack. The cause of the performance issue can lie just about anywhere, from the application source code to a server configuration.
In this article, you’ll see some of the processes that you can use for tuning your Java EE applications pro-actively, so you can try to avoid scenarios like this one.
Approaching the Beast: Proactive Tuning
Performance tuning should be made part of the standard development lifecycle. As such, applications should be designed from the ground up with performance in mind. To be forward-thinking about performance means to consider carefully all approaches for the implementation of application solutions, not just the fastest approach or the one that is easiest to implement. Java EE applications can be particularly difficult to develop around performance, because several points of contention in a Java EE environment can add performance burdens to an application.
The top performance issues experienced in Java EE application environments tend to be related to configuration issues and environment issues. Oftentimes, the applications themselves are coded fine, but the application server to which they are deployed is not tuned correctly or it is configured inappropriately for the applications or the intended user capacity.
To tune properly for a production employment, perform the following steps in the order listed:
- Application tuning
- Server tuning
- Java runtime tuning
- Server operating system and platform tuning
Next, focus on decreasing the chance of incurring performance issues after a production deployment.
Coding for performance. There are bevies of coding situations that might lead to performance overhead in a Java EE application. Java EE applications are executed concurrently, which can lead to bottlenecks, because users might be competing for resources such as web services or databases. Each remote call can add latency, and processes such as serialization can be CPU-intensive, causing further performance degradation. With these kinds of issues in mind, you need to craft Java EE applications carefully, ensuring that proper resource handling is used.
An application’s performance tuning should begin with the source code. Even though the top causes of performance issues in Java EE applications point to the environment, proper coding can still play a key role in an application that performs well.
The following poor-coding practices, among others, can lead to performance issues:
- Over-serialization and deserialization
- Overuse of finalizers
- Too much synchronization
- Not discarding unused variables
- Too many dynamic variables
- Rampant use of
- Sessions that are not released when they are no longer needed
- Failing to close resources (for example, database and network connections)
Performing code reviews is imperative for reducing code that inhibits an application’s performance. While poorly crafted code can slip past multiple developers, the more eyes that examine it, the better. In addition to code reviews, more than one individual should run performance and load tests against an application, and compare results of current tests to those run previously.
Read the full article in Java Magazine at oracle.com/javamagazine