My performance measurements of synchronous WCF calls from within a Silverlight application showed I can make 7 calls/s on a localhost connection, which is very slow. Can this be speeded up, or is this normal?
This is my test code:
const UInt32 nrCalls = 100;
ICalculator calculator = new CalculatorClient(); // took over from the MSDN calculator example
for (double i = 0; i < nrCalls; ++i)
{
var call = calculator.BeginSubtract(i + 1, 1, null, null);
call.AsyncWaitHandle.WaitOne();
double result = calculator.EndSubtract(call);
}
Remarks:
- CPU load is almost 0%. Apparently, the WCF module is waiting for something.
- I tested this both on Firefox 3.6 and Internet Explorer 7.
- I'm using Silverlight v3.0
- For comparison: I've once written an IPC library in C++ and a similar test yielded some 4000 calls/s. That was without the HTTP packet wrapper, but I don't expect that to slow things down much. It's just that 7 calls/s is so incredibly slow.
Update: I've ported the client side from Silverlight to .NET, and this solved the performance problem. In that test, synchronous calls are made at 140 calls/s (instead of 7 calls/s), and asynchronous calls at 200 calls/s (instead of 16 calls/s). Apparently, the slowness is inherent to the Silverlight platform. I'll have to learn to live with it.