Note: This blog post is from 2013. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.Someone asked on the FusionReactor mailing list (a Google Group) whether FusionReactor tracked CF sessions. I started to write a reply, with the good news/bad news in answer to that, and as sometimes happens, it became long enough that I thought it might be better suited as a blog entry that I could point to from the list instead, and which may also help those not on the list (which is a great resource, as a low-volume list with a high signal to noise ratio.)
Anyway, here is the answer I wanted to offer to that question...
(BTW, here's the link to that specific question, in case there is subsequent discussion there and not here.)
Update: FR 5 DOES now have a chart of the session count
When I wrote this blog entry in Aug 2013, I was focused on the ways that FREC in FR4 (or as built-into FR 5) offered logging of session counts. A week later, FusionReactor 5.0.6 was released which now offers a chart of the session count over time, which is awesome. See the Metrics>Custom Series option on the left. Choose the option for ActiveSessionCount in the drop-down on the top right, if it's not selected by default, and note that you can view it over the last hour, day, or week.
I have stricken out the reference below where I said that sessions were not charted, but the information still applies on how FusionAnalytics lets you see that over a still longer time.
On the question of whether FR tracks session counts, per application:
the "bad" news is that while FR itself does not track CF session counts at all, but the "good news" is that the free FREC plugin (FREC: "FusionReactor Extensions for CF", for use with FR 4, and built-into FR 5) does in fact cause FR to log a count of CF sessions. More on that FREC log, as well as how you might view that data graphically, in a moment.
How FR tracks CF sessions
Before addressing that solution, something to consider when contemplating a question like this is that FR is technically not a CF monitor: it's a java server monitor, which can monitor CF as well as Railo, BD, OpenBD, and indeed any Java server like Tomcat, JBoss Jetty, Resin, etc. (And as of FR 5, being a Java agent, it can really monitor ANY java application at all.)
Of course, CF happens to be a Java server under the cover, yet we never really notice that in any way in using FR: it just seems that we are "monitoring ColdFusion", and that's good enough! :-) But technically it's monitoring requests via a Java servlet filter implemented within CF (in FR 4.5 and earlier) or via a java agent implemented in the JVM within CF (in FR 5).
But an upshot of that fact (that it only really monitors CF as a Java engine) is that since CF sessions are (by default) purely CF thing, FR does not see them. (Now, technically, one could configure the CF Admin to cause CF to use J2EE sessions, which means then that it gives control of sessions to the underlying servlet engine--JRun by default in CF9 and earlier, Tomcat in CF 10.
But either way, FR's interface also does not track Java sessions.)
How FREC does log a count of CF sessions
But as I said at the outset, though, the good news is that
while the FR *interface* does not track CF sessions, the free add-on, FREC (availble for FR 5 and built-into FR 5), does cause CF to track sessions, as well as many other very helpful CF metrics (which might otherwise be viewed only in the CF Server Monitor). After installing FREC (for FR 4, or automatically for FR 5), you will find a new log (one of a few) in the FR logs directory, called the realtimestats.log. It writes out a few dozen really valuable metrics every 5 seconds, including a count of CF sessions (regardless of whether CF or J2EE sessions are used within CF.)
Now, it's important to note that there is NO change at all in the FR interface, once FREC is added in FR 4. FREC only causes new data to be logged. (FR 5.0.6 and above offers the new charting of sessions, and FusionAnalytics allows charting of sessions (and more) over a still longer time. More on that in a moment.)
Some more great things about FREC: not only is it free (for FR 4 and included in FR 5), but it also works even with CF Standard (whereas the CF Server Monitor) runs only in CF Enterprise (8 and above). Still more great news, for either those running CF Standard or Enterprise, is that FREC's logging of stuff is something that even the CF Enterprise Server Monitor doesn't do. It logs nothing. I often (in my CF troubleshooting consulting services) help people understand and resolve problems with CF by enabling FREC and helping them make use of the FREC logs.
As I said above, FREC is a free extension for FusionReactor 4, and it's built-into FR 5. You can download it for 4 here, and after installing it, you can enable it in any FR instance monitoring ColdFusion. (There is currently no such plugin for Railo or other CFML or Java server engines.) Note that FREC should be removed before installing FR 5.
FusionAnalytics also provides an interface to view CF session counts over still longer time
, while I noted that the FR interface doesn't show anything based on FREC being enabled (FREC only logs things), note that FusionAnalytics (the sister product to FR) DOES in fact use the FREC logs (if enabled) and DOES show in its interface various measures (charts and reports) that reflect things based on this FREC data, so for instance it DOES track sessions in CF, over time. And that can include before CF restarted, and indeed can go back days, weeks, months, or longer, depending on how you have configured FR and FA.
You can learn more about FREC in the FR online doc page for FREC, which has a link with details on the columns to the realtimestats.log it enables.
Again, lots of cool stuff there, including counts of the CF query cache use, the CF Template cache use, the count of queued CF requests, and lots more.
Just note that SOME of the data in that log is only available if running on CF Enterprise and specifically with certain "start" buttons enabled in the CF Server Monitor. The log page does not always clarify that as well as it might. But the session count, and those other counts I mentioned at the opening of this paragraph, are in fact tracked in there.
Getting a count of CF sessions per application
All that said, FREC's tracking of the session count (in the log, the FR 5 interface, or in FA) is NOT per application, as you had sought. Still, having the session count at all is really valuable for so many people, so I hope this is of value to others.
If you are in need of the session count per application, while you could dig it out of the CF Admin API (if you had CF Enterprise), or using the undocumented session tracker (available in CF Standard), you can get it very easily in a single simple report (that is created in just seconds) from a nifty free tool called ServerStats, which was written years ago by Mark Lynch and which calls the undocumented sessiontracker object within CF, to produce a report of a count of total sessions, and sessions per application. It runs in just seconds (and does not require any modification of your code. You just drop it into an executable CF code directory and run it.)
More in a blog entry I did about ServerStats.
Note that you could also review his code (its open source) to create your own means to perhaps log session counts per application (as the ServerStats report is just a point in time display of the count per application).
Hope that helps.
For more content like this:
- If you may prefer direct help, rather than digging around here/elsewhere or via comments, I can help via my consulting services
- See that for more on how I can help a) over the web, safely and securely, b) usually very quickly, c) teaching you as we go, and d) with satisfaction guaranteed