Skip navigation

Rem: Monitoring The Performance Of Processes

Downloads
45508.zip

We have a Web application that seems to periodically crash one of our Web servers. On a few occasions, we've noticed that once the memory used by the application hits 1MB, it quickly spirals upwards and kills the server. Is there an easy way to monitor the performance of a particular process and report the memory consumption growth before the server crashes?

Yes—Sysinternals' PsList utility (part of PsTools at http://www.sysinternals.com) lets you view processes and their details, including memory usage. The results are similar to what you'd see in Task Manager's Processes tab. As the MemoryTest.bat script in Listing 1 shows, you can run PsList, use the Find command to find the name of the process you want to monitor, then use an If command with the GEQ (greater than or equal to) comparison operator to determine whether the threshold you've set for that process has been reached. MemoryTest.bat uses the Net Send command to deliver a Messenger service message to the specified PC. Alternatively, you could adapt the script to use Blat to send an email message instead. (You can find this free Win32 command-line utility at http://www.blat.net.) For information about how to use Blat, see "Real-World Scripting: Using Blat to Send Email Notification Messages," November 2000, InstantDoc ID 15848.

To run MemoryTest.bat, you follow the syntax

MemoryTest.bat Server Process
 Thresh PopupTarget

where Server is the name of the server on which you want to run MemoryTest.bat, Process is the name of the process you want to monitor, Thresh is the threshold for that process, and PopupTarget is the name of the PC to receive the Messenger service message. To use this script, you need to have the Messenger service enabled on that PC.

TAGS: Windows 7/8
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish