By Darryl Mocek on Jan 11, 2013
Writing a tunable application means writing your application in such a way that you can change it's behavior. This is different then having functionality available or not (optionality), it's changing the behavior of your application based on various factors. There's really two types of tunability, build-time and runtime. Within runtime tunability, there's also two types...static and dynamic.
Build-time tunability is when you set certain parameters at build-time. For example, if you use a cache and set the cache size based on a constant in your Java code, you're setting the cache size at build-time. Chaning a build-time tunable feature means you have to (obviously) re-build your application to change it's behavior. If you want to allow the users of your application to change it's behavior, then they'll need to be able to build your application to change it's behavior.
Runtime tunability is when your application changes it's behavior at runtime, so you don't have to re-build for to change its behavior. Runtime tunability can be static, set once when you run the JVM, or dynamic, changing based on certain criteria. The JVM uses runtime static tunability in several ways. One way it uses it is in the heap size. You can change the JVM heap size using a command-line parameter when you run the JVM. Another way is with the garbage collection. You can change the the JVM's garbage collector (GC) by specifying the GC on the command-line when starting the JVM. Both of these change the behavior of the JVM while it's running. Runtime dynamic tunability is when your application changes its behavior based on certain criteria it detects while it's running. For example, if you use large cache's in your application by default, but reduce the cache size when memory gets low, your using runtime dynamic tunability. Runtime tunability is more flexible then build-time and runtime dynamic is even more flexible then runtime static. Runtime dynamic allows your application to adapt as needed on the fly. However, it can be slower as you have to detect the criteria that trigger changes and then change the behavior of your application appropriately. With runtime dynamic tunability, you can move your application from device to device without having to make code changes, rebuild your application, or re-start it.