
134
CONFIGURING AND ADMINISTERING COLDFUSION 10
Using the ColdFusion Server Monitor
L
ast
u
p
dated
7/9/2
01
2
2
Call the administrator.cfc
login
method, passing the ColdFusion Administrator password or the RDS password:
adminObj.login("admin");
3
Instantiate the Server Monitor CFC:
myObj = createObject("component","cfide.adminapi.servermonitoring");
4
Call the CFC method you want (this example uses
getAverageResponseTime
):
myObj.getAverageResponseTime();
Example
The following example uses the Server Monitor API to list the data sources to which the ColdFusion Server is
connected and the number of connections:
<cfscript>
// Login to the ColdFusion Administrator.
adminObj = createObject("component","cfide.adminapi.administrator");
adminObj.login("admin");
// Instantiate the Server Monitor object.
myObj = createObject("component","cfide.adminapi.servermonitoring");
// Get the dsn pool data array
dbpool = myObj.getDbPoolStats();
</cfscript>
<!--- List the data sources --->
The ColdFusion server is connected to the following data sources:<br />
<cfloop index="i" from="1" to="#ArrayLen(dbpool)#">
<cfoutput>#dbpool[i].DSN# #dbpool[i].TOTALCONNECTIONCOUNT#<br /></cfoutput>
</cfloop>
Using the Server Monitor to improve server
performance
The Server Monitor provides information that you can use to help improve the performance of your ColdFusion
server.
Find bottlenecks in your application during development
1
Turn on monitoring, profiling, and memory tracking.
2
Set the Slowest Request and Requests By Memory Usage report thresholds to zero (0).
3
Run your templates.
4
For each request, find the following:
•
The slowest tags and functions in the Slowest Requests report.
•
The largest variables in the Requests By Memory Usage report.