views:

630

answers:

10

I am building a client-server based solution; client being a desktop application and the server being a web application.

Basically, I need to monitor the performance and resource utilization of the client, which is a .NET 2.0 based Windows Desktop application.

The most important thing I need to monitor is the network resources the client uses, i.e. what is the size of the data that flows out from the client to the server and what is the size of the data that the client downloads from the server.

Apart from this, general performance monitoring would help too.

Please guide.

Edit: A few people have suggested using perfmon, but aren't the values shown in perfmon system-wide? I need these network based stats for a single application only...bytes being sent and received by a single desktop application.

A: 

You want to look at perfmon (otherwise called Performance Monitor in admin tools off the start menu).

Open it in its default graph view, add a counter, select network interface, then bytes per second (or a similar counter), click ok and you're done.

You can experiment with the other networking counters as there are many, one of them will do exactly what you want. You can also save the perfmon logs to a file and view them afterwards - you'll see the graph in its entirety and you can "zoom in" on sections. Alternatively, you can save log-style files with just raw numbers.

Here's a quick guide through perfmon as an admin tool, once you understand that, the rest comes easily.

In Vista you can't add individual counters any more, you add the entire set of counters grouped under an object - so for my example, you'd add the Network Interface object, then you'd see all the individual counters on the graph after you click ok.

gbjbaanb
aren't the values shown in perfmon system-wide?i need these network based stats for a single application only...bytes being sent and received by a single desktop application.
SaM
ah yes... well, you can use the process object, and the application instance to see all IO numbers (eg I/O data bytes); unfortunately that also includes disk IO too.
gbjbaanb
+2  A: 

You can also use Task Manager to do this. Go to the processes tab, then View->"select columns". Check "I/O read bytes" and "I/O write bytes". Then find your program in the processes list and you can observe the cumulative values.

KenE
according to msdn that is more than just network, no? The number of bytes read in input/output operations generated by a process, including file, network, and device I/Os.
duckworth
A: 

If you want this built into your client codebase, and not using an external tool, you can use Performance Counters to get access to this and most other things reported by the Performance Monitor, Task Manager, etc.

Reed Copsey
+2  A: 

Take a look at this article: http://www.codeproject.com/KB/IP/apptraffwatcher.aspx

You may be able to tear apart the source code, and grab what you need to meassure download/upload for your application's process ID.

It looks like he uses this library to get information about the amount of traffic: http://www.codeproject.com/KB/IP/trafficwatcher.aspx

MartinHN
+3  A: 

The standard tool for network monitoring is Wireshark. It allows you to filter the network traffic very flexiblely. This could be quite an overkill for your application though. If you are using pure .NET, I would suggest that you add performance logging into your networking classes on the server side- if you are using .Net library classes, then inheritate from them your own classes which add statistics when sending and receiving data.

weismat
+2  A: 

I tried the perfmon and I was unable to watch our network traffic either. But I was able to in the Performance Explorer in Visual Studio 2005 Team suite.

If you have Team edition Visual Studio you can set up either Sampling/Instrumentation on your desktop application. Then go into options of the session. select Events -> Windows Kernel Trace -> Network. Run your application and let the Visual studio log the data. Then save the report. (I love Microsoft for this "feature") go to the command prompt, navigate to C:\Program Files\Microsoft Visual Studio 8\Team Tools\Performance Tools and run "vsperfreport /CALLTRACE (filename).vsp" This will produce a csv file containing all network packets sent/recieved/size/port etc by the desktop application.

I know this was a long winded solution but I just tried it on my .Net 2.0 application and it captured all of our communication with Oracle Identity Manager and Oracle Database.

mcauthorn
+1  A: 

You need to split your monitoring in two parts:

  • How the system interacts with the server (number of calls performed)
  • Amount of network traffic (size of exchanged data for any call)

The first part is (in my experience) often negleted while it has a lot of importance, because acquiring a new connection is often much more expensive that data traffic in itself.

You do not tell us anything about the king of connection you're using (low level tcpip calls, web services, WCF or what else) but my suggestion is:

  • Find a way to determine how many time your application calls the server
  • Find how much any single call is costing in term of data exchanged

How to monitor these values depends a lot from the technology involved, for some is very simple (if, for example, you're using a web service, setting up Fiddler to monitor the calls and examining an monitoring results is very simple), for other you need to work using a low level traffic analyzer like Wireshark or MS Network Monitor and learn how to filter traffic according to IP address of the server, ports used and other parameters.

If you clarify your application architecture I can try to be more specific.

Regards Massimo

massimogentilini
+1  A: 

It is not clear by your post if you are using HTTP requests. You indicated that the server is a web application, which implies (perhaps incorrectly) to me that you might be using the HTTP protocol to send/receive data from server to client.

If so, one tool that might be of use is Fiddler. This tool will monitor all HTTP traffic in and out of your workstation and it can (I believe) watch specific sessions and applications. The nice part is that you can see individual requests and see the statistics for these requests, including bytes in/out, round trip times, and other useful bits of information.

If you are not HTTP based, then this tool won't help.

Mark
+1  A: 

I'm surprised nobody has suggested SysInternals (now Microsoft) Process Explorer (technet.microsoft.com/en-us/sysinternals/bb896653.aspx). If you right click on the executable in question and left click properties it will bring up a dialog box. Then you switch to the performance tab and you can monitor I/O of the executable. The Performance Graph tab will show CPU usage and I/O bytes history graphed over time. It's a cool and free tool.

David Yates
A: 

You should check out ACE Analyst for this use case - think of it as a superintelligent layer on top of Wireshark packet captures. You need to look at the packets to understand the true nature of the application behavior as runs across the network.