connection pooling and threads

  • Thread starter Plausible Indirection
  • Start date
P

Plausible Indirection

Suppose I have an application server running components in different
threads.

Will a connection pool be shared across threads?

If yes, then theoretically these different components might have
identical connection strings and end up in the same pool. Suppose
both set Max Pool Size. I'm thinking the second (or later) component
to become active might be out of luck in terms of being able to get
connections.

Can this happen?

On the other hand, if a single application runs multiple threads, you
wouldn't necessarily want a different pool for every thread.

Comments?

Thanks,
Chris
 
M

Miha Markic [MVP C#]

Hi,

Plausible Indirection said:
Suppose I have an application server running components in different
threads.

Will a connection pool be shared across threads?
Yes.


If yes, then theoretically these different components might have
identical connection strings and end up in the same pool. Suppose
both set Max Pool Size. I'm thinking the second (or later) component
to become active might be out of luck in terms of being able to get
connections.
Can this happen?


No, for connections to live in the same pool they have to have exact same
connection string.
On the other hand, if a single application runs multiple threads, you
wouldn't necessarily want a different pool for every thread.

Of course not.
 
P

Plausible Indirection

That multiple components were using connection strings that happenned
to be identical was part of the question. So, I think the answer is
yes.

A way around this might be for there to be some do-next-to-nothing
connection string setting like Component Name or Pool Name.
Basically, it wouldn't have any purpose except to help ensure unique
connection strings between components.

-Chris
 
M

Miha Markic [MVP C#]

Plausible Indirection said:
That multiple components were using connection strings that happenned
to be identical was part of the question. So, I think the answer is
yes.

A way around this might be for there to be some do-next-to-nothing
connection string setting like Component Name or Pool Name.
Basically, it wouldn't have any purpose except to help ensure unique
connection strings between components.

But why would you want to create several pools?
If there is maxpoolsize in connection string it probably has a purpose.
You might change it before applying connection string..
 
P

Plausible Indirection

What if there are different teams writing different components, all of
which will be plugged into the same app server?

In this scenario, it wouldn't really matter if Max Pool Size was not
set or if it were set to the same value by more than one team.
 
W

William \(Bill\) Vaughn

Huh? Each process and application domain gets its own dedicated pool. What
one process does has no bearing on what other processes do.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
P

Plausible Indirection

I seem to have stumbled into a gray area for me. I was under the
impression that there exist application servers which run multiple
components in different threads, but that the app server itself runs
under a single process. If that is not the case, sorry, nevermind.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top