How to use Java Mission Control (or other solutions) with ColdFusion (tomcat) - coldfusion

The ColdFusion monitor is great for details about the server itself but it is pretty limited when it comes to the JVM.
How can one implement Java Mission Control or similar JVM monitoring solution to monitor the JVM running ColdFusion while you are developing and testing performance / memory footprint of applications and features?
Note that I am asking this question for "community knowledge" and already know the answer, but feel free to contribute any tidbits about other monitoring solutions.

Mission control used to be bundled as as it's own utility application in the JRockit JDK. Hotspot and JRockit were two entirely different JVMs with their own JDK/JREs. By default, ColdFusion uses the HotSpot JVM. JRockit is basically defunct from new development with some of its features being merged into HotSpot.
Java Mission Control is free for development purposes.
Get started, download the the latest 1.8 JDK. My preference is to uninstall all other 64-bit JDKs and JREs installed at this time.
This step might not be needed. Change your environment variable to update your JAVA home.
a. Right click "My Computer" -> "Properties" -> "Advanced" -> "Environment Variables"
b. Change JAVA_HOME and any other JAVA vars to your new path
Adjust your jvm.config
a. Make a .bak copy of C:\ColdFusion1x\cfusion\bin\jvm.config
b. Add the following lines to the jvm.config
-XX:+UnlockCommercialFeatures
-XX:+FlightRecorder
-Dcom.sun.management.jmxremote.autodiscovery=true
-Dcom.sun.management.jdp.name=ColdFusion10
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.port=7091
-Dcom.sun.management.jmxremote.ssl=false
Open C:\program files\java\jdk1.8_**\lib\missioncontrol\configuration\org.eclipse.equinox.simpleconfigurator\bundles.info file with administrator privileges and remove the four lines that start with the following text:
org.eclipse.equinox.log.nl_ja
org.eclipse.equinox.log.nl_zh
org.eclipse.equinox.supplement.nl_ja
org.eclipse.equinox.supplement.nl_zh
Edit the C:\program files\java\jdk1.8_xx\lib\missioncontrol\configuration\config.ini, and add the following line: eclipse.home.location=$osgi.install.area$
Start up : C:\program files\java\jdk_1.8.0_**\bin\jmc
Note that JMC is launching from 1.8 while your ColdFusion instance is running with whatever the latest Hotspot version you have installed with your ColdFusion updater.
You can install plugins from the help -> install new software. The plugins site should already be there. This will give you full on memory analysis of a heap dump. It's not nearly as good as the JRockit memory analyzer, but it's better than nothing.
If you are running ColdFusion as a Windows service, you will need to open services.msc and shutdown your ColdFusion Application Server. Then open C:\ColdFusion10\cfusion\bin\cfstart.bat to fire up Tomcat and ColdFusion as a foreground application. The jOverflow plugin will not work when running as a windows service.
You will see your JVM appear in Java Mission Control, mine is call -Xdebug since I guess it has no name and starts with the first option.
Right click on your ColdFusion JVM and select "Start JMX console". You will see something that looks like this show up on the right:
There is a whole lot to explore, including a lot of junk when it comes to examining memory due to having to sift through the ColdFusion Framework itself, but there are a ton of tutorials for deciphering what it means.
This video is your primary introduction: https://www.youtube.com/watch?v=WMEpRUgp9Y4
References:
https://www.youtube.com/watch?v=WMEpRUgp9Y4
http://www.ghidinelli.com/2009/07/16/finding-memory-leaks-coldfusion-jvm
http://www.oracle.com/technetwork/java/javase/jmc53-release-notes-2157171.html (see "known issues" section)

Related

‘Service unavailable’ on ColdFusion 8 application service

I have often faced the issue ‘Service unavailable’ in ColdFusion website and need to restart the service manually. Sometimes, also need to restart the host computer.
I checked Event Viewer but I do not find any error related ColdFusion.
I am not familiar with ColdFusion.
Kindly help me. I would like to check why it happens and to solve this issue.
ColdFusion Version 8
Windows Server 2008 R2 Standard - Windows 7, 64bit
IIS Version 7.5
Thank you.
To find out what is actually crashing your CF server you may find information in the "out" log. Look in the /runtime/logs directory for a file called "coldfusion-out.log" or something similar. This is where standard out goes in a running CF application. There is also a /logs directory in your application that may give additional information.
Finally, you may have a hotspot error - an abend. Look in the /runtime/bin directory for a file similar to hs_err_pidXXX.log" (where XXX is some number). If you do have such an error take a quick look to see if it is an "out of memory" error. That's the most common.
I have a post on where all those log files are located. It is from the CF8/CF9 days so it may be useful to you. Of course everyone will tell you to upgrade as well. :) Good luck!
There are two places to look with problem like this: the application server behind CF (JRun for CF8) is the connector between CF and IIS. Adobe CF uses old (IIS6?) style ISAPI connectors that may need to be rebuilt - later versions of CF have a 'rebuild connectors' batch file in cfusion\bin\connectors (something like IIS_connector.bat) but it has been a while since I've had CF8 to look at. At the very least, be certain that you have the last CF8 update from Adobe as they sometimes want you to rebuild connectors after installing them.
A better solution for newer versions of CF (10+) is to use Bilal's Boncode AJP connector - I don't think it supports CF8 but haven't tried it.
CF 8's End-Of-Life was over four years ago and later versions stopped using JRun in favor of Tomcat, which is a bit easier to troubelshoot. If you have a development environment available, you might try running your codebase on CF10 or CF11; if you have to support this application for the foreseeable future, better to do it on something resembling a current version of CF. You could also have a look at Lucee 4.5 for an OSS alternative.

Simplest technology for distributing Web Services

Is there a way to meet the following criteria in distributing a Web Service to Windows machines?
1) Automatic installation and configuration of the Web Server.
2) No configuration (or even awareness) of a Web Server required by the customer.
3) No prompts to download and install Java or .NET - especially anything after .NET 2.0; those installs / restarts can take forever!
In short, is there a way to deliver a single install process that installs the Web Server along with a simple web app without requiring lengthy installations of pre-requisites? Something for even the most non-technical of users?
.NET's WCF almost meets the requirements but getting .NET updated up to 3.0 / 3.5 is a lengthy process and can be a turn-off for customers, even if the install holds their hand through the whole thing.
Rubyscript2exe was also very close, but it is extremely touchy and out-dated.
I am open to any technology / programming language - just looking for the slickest distribution process for my customers that meets the above three criteria.
I've been doing quite a bit of research on this as it is extremely important to me that my users have a simple installation experience. Here are a few things that I've found:
UltiDev Cassini: Cassini is that convenient mini-server that runs when you debug your web apps from Visual Studio or Visual Web Developer. UltiDev Cassini builds on that and looks pretty promising. It offers support for all non-beta flavors of .Net and integrates right into Visual Studio. Most interesting to me is the ability to include as part of your installer. The only down side is that pesky .Net pre-requisite. I can handle helping users get installed up to 2.0, but the install process to move to 3.0 and 3.5 is way too heavy for the typical user.
RubyScript2Exe: I like the premise of an executable Rails app. However, I attempted to use this on a Mac and it is simply too outdated and requires too many workarounds for my tastes. It's too bad, because I love Ruby on Rails development.
Server2Go: This is my favorite of the three options. It is easily distributable (just send off a zip file) and has a lot of nice options. For example, you can configure it to leave the included Apache server running even after the browser closes - that is PERFECT for a nicely packaged web service. It can also provide a customizable icon in the task bar for shutting down the service if necessary. I think this best meets my needs for the time being.
Please, if you know of any other options, let me know.
Also, you may be wondering, "Why not just write a desktop app?". The simple answer is that I don't need much of a GUI, if any. I need a simple to install web service that can be consumed by various other applications (web, mobile, and desktop included).

Viewing a list of locks in Coldfusion

Is there anyway to see a list of the current locks in Coldfusion (particularly locks on files or directories).
Through a non documented call is fine as this is more for debugging some errors we're getting on our server.
Thanks,
Tom
you might try FusionDebug, while it is commercial they do have a full featured 20 day trial. Also the developer edition of Adobe's coldfusion 8 has a server monitor, though its only for your local instance, unless of course you are running the enterprise edition on your production system.
edit
While FusionDebug is an excellent eclipse based debugger, i think in your case you want the FusionReactor to monitor the system's status.

Upgrading the JRE used by ColdFusion

I have a ColdFusion 8.1 application. It gets heavy use and I see jrun.exe getting very high memory usage in the task manager. This is a 32-bit windows 2003 server. When Jrun gets around a gig of memory usage ColdFusion will stop responding at some point. The logs are a little vague, but I start to see garbage collection and heap errors in the ColdFusion log. I assume that the JRE is running out of memory.
I have the max JVM heap set to 1.2gig. After some experimenting, this seemed to be the biggest amount I could allocate and still have ColdFusion start ok. I realize that going to 64-bit might solve the problem, but that is not an option at this time.
I am considering upgrading the JRE (it is at v6.x dated pre-2008, though I don't know the exact version. I am using the JRE that came with ColdFusion 8.1. Has anyone gone through this? I assume it's just a matter of installing the new JRE and pointing ColdFusion to the new JRE directory in the ColdFusion server settings.
tia
don
it's EXTREMELY easy to do.
1) download the Java SE Development Kit and install it like normal.
2) open up the jmv.config for cf in a text editor, located in c:\coldfusion8\runtime\bin
3) comment out the existing java.home line with a by putting a "#" at the beginning of the line add a new java.home line below it pointing to your jvm installation.
As an example, my java.home and jvm.config look like this:
java.home=C:/Program Files/Java/jdk1.6.0_11/jre
4) restart the CF services.
As a bonus, you can running JavaRa and free up some space by deleting all the old versions of the JRE.
Adobe has a Knowledge Base that covers issues like this. Check out http://www.adobe.com/go/2d547983 for instructions.
Sean Corfield has an article that provides some info on using Java 6 with ColdFusion 8 here:
http://corfield.org/blog/index.cfm/do/blog.entry/entry/Java_6_and_ColdFusion_8
As long as you install 1.6.0_10 or greater, you should be fine. You might check out ColdFusionBloggers.org from time to time in case other JVM issues come to light in the future.
You didn't specify whether or not you were using the stand-alone server instance or a multi-server configuration. If you're getting a heavy volume of traffic and have a dual core machine with a lot of physical memory, I would consider looking into the multi-server set-up for CF8 and putting together a cluster with load balancing. This will help to distribute your traffic across several instances of CF8 and, assuming you have a beefy server, make better use of the physical resources that you have available.
-Rick
Consider moving Java 7. Java 7 has the G1 Garbage collector which is better at memory deallocation.
If you are having out of memory issues it could be because
functions are not using var or local scope
<cfdump> is used in a production system
Sessions are too large or are not set to expire in a reasonable amount of time
Queries are way too large SELECT * can cause that.
Excessive number Query of Queries.
The site is connecting to a slow database. Resources are held until the DB returns data
DSN has the data buffer set to more than 64k

Whats the best way to get started with server virtualization?

We recently bought a new rack and set of servers for it, we want to be able to redeploy these boxes as build servers, QA regression test servers, lab re-correlation servers, simulation servers, etc.
We have played a bit with VMWare, VirtualPC, VirtualBox etc, creating a virtual build server, but we came across a lot of issues when we tried to copy it for others to use, having to reconfigure every new copy of the VM.
We are using Windows XP x86/x64 and Windows Vista x86/x64, so I had to rename the machine, join the domain etc for every new copy.
Ideally we just want to be able to add a new box, deploy a thin boot strap OS (Linux is fine here) to get the VM up an running, then use it.
One other thing we have limited to no budget, so free is best.
I would like to understand others experiences in doing the same thing.
FYI, I am not in systems IT, this we are group of software engineers trying to set this up.
Any links to good tutorials would be great.
The problem you're running into is the machine SID must be unique for each machine in a domain. Of course by copying an image you now break that unique constraint.
I'd suggest that you read the documentation for Sysprep in the reskit and Vista System Image Manager - your friends for XP/Win2k3 and Vista/Win2k8 respectively.
These tools enable to "reseal" your configured instance of the OS such that the next time it boots - it can prompt for information such as network configuration, machine names, admin user ID's, run scripts etc.
Also be aware that the licencing restrictions for Windows desktop clients are generally per image - not per server.
Using these tools with HyperV we created complete preconfigured instances of Win2k3 & Win2k8 that boot to finish installing Sharepoint - going further we used the diffing disks to overlay Visual Studio so our devs could use the production images for their work. It has radically changed our development process.
At this point our entire public website is run on HyperV with of 5 boxes running 15 images for a mix of soft and hard redundancy - they take several hundred million page views per week.
Another option for dealing with the SID probelm is NewSID. This is a simpler tool than sysprep, in that all it does is rename the machine and reassign the SID; if you don't need all the other features of sysprep this is a much easier tool to use.