0

I am testing an Azure worker role that offers 10-12 different service operations that are available to WPF desktop clients. I am keeping an eye on the total outgoing bandwidth via the Azure billing portal. It seems these operations are generating more outgoing bandwidth than I had anticipated.

Is there any way to "measure" the total download size of each service operation from the WPF client perspective? I know C# doesn't have an equivalent sizeof operator so I figure I can't just do a

sizeof(List<MyObjects>) 

to see total bytes being transferred for any particular call.

I thought about maybe using wireshark and somehow tally up packet sizes for each service operation call and finding the bandwidth hogs in this manner.

Is there an easier way to do this?

Joe Davola
  • 17
  • 5

2 Answers2

1

If your WCF service is running under IIS, you can use IIS's built-in performance counters, such as:

  • \Web Service(Default Web Site)\Total Bytes Received
  • \Web Service(Default Web Site)\Total Bytes Sent
Igorek
  • 15,716
  • 3
  • 54
  • 92
  • Do you know if Azure worker roles have these performance counters? I know that Azure web roles are hosted in IIS, but I'm not sure if a worker role is. – Joe Davola Aug 18 '12 at 05:39
  • It depends if you're hosting the WCF service under IIS or not. IIS can absolutely be installed under a Worker Role. I dont know your particular setup – Igorek Aug 18 '12 at 06:20
1

The performance counters are good to calculate the total bytes sent/received. But if you want to know the amount per operation call, you'll need to write a message inspector on the side of the service.

This will allow you to intercept each incoming and outgoing message and you'll have access to the raw Message object, allowing you to measure the total size of the request and the response.

Sandrino Di Mattia
  • 24,739
  • 2
  • 60
  • 65
  • Thank you, I had not heard of message inspector before. They look like they offer a lot of functionality. Will take a closer look. – Joe Davola Aug 18 '12 at 14:59
  • I suggest you take a look at Carlos Figueira's blog if you want to take a closer look at Message Inspectors and WCF extensibility in general: http://blogs.msdn.com/b/carlosfigueira/archive/2011/04/19/wcf-extensibility-message-inspectors.aspx – Sandrino Di Mattia Aug 18 '12 at 15:14