DCSIMG
April 2010 - Posts - Zuker On Foundations

Zuker On Foundations

The realm of .NET (WPF, WCF and all around)

April 2010 - Posts

WCF Contrib v2.1 and .NET 4.0

We all know Visual Studio 2010 and .NET Framework had been released during the last week..

I’ve compiled WCF Contrib v2.1 in .NET 4.0 to be available for download if you need -

wcfcontrib.mar07.binaries.4.0.zip

Posted Friday, April 16, 2010 11:16 AM by Amir Zuker | 1 comment(s)

תגים:,

Parallel Extensions or Asynchronous Invocation with IO-based operations – Take 2

Read about the test details in the previous post.

After a few more various tests, the initialization time overhead is changing from time to time, and sometimes there isn’t an overhead whatsoever.
However, the fact remains the same, the asynchronous invocation pattern shows most constant results in this specific case.

My good friend Aelij Arbel pointed out another pattern of invocation using the Parallel Extensions TPL – the asynchronous API.

I added it to the test as follows:

static void CallServicesTasksAsync(IMyService client)

{

    Task[] tasks = _serviceCalls

        .Select(c => Task.Factory.FromAsync(client.BeginDo, client.EndDo, null))

        .ToArray();

 

    Task.WaitAll(tasks);

}

This yielded results pretty much just as the standard asynchronous invocation! Hooray!

Why is that?
Parallelizing and waiting on the synchronous “Do” operation schedules it on different threads and blocks on them (using the default scheduler).
Threads should be allocated and blocked where there’s actual CPU-bound work, this issue becomes crucial when resources are tight in your application.
This is why using the asynchronous pattern within the TPL has better results altogether. (where a thread is opened for the I/O only, not for the entire operation)

Posted Thursday, April 01, 2010 11:23 AM by Amir Zuker | 1 comment(s)