Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Indigo

Vista - Asynchronous WCF Question

 
 
Old 06-08-2008   #1 (permalink)
Vikas Manghani


 
 

Asynchronous WCF Question

Hi
I am using WCF Services exposed as REST URIs to be consumed by generic AJAX
clients. All of my services need to be Async in nature.
We have a typical n-layer architecture for our project wherein the Service
Layer --> Business Layer and
Business Layer --> Data Access Layer
Data Access Layer --> LINQ --> DB

The heaviest part of the processing will be fetching and sending updates to
the database. As such this part needs to be made asynchronous.
Earlier, we had thought that the service layer would simply accept the
calls. It would then use ThreadPool.QueueUserWorkItem to spawn a secondary
thread and move the calls to the Business Layer onwards to this secondary
thread. For e.g.

public IAsyncResult BeginGetData(params)
{
//Create an AsyncResult
ThreadPool.QueueUserWorkItem(SomeCallback, AsyncResult)
//Return AsyncResult
}

private void SomeCallback(object state)
{
//Call BUSINESS Layer which calls Data Access Layer and so on.
}

public string GetData(AsyncResult)
{

}
But this defeats the purpose of Async operations since we end up using
threads from the same thread pool as ASP.Net for the WCF services. A load
test confirmed this too. The performance was worse than a synchronous WCF
service call. An article I read on Async HTTP handlers mentioned the same. Do
I need to split my Business Layer and Data Access Layer methods into Begin
and End pairs too? Or is there a better way.

Kindly let me know, what is the preferred way of handling this as I am sure
that this would be a problem faced commonly.

Thanks in advance
Vikas Manghani


My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Asynchronous Processing PowerShell
asynchronous serial i/o .NET General
new process should be asynchronous .NET General
Serial ATA AN (Asynchronous Notification) Vista hardware & devices


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46