Throughput is the amount of productive work done by your application in a given time period. This brings the question what is productive work? What is non-productive work?
Productive Work: This is basically the amount of time your application spends in processing your customer’s transactions.
Non-Productive Work: This is basically the amount of time your application spend in house-keeping work, primarily Garbage collection.
Let’s say your application runs for 60 minutes. In these 60 minutes, let’s say 2 minutes is spent on GC activities.
It means application has spent 3.33% on GC activities (i.e. 2 / 60 * 100), it means application throughput will become 96.67% (i.e. 100 – 3.33).
What causes poor throughput?
When application suffers from one of the following problems, its throughput will degrade:
- Long GC pauses
- Memory Leak
- Consecutive Full GC
- Application waiting for CPU & I/O resources
1. Long GC Pauses
When application experiences long GC pauses, then throughput will degrade. To understand what causes long GC pauses and how to reduce them, please refer to this article.
2. Memory Leak
When application experiences a memory leak, JVM will start to invoke Full GCs repeatedly. When Full GCs are invoked repeatedly, then the application will be spending more time on the Garbage collection than in processing the customer transactions. Here is an article which talks about how to diagnose memory leak?.
3. Consecutive Full GC
Sometimes, Full GCs might run consecutively in your application. When they run consecutively, throughput of the application degrades as Full GC takes time to run. Here is an article which talks about consecutive Full GCs & how to eliminate it?
4. Application waiting for CPU & I/O resources
If multiple processes are running on the server where your application is running then, there is possibility that your application might be crunched for CPU & I/O cycles. Under such circumstances also application’s throughput will degrade. To learn more about this problem, see this article.