WCF Router Sample CPU Usage Problem, in WSCF/WCF

BizTalk Utilities CV ,   Jobs ,   Code library
 
Go to the front page to continue learning about XML or select below:

Contents

Recent WSCF/WCF posts

\r\n problem with SOAP and XmlDocument
WCF Service Validating Soap Header Username/Password
Username and Password validation in wcf adapter
WCF - How much security is needed?
How to provide custom WSDL from a WCF server
WCF security question
Best Practices - most forward looking
WCF authentication problems
XML attributes
WCF and WebServices

 
 

WSCF/WCF

View :   

Latest Topics

Table Of Contents


Post Reply

WCF Router Sample CPU Usage Problem

All posts: microsoft.public.dotnet.framework.webservices
Source: microsoft.public.dotnet.framework.webservices
Sent date: 05/19/2008
From: Jonathan Steinberg
Message:

I am looking at using the rotuer sample that comes with the samples in the
Vista sdk (Microsoft
SDKs\Windows\v6.0\Samples\WCFSamples\TechnologySamples\Scenario\Router\CS\router)

I am using .Net 3.0, C# 2.0, on win2K3 servers.

I have stripped down almost all of the non-essential code from the message
processor , leaving me with this code:

//ProcessMessage implemenation
Message IRequestReplyDatagramRouter.ProcessMessage(Message message)
{
string newEndPoint = ///destination server endpoint.
EndpointAddress to = new EndpointAddress(newEndpoint);

// If the router doesn't already have a two-way datagram channel
to the 'to' EPR or if that channel is no longer opened, create one.
IRequestReplyDatagramRouter forwardingChannel;
if (!this.extension.RequestReplyDatagramChannels.TryGetValue(to,
out forwardingChannel) || ((IClientChannel)forwardingChannel).State !=
CommunicationState.Opened)
{
lock (this.extension.RequestReplyDatagramChannels)
{
if
(!this.extension.RequestReplyDatagramChannels.TryGetValue(to, out
forwardingChannel) || ((IClientChannel)forwardingChannel).State !=
CommunicationState.Opened)
{
ChannelFactory<IRequestReplyDatagramRouter> factory
= new
ChannelFactory<IRequestReplyDatagramRouter>(this.extension.Bindings[to.Uri.Scheme], to);
// Add a channel behavior that will turn off
validation of @mustUnderstand on the reply's headers.
factory.Endpoint.Behaviors.Add(new
MustUnderstandBehavior(false));
forwardingChannel = factory.CreateChannel();

this.extension.RequestReplyDatagramChannels[to] =
forwardingChannel;
}
}
}

Message response = forwardingChannel.ProcessMessage(message);

return response;

}

This is almost exactly the same as the sample, except for these changes I made
1) I am hosting the service in IIS (6.0)
2) I replaced the custom binding class in the extension class with "new
basicHTTPBinding()" ( i.e., where it calls
"this.extension.Bindings[to.Uri.Scheme]")
3) For now the destination URL is hardcoded (the "to" endpoint")

Here's the question:
The Router works fine, but I am concerned about CPU usage.
Stress testing on our development servers shows that the CPU hits 90-100%
on the routing server when I hit about 50 requests a second. When I call my
destination server (the actual app logic) directly from the test client, the
application server rarely goes over 20% CPU. The operation is a very light
operation , mainly looking up data in a static dictionary.
I verified by logging that the forwarding channel is *not* being created
every time. It is cached in the extension class.
The only code which is executing every call is

Message response = forwardingChannel.ProcessMessage(message);

Why would this use so much CPU, and where could I look to tune this for more
efficiency?

Thanks.
JS

--
Jonathan Steinberg
Jefferies & Co.

Post Reply

Related Messages

Table Of Contents



Other groups

WCF LOB

WSCF/WCF

BizTalk Rule Engine

BizTalk BPM, process

BizTalk BAM, activity

Biztalk Adapters

BizTalk Orchestration

BizTalk Server

WS WSDL

 

    Email TopXML