|By Tim Nettleton||
|January 9, 2002 12:00 AM EST||
Far too often we listen to the naysayers who tell us that something can't be done and give poorly founded reasons as to why our troubles persist. The ColdFusion Application Server is no exception to their folly. If you ask people for the drawbacks of ColdFusion, most will reply "speed" or "stability." Let me be the first to tell you that it does not have to be that way.
The system described in this article was built to change the way we think about our code and applications. COSMOS was designed to change our perceptions of the ColdFusion Application Server and to enhance the ColdFusion experience.
If you have ever looked in the /cfusion/log/ directory you've probably seen one or more of the many ColdFusion-generated error/information logs. These text files can easily grow to hundreds of MB and contain the best indicators of "what happened." As with any other service or application, a regular review of system logs should be a part of normal administration. Unfortunately, because of their large size and the fact that the data is segmented into so many logs, it's difficult to get a complete picture of performance, problems, and failure.
Developers who work on a dedicated server can use the ColdFusion Administrator to view these logs. This can be accomplished by clicking on "Log Files" and then downloading the entire log via a browser. Unfortunately, this is usually not possible given the size of most logs and the remote connection speed.
For shared developers, the critical information is unavailable due to the nature of the shared environment and security. In most cases, developers know only what a site user tells them or what they trap using CFTRY/CFCATCH and CFERROR. Even with these mechanisms in place, the larger picture is unavailable and the majority of performance issues go unnoticed and unattended.
The above issues hinder administrators and developers alike. The result is:
To be successful, a solution must have several characteristics:
The solution is COSMOS. Written mainly with Cold-Fusion, it's an integration of ASP, DOS, Perl, ADSI, and Call-XML. It's a remote management platform that leverages the file system, registry, metabase, service controls, and performance counters. Currently, COSMOS contains over 16-million server events aggregated into an MS-SQL database. Captured within a maximum of 40 seconds, these events include all of the following:
- Application errors
- CF Application Server stop/starts
- Hung threads
- Long-running templates
- Missing templates
- Scheduled task results
- Undeliverable e-mails
- Mail sent
There are over 20 COSMOS reports available to a dedicated client, most of which are also available for shared customers. The following is a list of some reports with a brief description of how they impact the development and maintenance cycle.
There are several listings available, each with similar characteristics. A listing allows the user to select the maximum number of records to view per screen and how far back to examine data. It also allows the user to progress backward from that point to review previous messages. The majority of listings allow filtering to a single IIS root. They also provide direct access to the complete original error and a corrected code context lookup.
General Application Error Listing
Application errors are the best view into the progress and developmental completeness of a site (see Figure 1). A well-coded site generates no application errors. This listing provides a top-down view of the most recent application errors for all IIS roots. By clicking on the error message on the right, a popup window displays the error message as displayed to a site visitor.
General Missing Template
This applies to all .cfm templates requested by the Web server, but not found. In most cases, the developer doesn't even know that people are getting "404 File Not Found" messages. If a search engine indexes your site or a user bookmarks a page, a change in the site causes missed business. The solution is to use the default missing template handler in ColdFusion Administrator or to add a CFERROR TYPE="REQUEST" in your site's Application.cfm.
Long-Running Template Listing
This applies to the processing time for pages that take longer than expected. The determination of how long is too long is configured in the logging/settings section of ColdFusion Administrator. A typical setting is 45 seconds, though anything taking that long would most likely be canceled or ignored by the calling client. In addition, a script running for 45 seconds could help identify a performance bottleneck for the application server. By default, CF Administrator doesn't enable this counter. Over time, a development team should ratchet this value as low as possible to get the best diagnostics.
Undeliverable CFMAIL Listing
When ColdFusion is unable to deliver a message to the server specified in a CFMAIL script, the original template is renamed and filed in the /cfusion/ mail/undeliver/ directory. An error message is also written to the Mail.log or Error.log describing the problem that prevents proper delivery. This listing binds those two pieces of information together.
The following popup allows an administrator to correct and resend the message from the original server. This function is indispensable for any business that relies on CFMAIL to reliably carry e-mail, and can't accept undelivered messages.
Hung Thread Listing
This is probably the greatest indicator of a performance and stability problem. Hung threads are ColdFusion's method of alerting us that it was unable to completely process the requested template. This is usually the result of code or database issues. CF4.x and above has an option in the Administrator to have CF "restart at x unresponsive requests."
When the hung thread count matches the defined threshold, ColdFusion reaches a critical point and will stop/restart itself to avoid excessive downtime. Constant examination of hung threads is necessary to avoid application server failure. At the end of this article I've included three links that help to define more fully the causes of hung threads.
Scheduled Task Listing
Most scheduled tasks run completely unnoticed until someone realizes that a critical function has not processed in days. This listing is not much to look at but, under the hood, a huge modification and improvement has been created for the executive service.
As always, COSMOS can determine if your task started, succeeded, or failed based on the logs. Furthermore, COSMOS will allow you to define a target string in the page HTML and record the generated content from the target URL to the database. If a scheduled task does not return the defined string, an e-mail containing the content and diagnostics can be generated at the time of failure. In addition, the actual HTTP response (CFHTTP.FILECONTENT) is zipped and written to the database.
Aggregation and Stratification
More commonly called a GROUPING, the next series of graphs were created to help identify the greatest problems quickly. By examining the data based on time, date, and IIS root, we can gather a greater understanding of where faults exist.
Application Log Stratification by IIS Root
Over a selectable time span, this graph allows you to see which sites are having the greatest incidence of errors (see Figure 2). By clicking on the blue horizontal bar on the right, you're driven back to the general application error listing but with an additional sort parameter that isolates errors created by the target root.
Especially useful in determining if your day is getting better or worse, this graph breaks down the server errors by 10 minute increments over a selectable date span. This is often used to diagnose a recurring failure point over a multiple day or week period.
Application Errors Stratified by Date
Similar to the previous idea, this graph groups the number of errors by the date that they occurred (see Figure 3). This helps to identify programming trends and can easily indicate a "bad day" for an application. By clicking on the blue bar, your browser is taken to the application log stratification by IIS root. Clicking on the "Time Graph" button brings you to the next graph.
Long-Running Template Aggregation by IIS Root
Similar to the previous root aggregations, this has several prominent exceptions. Because a long-running page has a value associated with the processing time, I've included a column for the sum and average values. Using this display, it's possible to extract the templates most often run beyond acceptable limits, thus demanding the greatest processing time. This affects performance, though not necessarily a failure, and is a fantastic indicator of templates that need to be addressed before they become a stability issue.
Hung Thread Aggregation by IIS Root
This graph will often tell which application is responsible for killing the server. Over a selectable data span you can easily see which sites are causing CF to lose processing threads and tie up resources. The blue horizontal bar links back to the hung thread listing for a given root.
The Big and the Bad
With the thousands of errors, tasks, and events returned each hour, it's easy to become overwhelmed. In addition, not all errors have the same weight on the application server or urgency to a business owner. To resolve this problem a system of alerts and probes runs in the background. Operating at several intervals, the most relevant problems are quickly pulled out of the pool and matched with a type and severity. Once a probe identifies an event or error candidate, the alert has an option of paging, e-mailing, or calling (using CallXML) the administrator.
A Final Look
When did your application server last crash and why?
Tonight at 1 a.m. your database is going to run out of space and begin throwing application errors. Maybe your mail server stops relaying your order confirmations. There are a thousand permutations to a preventable and containable failure. Will your customers be the first to let you know?
In the end, owners and developers, shared and dedicated, all have the same concerns: stability and performance. Using this system makes that realization no more than a few seconds away.
- Where Are RIA Technologies Headed in 2008?
- The Next Programming Models, RIAs and Composite Applications
- AJAX World RIA Conference & Expo Kicks Off in New York City
- Constructing an Application with Flash Forms from the Ground Up
- Building a Zip Code Proximity Search with ColdFusion
- Personal Branding Checklist
- CFEclipse: The Developer's IDE, Eclipse For ColdFusion
- Has the Technology Bounceback Begun?
- Cloud People: A Who's Who of Cloud Computing
- i-Technology Viewpoint: We Need Not More Frameworks, But Better Programmers
- Adobe Flex 2: Advanced DataGrid
- Web Services Using ColdFusion and Apache CXF