Home All Groups Group Topic Archive Search About

Does MARS use multiple connections behind the scenes?

Author
23 Feb 2007 11:14 AM
Simon Harvey
Hi all,

Quick question. I would like to use MARS to avoid lots of additional
connections being opened in a certain area of code that I have (a deep
load style scenario)

As I understand it, it allows you to have several open data readers on
the one connection. Seems pretty straight forward really.

The thing that puzzles me is that in most of the documents I've read
about it, it states that there is no performance advantage to using it.
I don't mind that, but its does puzzle me a bit.

How can there be no performance advantage to NOT opening and disposing
potentially scores of additional connections? I know we have to factor
in connection pooling, but even still, there must be some overhead to
the alternative of creating and breaking all those extra SQLConnection
objects.

Then I got to thinking, what if its just a sort of abstraction layer -
where it is actually opening more connections behing the scenes so the
programmer doesnt need to worry about it.

I'm next to certain that that wont be the case, but could someone
explain to me why MARS isn't much more resource efficient?

Many thanks to anyone who can advise

Kindest Regards

Simon

Author
23 Feb 2007 1:00 PM
Willy Denoyette [MVP]
Show quote
"Simon Harvey" <notha***@hotmail.com> wrote in message
news:e$ZEquzVHHA.4832@TK2MSFTNGP04.phx.gbl...
> Hi all,
>
> Quick question. I would like to use MARS to avoid lots of additional connections being
> opened in a certain area of code that I have (a deep load style scenario)
>
> As I understand it, it allows you to have several open data readers on the one connection.
> Seems pretty straight forward really.
>
> The thing that puzzles me is that in most of the documents I've read about it, it states
> that there is no performance advantage to using it. I don't mind that, but its does puzzle
> me a bit.
>
> How can there be no performance advantage to NOT opening and disposing potentially scores
> of additional connections? I know we have to factor in connection pooling, but even still,
> there must be some overhead to the alternative of creating and breaking all those extra
> SQLConnection objects.
>
> Then I got to thinking, what if its just a sort of abstraction layer - where it is
> actually opening more connections behing the scenes so the programmer doesnt need to worry
> about it.
>
> I'm next to certain that that wont be the case, but could someone explain to me why MARS
> isn't much more resource efficient?
>
> Many thanks to anyone who can advise
>
> Kindest Regards
>
> Simon

Did you read this:
http://msdn2.microsoft.com/en-us/library/ms345109.aspx
and
http://blogs.msdn.com/sqlnativeclient/archive/2006/09/27/774290.aspx


Willy.

AddThis Social Bookmark Button