Tuning The JVM - Is It Still As Critical?
Posted by Mike Brunt at 7:28 AM
13 comments - Categories: Default | ColdFusion | JRun-J2EE
Those who have read my numerous blog posts on tuning the JVM will no doubt be wondering why I pose this question. There is no doubt that the settings in the jvm.config file as shipped with installs of ColdFusion are largely inadequate but this can be affected fairly significantly by simply adding start sizes to the total memory and permanent generation, like this:
-Xms512m -Xmx512m
-XX:PermSize=96m -XX:MaxPermSize=192m
The two left hand numbers are added to the default ones in the jvm.config that comes with ColdFusion and will have a significant effect on improving performance. I am not saying there are not other things which can be done but in the past 10 years adding these two arguments has had the most beneficial effect, in my experience. Of course the actual numbers could be higher in a good amount of Ram is available.
Another factor which improves with each new version of each JVM are the default characteristics, when we consider that a JVM is at the heart of almost every kind of Java application it is remarkable that we have not seen more problems with the default settings.
So here is what I feel is becoming as important as tuning the JVM and that is reducing the amount of work it has to do. The advent of heavily CFC based frameworks certainly impacted JVM performance detrimentally, I have seen that many, many times. Another way and in some ways a more dramatic way to help is by reducing the amount of work caused by each incoming request and the best way to do this is to get very accurate and creative with caching. This came home to me at the O'Reilly Velocity conference in San Jose and I will be creating a series of blog posts centered around just that, more soon...
Mike Kelp wrote on 08/23/09 11:24 AM
Great post!I especially agree with your points on CFC based frameworks except that unlike many, I disagree that CFCs are a big hog in CF. I argue that similar to Java, creating hundreds of objects to do nothing but display data and not use any of the logical functionality of the objects is pointless. There is a reason primitives, collections, hashtables, etc. exist and you certainly don't create a Boolean object everytime you need a bit for true/false for example.
In a service based architecture, which is the way the web is designed and handles the load it does, there should be little reason to have the same functionality instantiated so many times by returning arrays of objects / cfcs, etc. with every event. This is how the memory usage of an application becomes more volatile. Point being, while cf objects are no doubt heavier and more powerful than POJOs, I think what the community has mistaken is that the cost is not the problem, but the cost/benefit understanding people in general have as it is a bit different from the general purpose usage of Java objects.
I hope in my rambling, that I've added something to the conversation haha.