Aug 23 2009

Tuning The JVM - Is It Still As Critical?

Posted by Mike Brunt at 7:28 AM 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

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.
charlie arehart

charlie arehart wrote on 08/23/09 12:06 PM

Mike, glad to hear you repeat this idea that sometimes jvm "tuning", per se, may not be quite as critical for some problems as just making some modest configuration changes like these.

That said, while setting the heap to be preallocated (xms equal to the xmx) does solve some problems and so is a good recommendation, I find it curious that for the permgen you've focused only on setting a min for it, rather than raising its max.

I've just seen plenty of instances of CF getting an outofmemory error which ultimately proved to be in the permgen, so raising the maxpermsize above the default seems a more common solution to many problems in my experience than setting its min (permsize). As you say, of course, raising either the xmx or the maxpermsize should be done with caution, ensuring there is adequate memory.

But I'm assuming you have some experience in mind that led you to say mention just the permsize, so perhaps that's something you'll elaborate on in the future threads you hint at.

Also, it seems worth repeating here (as the entry should get a fair bit of views) that another great example of an easy jvm improvement that doesn't require "tuning" is simply updating the JVM from the default version implemented at installation by CF. I know you know it, but since it was unsaid, I wanted to add it.

Of course, we should clarify that Adobe doesn't formally support anything but the version implemented at installation, but the bug fixed by 1.6_10 is just so important (for CF 8) that many can't wait for Adobe to update the supported JVM version in CF9. They just have to understand the risks.

And even in 6 and 7, the minor updates after the base 1.4.2 version were substantial, and at least the update to 1.4.2_11 was supported by Adobe for the DST change ( They should certainly at least consider that. Updates to the JVM can have important impacts on CF. Of course, there are many moving parts and no recommendation is always best for every case.

Hope those thoughts are helpful to your readers, and certainly I mean no disrespect in dropping this in here. I will welcome your thoughts on all this, and I'm sure your readers will, too. :-) Thanks for having the discussion.
Mike Brunt

Mike Brunt wrote on 08/23/09 12:21 PM

@Mike thanks for taking the time to comment and give us some good thought points. I have tended to look at ColdFusion and JRun over the past 7-8 years mainly from the perspective of garbage collection in the JVM and in a fairly simple way, in many cases trying to deal with collecting objects in the new or young generation and making sure the permanent generation does not hit 100% usage. My observation is this, in applications using CFC based frameworks and heavily based on CFC's it is literally impossible to create a large enough new-young generation and I am talikng of clients on 64-bit systems with 4GB allocated to the new-young generation alone. Thanks again for the comment.
Mike Brunt

Mike Brunt wrote on 08/23/09 12:28 PM

@Charlie I absolutely welcome your input at all times and thank you for that. In almost all the cases I have seen the permanent generation rarely needs more than 80MB I have had clients where that was not enough and have raised the start and max there, to no more than 256MB but this is rare, however you do make a good point. The point about "upgrading" the JVM is also spot on and I appreciate your pointing that out. My main point in this piece is a lead-in to a much larger posting which I hope to put out tomorrow (Monday August 24, 2009).
Mike Brunt

Mike Brunt wrote on 08/23/09 8:22 PM

@Gary thanks for your comment I have a quick couple of questions, how much RAM do you have and is this a 64-bit server.
charlie arehart

charlie arehart wrote on 08/24/09 7:36 AM

@Mike, thanks. I meant to add at the end of my (already long) comment that I did realize your main point was more on why to focus on caching and cause less work against the JVM in the first place. Yes, good point (just like caching of data can reduce the need to focus on at least some tweaking SQL and the DB connection).

If only then on this entry, I hope we can expand a little on these other aspects that have been raised.

For instance, it's interesting to hear that permgen filling is not something you've seen often and that 80m has been enough. In that case, what was the benefit of setting the permsize (since the maxpermsize would seem enough). Like I said, I figured you had some reason to mention adding the former and not changing the latter.

Not trying to sap your energy/time from the other caching entries you want to focus on. If it may be a while before you can attend to commenting on this point, no worries.

@Gary, good point. Sorry I didn't elaborate. Naturally, one should tend to apply updates/hotfixes (to CF or the JVM) only when you know you have a problem they fix. The one that the 1.6.0_10 update fixed was a class loading bug that most noticed as affecting CFC loading (I've seen it also affect just page loading on servers with many sites that didn't even use a lot of CFCs.)

There's a good blog entry discussing jvm updates for both CF 6 and 7 at Hope that helps.
Mike Brunt

Mike Brunt wrote on 08/24/09 8:19 AM

@Charlie regarding the PermGen it is the start size setting that makes the difference. There have been times where I have seen untoward behaviour where for whatever the reason no PermGen start size is set and the PermGen causes issues. So setting a start size is important and leaving the max size as-is (192M) is not a problems. Thanks again Charlie.
charlie arehart

charlie arehart wrote on 08/24/09 9:48 PM

Thanks, Mike. Interesting to hear that setting a permgen startsize has fixed problems (but there are some who have had problems solved by increasing the permgen.) Just goes to show there are no one-size-fits-all solutions. And as many will attest, we often find a lot of different proposals to how to solve problems. Can be knotty stuff.

One last point: when I pointed ou tthe blog entry at the end of my last comment, I referred to it as discussing both CF 6 and 7 updates, but I should have said 7 and 8. Didn't want people on 8 to ignore it as not applying to them.
Gary F

Gary F wrote on 08/31/09 4:09 PM

Mike, apologies, I didn't realise you replied to my comment. Each server has 2GB RAM and runs 2003 Std 32bit. The jrun.exe instance running the site never eats more than 520Mb physical ram and 520Mb virtual (approx). There's 800Mb physical that never gets touched. I guess that's down to the default heap settings that come with CF?
Mike Brunt

Mike Brunt wrote on 09/27/09 9:44 AM

@Gary now I missed your response, sorry, I disabled email notifications because we get spammed royally with comments. Yes the default settings are not good enough.
Lance Saldanha

Lance Saldanha wrote on 06/10/10 11:21 AM

Anyone have recommended stable heap sizes/JVM settings for the 64-bit flavor of ColdFusion 8?
Coach bags

Coach bags wrote on 06/22/10 11:24 PM

A military exercise, gucci handbags outlet a shell from far away, and sent to check that the soldiers fell on farms, shells, TianZhongZheng gucci outlet stand you, your tears brimming with dark clothes break ground say: stealing star cabbage with gucci handbags shells are shot?
Coach bags

Coach bags wrote on 06/23/10 7:27 PM

For toilet fly flies restaurant said: you've been Coach factory outlet chased away all day, I smell xing looks to drink hot, Coach bags come on! Toilet fly: are a poor, eat in good light Coach outlet
store fart beauty pass, you have seen several?

qiudong wrote on 03/16/11 1:01 AM

In western countries, there are some differences in the position at the dinner table. These differences can be usually shown from the following aspects.
solo hd

solo hd wrote on 05/03/11 12:19 AM

This <a href="">solo hd</a> of headset timbre and its appearance style are very alike -- again, very thin. <a href="">beats solo hd</a> voice very open seem a bit too thin, <a href="">Fabulous Monster Limited Edition GOLD</a> low frequency partial hard, descend not beautiful but speed feeling good. <a href=" ">discount solo hd</a> hf performance is good, accurate and not mellow, intermediate frequency performance is regular. Overall <a href="">Classic Monster Powered Isolatio black</a> voice more features, more suitable for listening to electronic music or part of the pop.
Clarisonic Mia 2

Clarisonic Mia 2 wrote on 03/08/13 5:45 PM

I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading.
real estate mississauga

real estate mississauga wrote on 06/16/13 1:41 AM

Our aim is to provide exceptional real estate services, we make sure every client is completely satisfied. Whether you are buying or selling a home, condominium, or a business in mississauga, Aamir Yaqoob can get the deal done. We are proudly the experts in mississauga real estate
clipping india

clipping india wrote on 07/31/13 11:23 PM

Very Useful information , this is both good reading for, have quite a few good key points, and I learn some new stuff from it too, thanks for sharing your information.

darrendemers12 wrote on 11/20/13 2:29 AM

Wonderful subject and fair ... you simply have to do more study to come to be many more specific. Yet it's not that bad, it's amazing

mercurial wrote on 05/20/14 9:49 AM

The main three varieties of base ball shoes manufacturer as well as vendors would be the Nike and The puma corporation.A number of the less popular producers that will participate in the production of basketball footwear include Lottery.Exactly why the 1st little league footwear were known simply by all of the individuals.

sparxxrx wrote on 10/16/14 8:58 AM

Where else can you find a free packet of male enhancement pills? Here at SparXXrX® we are so confident in our product, that we are willing to give you a free sample to try before you buy.

Ricky wrote on 10/23/14 4:37 PM

<a href="">health and beauty aid</a>, tips, expert suggestion and information.
health and beauty aid

health and beauty aid wrote on 10/23/14 4:38 PM

Health and beauty tips, expert suggestion and information.
visit wrote on 11/02/14 1:01 AM

It's spring, and young man's fancy turns to getting a new car. Well - that might not be the right quote, but it's true! But if you want a new ride, you need to pick up a cheap insurance plan to protect it. wrote on 11/02/14 1:01 AM

From the knowledge behind the innovation, to the execution of a community-driven business plan, The Hic-Cup Ltd. exemplifies how embracing our simple humanity can work for business. wrote on 11/02/14 1:01 AM

A CPA explains how being prepared for a business audit relieves fear and stress. Not only does preparation increase the speed of an audit it makes everybody involved a lot happier. Remember that in the business world saving time is saving money. wrote on 11/19/14 7:04 AM

Business enterprise law contains a great bearing while in the success with business. These guidelines are mechanisms that are... a favorable business ecosystem. Basic important business guidelines that apply inside of a business put in place include, plan law, asset. wrote on 11/19/14 7:04 AM

Car accident law around Texas is definitely how the following justice is definitely... Fort Worth personal injury attorney without delay. Contact A Parker Practice today so that you can... wrote on 11/19/14 7:04 AM

The perfect part with keeping dogs healthy by using regular check-ups is that must be... to love better benefits of everyday living. Animal doctor's offices or restaurants and animal clinics employ several of the... wrote on 01/26/15 11:42 PM

EUFA Winners League is renowned football category held each year, where champions of each and every European nation leagues from this past year are group with this awesome UEFA Tournament League in order to play the win the actual trophy which will declare them the very best Football Group of European countries.
ristorante milano

ristorante milano wrote on 04/03/15 11:20 PM

Winter Restaurant Week 2008 launches in New York City this week, and provides a great opportunity to discover new restaurants or to experience pricier places you've been longing to try.

gfghdjh wrote on 08/18/15 3:40 AM

The method before a purchase online is most likely the most critical with a shopping cart's accomplishment. If the particular buying method causes disappointment, confusion or perhaps insecurity, the user probably will abandon the shopping cart application, never to go back again.   <b><a href=""></a></b>;

hgzfdh wrote on 08/18/15 3:41 AM

Marketing for the wrong pair of keywords can KILL your organization, produce any substandard qualified prospects, and can suck you bank-account dry. You merely don't chuck everything contrary to the wall to see what twigs. On one other hand.   <b><a href=""></a></b>;

ahfjjkkll wrote on 08/18/15 3:41 AM

The particular strategic benefit of logos and the way to evaluate the brand, plus ways you could increase the worth of the brand. Just about the most commonly overlooked reasons for competitive edge is brand name. Branding is not only advertising, nor can it be simply any catchy name to get a company or perhaps product.   <b><a href=""></a></b>;

pkasdsu wrote on 08/18/15 3:41 AM

The particular ideal benefit regarding logos and also the way to examine the brand name, additionally techniques you could raise the benefit of one's brand name. Just about the most frequently disregarded reasons for competing edge will be brand name. Logos is not only advertising and marketing, or can it be merely a catchy identify to get a business or perhaps merchandise.   <b><a href=""></a></b>;

ahsgjkhk wrote on 08/18/15 3:42 AM

On the web shopping' about other palm is a single where you've kept a governed shopping surroundings but has a unique disadvantages. Properly, how concerning balancing the offline shopping using a little on the web planning.   <b><a href=""></a></b>;
apple screen replacement

apple screen replacement wrote on 08/25/15 2:37 AM

Mike thanks for taking the time to comment and give us some good thought points. I have tended to look at ColdFusion and JRun over the past 7-8 years mainly from the perspective of garbage collection in the JVM and in a fairly simple way, in many cases trying to deal with collecting objects in the new or young generation and making sure the permanent generation does not hit 100% usage. My observation is this, in applications using CFC based frameworks and heavily based on CFC's it is literally impossible to create a large enough new-young generation and I am talikng of clients on 64-bit systems with 4GB allocated to the new-young generation alone. Thanks again for the comment.
screen replacement

screen replacement wrote on 08/27/15 10:26 PM

Incredible bad quality spare part (iPhone 4s screen). incredicle bad quality tools, I'm non asking for Wiha tools, but these are really terrible. First chance: flat cable from digitizer broken (I use to manage with thiskind of cables). Buy a 2nd screen (big mistake!). The screen is terrible and you can see the six leds in the top, like you have six bulbs over your screen. Problems with signal. Disassembled again and applied isopropanol to contacts. Fantastic, the bad screen quality traped some drops between screen layers.

シャネルコピー wrote on 11/12/15 12:35 AM


latest mehndi designs

latest mehndi designs wrote on 11/25/15 6:25 AM

I am really impressed by this excellent stuff on ZBrush which is a digital sculpting and painting program that has revolutionized the industry. I've enjoyed reading the nice post wrote on 11/30/15 4:44 AM

You certainly need the idea of brand naming, a best source to help you with your needs.
delhi airport to jaipur

delhi airport to jaipur wrote on 06/12/16 3:24 AM

I am really impressed by this excellent stuff on ZBrush which is a digital sculpting and painting program that has revolutionized the industry.
Gretchen Playa

Gretchen Playa wrote on 07/13/16 8:50 AM

Hi I just thought I would tell you that I enjoyed browsing your webpage and to wish you the best of luck with it in the future - Gretchen Playa
Adrienne Prima

Adrienne Prima wrote on 09/06/16 11:58 AM

Hello there I just thought I would tell you that I did enjoy visiting your blog and to wish you the best of luck with it in the future - Adrienne Prima
Click here

Click here wrote on 10/25/16 3:52 AM

I love the blog. Great post. It is very true, people must learn how to learn before they can learn. lol i know it sounds funny but its very true. . . wrote on 11/05/16 2:30 AM

Community wellness education may very well be an cloudy term. It teaches the ultimate way to improve any person’s well being, and may well involve just a couple of people, or the particular populace of several countries. wrote on 11/05/16 2:31 AM

We all provides outstanding learning PLC, SCADA, Business automation plans, AC powerplant & AIR-CON drive plans in Nashik, Mumbai. wrote on 11/05/16 2:31 AM

You can find numerous ways so that you can redecorate your household room. Most people start out with obtaining a fresh Amusement endure however aren’t typically sure just what style they are trying to find wrote on 11/05/16 2:32 AM

Our own forefathers needs to have never fathomed which usually their youngsters would meet view a period regarding i-phones and also iPads!