Example 6: Server memory usage

SimpleRemoteScripting is useful for providing status information about processes that are long-running (such as sending out a batch of email messages) or run indefinitely (such as the current number of web site sessions). provides continually updated stats on server memory usage.

This example relies on some sample code provided by Pete Freitag to detect the CFMX server's memory usage. If you are using ColdFusion 5, you may still adapt the principles of this example for your purposes.

When the server page receives the client page's request, instead of simply running once and returning a response, it runs repeatedly, returning a series of responses every five seconds. The technique nothing mysterious. The server page simply uses the standard HTML meta refresh: <META HTTP-EQUIV="Refresh" CONTENT="5">.

The bar graphs you see here are generated by a cf_bar custom tag. Feel free to reuse or adapt the tag for your purposes.

Allocated






























%
In use






























%

Total Memory Available to Java Virtual Machine: [Updating...]MB

Total Memory Allocated: [Updating...]MB ([Updating...]%)

Free Allocated Memory: [Updating...]MB ([Updating...]%)