Aliaspooryorik
ColdFusion ORM Book

Tuning the JVM

One of the great things about ColdFusion is that it runs on a JVM and as such means that it has a whole bunch of options we can use to tune it to increase performance. The bad thing about ColdFusion is that it runs on a JVM and as such means that it has a whole bunch of options we can use to bring your server to it's knees!

I'm no expert on tuning the JVM, but I have learnt a few things in the past week, which I thought I'd share. After upgrading from ColdFusion 8 Standard (running 32bit) to ColdFusion 9 Standard (running 64bit) one server was constantly showing in the application log (you do check you Coldfusion logs don't you?) the "PermGen space" error. The default install options for ColdFusion aren't great; sure ColdFusion will run but I doubt it is running efficiently.

I did a bit of googling and found some interesting posts relating to ColdFusion:

Also the SUN website has some good information:

Every server will need different JVM settings and the experts will tell you to tweak, load test and try again until you find the optimal setting. This is all good advice, however, many of us have webservers in a production environment that host multiple applications (yes, I know, ideally clients should pay more bucks and have a Virtual Machine!). So, for me, these were some good starting points to bringing the server back to life (and I stress, every server is different!):

  • - 64bit JVM uses approximately 30% more memory than 32bit JVM, so increase the -Xmx setting you had for ColdFusion 8 (in 64Mb blocks)
  • - Increase the -XX:MaxPermSize setting, particularly if you are getting the dreaded "PermGen space" issue
  • - If you have lots of transient variables, add the -XX:+AggressiveHeap setting (this one setting made the most difference for the server I was tuning)

Also, something I've seen a lot of people recommending is to set the -Xms and -Xmx to the same value as it increases predictability. Whilst this is true, what they don't tell you is that if you get it wrong the virtual machine can't compensate if you make a poor choice. So you may want to consider setting the -Xms to less then the -Xmx as a starting point, and then once things are running well, set them to the same value.

Another good article is this one: http://java.sun.com/docs/hotspot/gc1.4.2/, however, bare in mind that this is for 1.4.2 and ColdFusion 9 ships with 1.6.0.

I also recommend monitoring your servers performance using Fusion Reactor or SeeFusion. Both are relatively cheap, especially if you consider the amount of time that you may need to spend tuning your server and also the upset clients when your server slows down or worse dies. 

The last thing that I have learnt, is that hindsight is a wonderful thing! What I should have done is got an expert in to tune the server before it had performance issues. This is a hard case to make internally as you're asking for money to solve a problem that doesn't exist... yet!

As I say, I'm no expert on JVM settings, and the settings I've mentioned above may not work for you. I'd love to hear if anyone else has some top tips as I'm sure I can squeeze some more performance out of our server!


3 comments

  1. There is also a great chapter by Mike Brunt in Adobe ColdFusion Anthology - nud.gr/CFAnthology

    Comment by Big Mad Kev – July 26, 2010
  2. Thanks for the post John.

    To following on from Kev's comment Mike Brunt's blog (www.cfwhisperer.com) contains some good reading on this subject.

    Comment by Gary Boyle – July 26, 2010
  3. Thanks Kev and Gary. Yes, Mike Brunt has some great info and really knows his stuff. I'm pretty sure that it was Mike who wrote the post on the alagad blog.

    Comment by John Whish – July 26, 2010

Leave a comment

If you found this post useful, interesting or just plain wrong, let me know - I like feedback :)

Please note: If you haven't commented before, then your comments will be moderated before they are displayed.

Please subscribe me to any further comments
 

Search

Wish List

Found something helpful & want to say ’thanks‘? Then visit my Amazon Wish List :)

Categories

Recent Posts