PC Review


Reply
Thread Tools Rate Thread

Async Calls to DB does not help in the efficiency department?

 
 
roberto3214@netscape.net
Guest
Posts: n/a
 
      26th Jan 2005
Hi Guys,

I was recently reading an article:
http://msdn.microsoft.com/library/de...ce10012002.asp

[Excerpt]
"One of the most common types of I/O operations that occur within a Web
method is a call to a SQL database. Unfortunately, Microsoft® ADO.NET
does not have a good asynchronous calling mechanism defined at this
time, and simply wrapping a SQL call in an asynchronous delegate call
does not help in the efficiency department. Caching results is
sometimes an option, but you should also consider using the Microsoft
SQL Server 2000 Web Services Toolkit to expose your databases as a Web
service. You will then be able to use the support in the .NET Framework
for calling Web services asynchronously to query or update your
database."

It stated that perhaps wrapping an sql call in an async delegate
doesn't really provide any performance gains. Is this true? Or does
this only apply to webmethods? Maybe I'm misinterpreting what is being
said?

Regards DotnetShadow

 
Reply With Quote
 
 
 
 
W.G. Ryan eMVP
Guest
Posts: n/a
 
      27th Jan 2005
Roberto - they can definitely help the responsiveness of an application
depending on how you code things- but AFAIK - I haven't seen any performance
benefits - in fact depending on how things are called- there's actually a
hit to performance. But the hit to performance can be trivial and more than
offset itself by the increased responsivness.

--
W.G. Ryan MVP (Windows Embedded)

TiBA Solutions
www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
Hi Guys,

I was recently reading an article:
http://msdn.microsoft.com/library/de...ce10012002.asp

[Excerpt]
"One of the most common types of I/O operations that occur within a Web
method is a call to a SQL database. Unfortunately, Microsoft® ADO.NET
does not have a good asynchronous calling mechanism defined at this
time, and simply wrapping a SQL call in an asynchronous delegate call
does not help in the efficiency department. Caching results is
sometimes an option, but you should also consider using the Microsoft
SQL Server 2000 Web Services Toolkit to expose your databases as a Web
service. You will then be able to use the support in the .NET Framework
for calling Web services asynchronously to query or update your
database."

It stated that perhaps wrapping an sql call in an async delegate
doesn't really provide any performance gains. Is this true? Or does
this only apply to webmethods? Maybe I'm misinterpreting what is being
said?

Regards DotnetShadow


 
Reply With Quote
 
Pablo Castro [MS]
Guest
Posts: n/a
 
      27th Jan 2005
Yep, async delegates may help with responsiveness (e.g. will avoid blocking
the UI thread in a Windows app, or may allow to make multiple database API
calls in parallel), but it will typically have no positive effect on perf
(and in many scenarios it can hurt it pretty bad).

The main problem is that in the end the APIs that you're calling are
synchronous, so they'll block a thread; by using an async delegate all
you're doing is blocking another thread instead of yours. If you can get
something else done in the meanwhile, it might be good, but now you're using
more threads per-request.

FWIW, in the next release of ADO.NET we will support true asynchronous
command execution , you can read about it in this article:

http://msdn.microsoft.com/data/DataA...tml/async2.asp

--
Pablo Castro
Program Manager - ADO.NET Team
Microsoft Corp.

This posting is provided "AS IS" with no warranties, and confers no rights.


"W.G. Ryan eMVP" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Roberto - they can definitely help the responsiveness of an application
> depending on how you code things- but AFAIK - I haven't seen any

performance
> benefits - in fact depending on how things are called- there's actually a
> hit to performance. But the hit to performance can be trivial and more

than
> offset itself by the increased responsivness.
>
> --
> W.G. Ryan MVP (Windows Embedded)
>
> TiBA Solutions
> www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
> <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> Hi Guys,
>
> I was recently reading an article:
>

http://msdn.microsoft.com/library/de...ce10012002.asp
>
> [Excerpt]
> "One of the most common types of I/O operations that occur within a Web
> method is a call to a SQL database. Unfortunately, Microsoft® ADO.NET
> does not have a good asynchronous calling mechanism defined at this
> time, and simply wrapping a SQL call in an asynchronous delegate call
> does not help in the efficiency department. Caching results is
> sometimes an option, but you should also consider using the Microsoft
> SQL Server 2000 Web Services Toolkit to expose your databases as a Web
> service. You will then be able to use the support in the .NET Framework
> for calling Web services asynchronously to query or update your
> database."
>
> It stated that perhaps wrapping an sql call in an async delegate
> doesn't really provide any performance gains. Is this true? Or does
> this only apply to webmethods? Maybe I'm misinterpreting what is being
> said?
>
> Regards DotnetShadow
>
>



 
Reply With Quote
 
roberto3214@netscape.net
Guest
Posts: n/a
 
      28th Jan 2005
Thanks for your input guys, so basically no point doing async SQL
requests? Like I'm mainly interested for the purposes of forget and
fire type requests

Regards Rob

Pablo Castro [MS] wrote:
> Yep, async delegates may help with responsiveness (e.g. will avoid

blocking
> the UI thread in a Windows app, or may allow to make multiple

database API
> calls in parallel), but it will typically have no positive effect on

perf
> (and in many scenarios it can hurt it pretty bad).
>
> The main problem is that in the end the APIs that you're calling are
> synchronous, so they'll block a thread; by using an async delegate

all
> you're doing is blocking another thread instead of yours. If you can

get
> something else done in the meanwhile, it might be good, but now

you're using
> more threads per-request.
>
> FWIW, in the next release of ADO.NET we will support true

asynchronous
> command execution , you can read about it in this article:
>
>

http://msdn.microsoft.com/data/DataA...tml/async2.asp
>
> --
> Pablo Castro
> Program Manager - ADO.NET Team
> Microsoft Corp.
>
> This posting is provided "AS IS" with no warranties, and confers no

rights.
>
>
> "W.G. Ryan eMVP" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Roberto - they can definitely help the responsiveness of an

application
> > depending on how you code things- but AFAIK - I haven't seen any

> performance
> > benefits - in fact depending on how things are called- there's

actually a
> > hit to performance. But the hit to performance can be trivial and

more
> than
> > offset itself by the increased responsivness.
> >
> > --
> > W.G. Ryan MVP (Windows Embedded)
> >
> > TiBA Solutions
> > www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
> > <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > Hi Guys,
> >
> > I was recently reading an article:
> >

>

http://msdn.microsoft.com/library/de...ce10012002.asp
> >
> > [Excerpt]
> > "One of the most common types of I/O operations that occur within a

Web
> > method is a call to a SQL database. Unfortunately, Microsoft®

ADO.NET
> > does not have a good asynchronous calling mechanism defined at this
> > time, and simply wrapping a SQL call in an asynchronous delegate

call
> > does not help in the efficiency department. Caching results is
> > sometimes an option, but you should also consider using the

Microsoft
> > SQL Server 2000 Web Services Toolkit to expose your databases as a

Web
> > service. You will then be able to use the support in the .NET

Framework
> > for calling Web services asynchronously to query or update your
> > database."
> >
> > It stated that perhaps wrapping an sql call in an async delegate
> > doesn't really provide any performance gains. Is this true? Or does
> > this only apply to webmethods? Maybe I'm misinterpreting what is

being
> > said?
> >
> > Regards DotnetShadow
> >
> >


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Any harm in using Async=true to sql server 2005 for non-async db calls Chris Becker Microsoft ADO .NET 1 23rd Mar 2007 12:18 AM
Csharp async calls to Web Service that calls C++ :: blocking issue Brian Parker Microsoft C# .NET 10 21st Apr 2006 03:12 AM
Trying to get my head around async calls... Kyle Jedrusiak Microsoft Dot NET Framework 5 14th May 2005 02:05 AM
async calls =?Utf-8?B?Tm9ybUQ=?= Microsoft Dot NET Framework 7 5th May 2005 01:53 AM
Re: Async calls Ilya Tumanov [MS] Microsoft Dot NET Compact Framework 0 8th Jul 2003 11:27 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:17 PM.