Performance Monitoring

Yesterday, I went through some of my old server monitoring code, prior to SeeFusion and found something interesting.  The code itself is pretty simple. It uses the function GetMetricData to pull in the performance monitor information and has a meta refresh every 5 seconds to keep reloading the updated information.  Since I had that, I wanted to expand further on what else I could do, knowing full well that you can pretty much do whatever you want when pulling in JAVA objects.  The next thing that seemed pretty cool was java.lang.management.ManagementFactory.  If you look into that, you’ll find you can take a look at all kinds of “Bean”s: OperatingSystemMXBean, RuntimeMXBean, MemoryMXBean, MemoryPoolMXBeans etc.  With this you can have an overview of just about everything the server is doing, especially with memory.  For those of us who want to tune CF, it would be quite handy.  The only oddity is that every now and again, my refresh throws an error on GetMetricData(“AVG_REQ_TIME”) as if AVG_REQ_TIME doesn’t always exist.  It’s bizarre.  Funny enough though, the next refresh there won’t be a problem.

The most interesting pieces of code I’ve run across though are in the Coldfusion runtime.  Using coldfusion.runtime.ApplicationScopeTracker and coldfusion.runtime.SessionScopeTracker, I can gather information on all the applications and sessions that are running on the server.  Of course yesterday when I was running the code to check out the sessions, my page was timing out.  I had to revamp things to just check out the session counts and it appears that one of our online eCommerce sites had almost 12,000 sessions and that was most definitely the reason my page was crashing.  But it was still cool to see some of the session information for the app.  An easy way to do this would be to cfdump the following snippet: createObject(“java”,”coldfusion.runtime.SessionTracker”).getSessionCollection(“yourappname”).

Eventually my goal is to see if I can figure out a way to use all that information in a more useful way.  It would be completely cool if I could determine what apps were taking up what amount of memory, but I think that may never be more than a dream.  What I could do though is build a custom monitoring system similar to what we like to see with SeeFusion.  Maybe it’s a great way to get into Flex.  It’s definitely an “in my spare time” project though.