coldfusionscheduled-tasksserver-load

Is there any way to access information about a Coldfusion server's load from within coldfusion?


I am writing a scheduled task which I would like to run frequently.

The problem is that I do not want this task to be run if the server is experiencing a high traffic load.

Is there any way other then getting the free/total/max memory from java to try and figure out whether this task should continue?


Solution

  • GetMetricData() is going to give you a very good indication of how busy your server is, i.e. how many requests are running and how many are queued as well as other info.

    It's the same info that you get from running cfstat from the command line (you'll find that under {cfroot}\bin\cfstat.exe).

    However, knowing how busy you are at the very moment might not be very useful to you if you just call that function once. It might be better for you to log performance data to file or to a database table using Windows perfmon. You can then get the average number of running/queued requests over the past 5 minutes (or whatever) and make your decision on whether to run your task.