|
|
|
Back to newsletter 046 contents
What is a "classic tuning parameter"?
This is an adjustable parameter or variable in your application that can be set to a number of different values, where some of the permissable values are more optimal for performance than others. The parameter or variable can have a defined set of discrete values, or often one of a continuous range of a values. Each different value alters the performance of the application, and the tuning procedure is to identify or come near to the optimal values by analysis of the performance variations obtained by using some subset of allowable values.
Well, that was a mouthful. Let's look at a concrete example, the JVM heap size. Ideally, you would tune the object creation within your application, and the young generation parameters and the garbage collection (GC) algorithm to avoid any old generation GCs. But often you unavoidably get old generation GC, at least for some versions of your application before you can tune the code adequately. In this situation, you may need to identify the optimal heap size. Why not just set it to "as big as possible"?
Ah, that's because the heap size is a class tuning parameter. A bigger value increases the duration of the GC pause, because the time taken for old generation GC is proportional to the size of the heap. Really big values also incur the possibility of the underlying OS paging the heap which is really really bad for performance. Smaller values mean that the GC pause is smaller, but then the GC occurs more often, and the overall time spent in GC increases, leading to a less efficient application overall. Really small values can lead to the heap thrashing, where there is only enough space to create some objects which must be immediately be reclaimed to allow more objects in; ultimately too small a value leads to an out-of-memory error.
So somewhere between too big and too small is just right (the goldilocks value), when the tradeoff between minimizing GC pause time and minimizing overall GC time is reached. That's a classic tuning parameter. You choose some values to test the performance with, analyze which values are more optimal and preferably why those values are more optimal (though that is not essential), and zero in on a more optimal value for the heap.
Classic tuning parameters are present in almost every application (the optimal buffer size, the optimal cache size, the optimal time-to-live for sessions or cache elements, etc). Algorithmic improvements can sometimes eliminate such a tuning parameter. For example, the concurrent GC algorithm runs GC concurrently with the application, so that the pause time is minimized. In this case, it is possible that the heap no longer needs to be tuned, and the biggest heap that fits into the OS without paging may be ideal in most cases.
The JavaPerformanceTuning.com team
Back to newsletter 046 contents