473,465 Members | 1,444 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

WCF Router Sample CPU Usage Problem

I am looking at using the rotuer sample that comes with the samples in the
Vista sdk (Microsoft
SDKs\Windows\v6.0\Samples\WCFSamples\TechnologySam ples\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.TryG etValue(to,
out forwardingChannel) || ((IClientChannel)forwardingChannel).State !=
CommunicationState.Opened)
{
lock (this.extension.RequestReplyDatagramChannels)
{
if
(!this.extension.RequestReplyDatagramChannels.TryG etValue(to, out
forwardingChannel) || ((IClientChannel)forwardingChannel).State !=
CommunicationState.Opened)
{
ChannelFactory<IRequestReplyDatagramRouterfactory
= new
ChannelFactory<IRequestReplyDatagramRouter>(this.e xtension.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.
Jun 27 '08 #1
0 1951

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: John J. Hughes II | last post by:
My code starts a TCP/IP socket listener and waits for incoming connections. This works fine on my system and my test system but I have a customer who say it does not work on their system. As far...
2
by: cyshao | last post by:
How to reset Router by programing? For some resean, we need usually reset our Router. Now, we have to Reset Router manually(shot down and reopen). Are there any method to control and reset...
3
by: steve | last post by:
anyone know how to get a network router's external ip address? any examples w/b great! tia, steve
0
by: John | last post by:
Today something weird happened: I bought myself a new wireless router for home, got it set up, and everything was great. Browsing, email, even Shareaza p2p. Until I tried to use the ASP.NET 2...
0
by: mario.lat_ | last post by:
Hallo to all, I have write a little script for connecting to cisco router BUT I have a problem: I have to send to router all the commands and then I have to read the output. If I send a command1...
4
by: seets375 | last post by:
Hi, I have two ethernet interfaces on my system, with IPs assigned to the interfaces from different subnets (e.g. eth1 - 10.10.10.10 and eth2 - 20.20.20.20 ). I'm connecting these interfaces to...
5
by: =?Utf-8?B?SmltbWVy?= | last post by:
Hello, I've been trying to create a WCF SOAP Router Service that can forward not just the message body but also any security headers set by the originator of the message. The destination service...
9
by: cnixuser | last post by:
Hi, I was wondering if someone could give me some general pointers about creating client server applications that would be able to communicate with each other over not just the LAN which I am able...
3
by: apg018 | last post by:
Hi - I just bought an Asus laptop with wireless capabilities. I have a desktop that I've used for years that is hooked up to Cox cable for high speed internet through a Motorola SG5120 cable modem....
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.