如何在应用程序中分析序列化开销

时间:2022-05-29 05:38:59

My application has a WCF service tier between the front-end and the database. Since we currently host in IIS6 we are using SOAP over HTTP. How can I find out how much real world time I am spending doing serialization activities in my application?

我的应用程序在前端和数据库之间有一个WCF服务层。由于我们目前在IIS6中托管,因此我们使用SOAP over HTTP。如何知道我在应用程序中进行序列化活动所花费的实际时间?

4 个解决方案

#1


4  

Not about measuring - but about improving: I've been working on protobuf-net, an implementation of Google's "protocol buffers" (a compact, low-CPU binary serialization format) for use with .NET - including a WCF hook (to replace the DataContractSerializer). It has some pretty good metrics re serialization.

不是关于测量 - 而是关于改进:我一直致力于protobuf-net,一种用于.NET的“协议缓冲区”(一种紧凑的,低CPU二进制序列化格式)的实现 - 包括一个WCF钩子(用于替换) DataContractSerializer)。它有一些很好的指标重新序列化。

When used with the basic http binding, it also works with MTOM, so you don't even get the base-64 overhead of binary. There is a WCF sample here.

当与基本的http绑定一起使用时,它也可以与MTOM一起使用,因此您甚至无法获得二进制的base-64开销。这里有一个WCF示例。

It might be of interest...

它可能是有意义的......

#2


1  

Create a message inspector and add it to your endpoint behavior,

创建一个消息检查器并将其添加到您的端点行为,

In the message inspector, you implement the interface which has the following method

在消息检查器中,您实现具有以下方法的接口

AfterReceiveRequest
{
  DateTime start = datetime.now;
  return start;
}
BeforeSendReply
{
 // start will be passed in as state in the parameter.  
 TimeSpan period = datetime.now - start 
}

#3


0  

One of the dead simple things old mainframes always used to to was to include a "sever time" field in the response. Therefore you'd know that anything that happened between your observed time and server time is network/serialization overhead. I know it kind of 1960-ish, but it still works well.

老式大型机常常使用的一个简单的事情就是在响应中包含一个“服务器时间”字段。因此,您知道在观察到的时间和服务器时间之间发生的任何事情都是网络/序列化开销。我知道它有点像1960年代,但它仍然运作良好。

If you want avoid changing the method signature you can set it in a http response header or something ;)

如果你想避免更改方法签名,你可以在http响应头或其他东西中设置它;)

#4


0  

The xperf tools are a good choice if you can run on Windows Server 2008 and Vista on the client. These are ETW based and use the Windows sample profile interrupt to profile anything running on the system. Here is series of posts on the xperf tools from myself. This post is specifically about profiling.

如果您可以在客户端上运行Windows Server 2008和Vista,则xperf工具是一个不错的选择。这些是基于ETW的,并使用Windows示例配置文件中断来分析系统上运行的任何内容。以下是我自己的xperf工具系列文章。这篇文章专门关于分析。

note that you can download the latest version of the tools directly for this page.

请注意,您可以直接为此页面下载最新版本的工具。

You may want to experiment with some of the other kernel events, such as disk IO and hard faults.

您可能希望尝试一些其他内核事件,例如磁盘IO和硬故障。

#1


4  

Not about measuring - but about improving: I've been working on protobuf-net, an implementation of Google's "protocol buffers" (a compact, low-CPU binary serialization format) for use with .NET - including a WCF hook (to replace the DataContractSerializer). It has some pretty good metrics re serialization.

不是关于测量 - 而是关于改进:我一直致力于protobuf-net,一种用于.NET的“协议缓冲区”(一种紧凑的,低CPU二进制序列化格式)的实现 - 包括一个WCF钩子(用于替换) DataContractSerializer)。它有一些很好的指标重新序列化。

When used with the basic http binding, it also works with MTOM, so you don't even get the base-64 overhead of binary. There is a WCF sample here.

当与基本的http绑定一起使用时,它也可以与MTOM一起使用,因此您甚至无法获得二进制的base-64开销。这里有一个WCF示例。

It might be of interest...

它可能是有意义的......

#2


1  

Create a message inspector and add it to your endpoint behavior,

创建一个消息检查器并将其添加到您的端点行为,

In the message inspector, you implement the interface which has the following method

在消息检查器中,您实现具有以下方法的接口

AfterReceiveRequest
{
  DateTime start = datetime.now;
  return start;
}
BeforeSendReply
{
 // start will be passed in as state in the parameter.  
 TimeSpan period = datetime.now - start 
}

#3


0  

One of the dead simple things old mainframes always used to to was to include a "sever time" field in the response. Therefore you'd know that anything that happened between your observed time and server time is network/serialization overhead. I know it kind of 1960-ish, but it still works well.

老式大型机常常使用的一个简单的事情就是在响应中包含一个“服务器时间”字段。因此,您知道在观察到的时间和服务器时间之间发生的任何事情都是网络/序列化开销。我知道它有点像1960年代,但它仍然运作良好。

If you want avoid changing the method signature you can set it in a http response header or something ;)

如果你想避免更改方法签名,你可以在http响应头或其他东西中设置它;)

#4


0  

The xperf tools are a good choice if you can run on Windows Server 2008 and Vista on the client. These are ETW based and use the Windows sample profile interrupt to profile anything running on the system. Here is series of posts on the xperf tools from myself. This post is specifically about profiling.

如果您可以在客户端上运行Windows Server 2008和Vista,则xperf工具是一个不错的选择。这些是基于ETW的,并使用Windows示例配置文件中断来分析系统上运行的任何内容。以下是我自己的xperf工具系列文章。这篇文章专门关于分析。

note that you can download the latest version of the tools directly for this page.

请注意,您可以直接为此页面下载最新版本的工具。

You may want to experiment with some of the other kernel events, such as disk IO and hard faults.

您可能希望尝试一些其他内核事件,例如磁盘IO和硬故障。