Ashwin Mathew former member of the Adobe ColdFusion team presented on the
ColdFusion Server Monitor at the Bay Area ColdFusion User Group on January 21,
2009. The presentation was done on a Linux OS and therefore Adobe Connect could
not record the presentation. I used a video camera and the quality is not that
good. I've taken notes from the presentation and included them below. If you
want the video or audio, you can download them below.
Current State of the JVM (Java Virtual Machine)
Since ColdFusion runs on top of Java, the amount of memory used by
the Java Virtual Machine is very important to performance. The server monitor
displays how much memory the JVM is using and has used in the past. You don't
want your JVM usage to max out your server memory. For example, your server
has 2 GB of memory and your JVM is using 1.5 GB. That would degrade performance
significantly.
Monitoring, Profiling, Memory Tracking
On top of the server monitor window are three buttons for
the three different levels of server monitoring.
Monitoring
This tracks information at the template level. You get information
about application errors, overall memory usage, slowest queries,
etc. There is only a 1% hit on server performance when monitoring is turned
on. This is acceptable for use on a production server.
Profiling
This tracks information at the tag level. You get
detailed information about individual tags and how they are performing.
There is a 3 to 4% hit on server performance when profiling is turned on.
Again, acceptable for use on a production server when tuning your application.
Memory Tracking
This estimates how much memory your requests and sessions use. There is a
60% to 100% hit on the server when memory tracking is turned on. Do not use
on your production server. This will slow your application down and may cause
it to crash.
NOTE: If you server reboots, it will restart with the same settings at the
time of the crash.. You'll want to go into the configuration xml files to turn
off memory tracking if you find yourself unable to access the Cold
Fusion Administrator.
Slowest Active Requests
If you have a slow running request, it will show up on the overview screen.
From there you can double-click on that request and see the following details.
- Template Name
- Type of Request
- How much memory used
- How long it's been running
- All variable scopes (UR, session, application, request, etc) and the values for the variables.
Very powerful. Ashwin stated that this is the only tool he knows that ties
together server performance information with the level of detail only seen
in debugging tools used in development. Essentially, you jump from server
logs to the line in your code along with any parameters involved.
What versions of ColdFusion include the Server Monitor?
I thought the server monitor was only included with ColdFusion 8 Enterprise.
Ashwin mentioned that the server monitor is for BOTH administrator and developers.
It's included with ColdFusion 8 Developer Edition for use when coding your
applications. Thank you Ashwin and thank you Adobe!
Requests with Errors
From the overview screen you see a list of requests with errors. Double-click
on the template path to see more detail. Most importantly WHEN the error last
occurred. This can be very helpful for intermittent errors. You may notice
a pattern in the errors based on frequency or time of day. This can help
you narrow down the cause.
Requests that are Slower than N
From the overview screen you see a how many requests are running slower
than N seconds. For example, I want to find requests that are slower than 3
seconds and improve the code. Double-clicking shows you a list of the slowest
requests. The two tabs are "slowest request" and "slowest request by average.
You might have a single request that is very slow, but on average it is fast.
You'll want to investigate that one slow request. You can examine the different
scope variables (URL, session, form). You also get a list of the ten slowest
tags and functions. The slowest request by average lists the size of the most
recent request, the average size, the most recent response time, the slowest
and fastest response times. These can indicate where your application is slowing
down.
Requests by Memory Usage
Similar to request that are slower than N. You can set the threshold in
KB and how many you want to list.
NOTE: You should be careful when modifying how many you want to list. The
default is 20, up to 100 would be fine, but beyond that you may see a performance
hit. The more items you track, the
more processing power is needed.
Sessions by Memory Usage
From the overview screen click on sessions by memory usage to get a list of
sessions and their size. Double click any sessions to find out the Session
id, application name, ip address of the client. If you find a session using
a large amount of memory (1/2 a mb) you'll want to investigate. These large
sessions will slow your server down.
Slowest Queries
You can view the slowest queries and the slowest by average. You can double-click
any query to find out the name, calling template, datasource, is it cached,
how many times has it been called, when was it last called, average size. This
will help you locate slow running queries and identify circumstances that cause
your queries to run slowly. A cool feature in this section is the SQL pane.
You get a copy of the SQL statement that was executed and you can copy and
paste into a SQL Query Tool to review the returned results.
Queries by Memory Usage
Similar information as the slowest query report just displaying memory usage
information
Statistics
This area provides more details on requests, sessions, threads, hit counts,
and template cache. I found Ashwin's comment about the "template cache hit
ratio" very
helpful. He said the higher the template cache hit ratio the better. 100% means
your server isn't recreating templates with each request, but using a cached
version which improves server performance.
Alerts
Alerts provide ways to automatically take action based on how your ColdFusion
server is performing. They include the following 4 ways.
- Unresponsive Server will alert you when your application exceeds a specific
number of hung threads or the busy thread time exceeds a specified number
of seconds.
- Server
Slow Server will alert you when the response time exceeds a specified number
of seconds.
- JVM Memory will alert you when the JVM memory exceeds a specified number
of MB. Important if you have limited memory on your server.
- Timeouts will alert you went the count exceeds a specified number
or the time interval exceed a specified number of seconds.
If any of the events are triggered the server monitor can take one or more
of the following actions.
- Send Email - snapshot will be attached to the email if dump snapshot is
enabled.
- Dump Snapshot to the hard drive.
- Kill threads running longer than specified number of seconds
- Reject any new requests
- Process a specified CFC
- Perform garbage collection (only for JVM Memory Alerts)
You can see a history of all the alerts and the actions they've taken. Snapshots
are stored will a lot of detail about the server at the moment the alert
was triggered.
Settings
Located in the upper right corner is a setting button.
- General
From this tab set
the refresh rate for reports and graphs as well as how often to calculate the
average response time. Checking shrink template paths shortens your paths using
a "..." followed by the name of the template Hovering over
will display the entire path.
- Filter Settings
This tab allows you to include or exclude directories. Doing this allows
you to focus on specific templates in your application.
- Profile Filter
Profile
filter allows you to exclude the framework specific code and just monitor
your application code.
- Aliasing
When running a framework you often point to a single index.cfm page with event
parameters. Aliasing allows you to separate each unique "event". Instead
of seeing "index.cfm" is slow . You'll know that "index.cfm?event=GenerateBigReport"
is slow using the alias you setup.