I surely don't want to start a religious debate here...
I'm curious - what is the conventional wisdom about using a single global connection in a VB frontend (using ADO) and leaving that connection open for the entire time the app is running?
I've seen people suggest that you close the connection and re-open for every query.
The specifics of my app is 1000+ users - dozens stay in all day long - others stay in for a short time (less than 30 minutes). Large WAN - dozens of buildings across town.
Thanks in advance.My $.02 It depends on your licensing model and what you mean by stay in all
day. Do they actually run the application or just have it open. If it is
open and idle I believe Windows 2000 SP2 cuts idle connections after 20
minutes. (SP2 fixed a bug hat allowed unlimited open connection time on idle
connections)
--
Andrew C. Madsen
Information Architect
Harley-Davidson Motor Company
"Steve Z" <Steve Z@.discussions.microsoft.com> wrote in message
news:0B26EC78-F295-48D7-9BB7-85535E2C13F4@.microsoft.com...
> I surely don't want to start a religious debate here...
> I'm curious - what is the conventional wisdom about using a single global
connection in a VB frontend (using ADO) and leaving that connection open for
the entire time the app is running?
> I've seen people suggest that you close the connection and re-open for
every query.
> The specifics of my app is 1000+ users - dozens stay in all day long -
others stay in for a short time (less than 30 minutes). Large WAN - dozens
of buildings across town.
> Thanks in advance.|||close it, set it to nothing and let connection pooling do its thing.
Cheers
Greg Jackson
PDX, Oregon|||My approach is ALWAYS get in, tweak the data, get out. Don't hold a
connection open longer than you have to.
--
http://www.aspfaq.com/
(Reverse address to reply.)
"Steve Z" <Steve Z@.discussions.microsoft.com> wrote in message
news:0B26EC78-F295-48D7-9BB7-85535E2C13F4@.microsoft.com...
> I surely don't want to start a religious debate here...
> I'm curious - what is the conventional wisdom about using a single global
connection in a VB frontend (using ADO) and leaving that connection open for
the entire time the app is running?
> I've seen people suggest that you close the connection and re-open for
every query.
> The specifics of my app is 1000+ users - dozens stay in all day long -
others stay in for a short time (less than 30 minutes). Large WAN - dozens
of buildings across town.
> Thanks in advance.|||Why not hold a connection open? Why cause re-authentication of the user to the DB?
If someone opens a maintenance form and starts calling up records - when would you decide they were done enough to close the connection?
What is the actual downside of a PC holding a connection open to the DB for lets say - oh - 4 hours?
"Aaron [SQL Server MVP]" wrote:
> My approach is ALWAYS get in, tweak the data, get out. Don't hold a
> connection open longer than you have to.
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "Steve Z" <Steve Z@.discussions.microsoft.com> wrote in message
> news:0B26EC78-F295-48D7-9BB7-85535E2C13F4@.microsoft.com...
> > I surely don't want to start a religious debate here...
> >
> > I'm curious - what is the conventional wisdom about using a single global
> connection in a VB frontend (using ADO) and leaving that connection open for
> the entire time the app is running?
> >
> > I've seen people suggest that you close the connection and re-open for
> every query.
> >
> > The specifics of my app is 1000+ users - dozens stay in all day long -
> others stay in for a short time (less than 30 minutes). Large WAN - dozens
> of buildings across town.
> >
> > Thanks in advance.
>
>|||What is wrong with holding a connection open?
What is the cost of re-authenticating the user to the DB?
What is the actual downside of hold the connection - let's say - for 4 or 5 hours?
If a user goes into a maintenance form and starts working on a record to change it - what would be the moment you all thought that the connection is worth closing?
"Aaron [SQL Server MVP]" wrote:
> My approach is ALWAYS get in, tweak the data, get out. Don't hold a
> connection open longer than you have to.
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "Steve Z" <Steve Z@.discussions.microsoft.com> wrote in message
> news:0B26EC78-F295-48D7-9BB7-85535E2C13F4@.microsoft.com...
> > I surely don't want to start a religious debate here...
> >
> > I'm curious - what is the conventional wisdom about using a single global
> connection in a VB frontend (using ADO) and leaving that connection open for
> the entire time the app is running?
> >
> > I've seen people suggest that you close the connection and re-open for
> every query.
> >
> > The specifics of my app is 1000+ users - dozens stay in all day long -
> others stay in for a short time (less than 30 minutes). Large WAN - dozens
> of buildings across town.
> >
> > Thanks in advance.
>
>|||What is wrong with holding a connection open?
What is the cost of re-authenticating the user to the DB?
What is the actual downside of hold the connection - let's say - for 4 or 5 hours?
If a user goes into a maintenance form and starts working on a record to change it - what would be the moment you all thought that the connection is worth closing?
"Aaron [SQL Server MVP]" wrote:
> My approach is ALWAYS get in, tweak the data, get out. Don't hold a
> connection open longer than you have to.
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "Steve Z" <Steve Z@.discussions.microsoft.com> wrote in message
> news:0B26EC78-F295-48D7-9BB7-85535E2C13F4@.microsoft.com...
> > I surely don't want to start a religious debate here...
> >
> > I'm curious - what is the conventional wisdom about using a single global
> connection in a VB frontend (using ADO) and leaving that connection open for
> the entire time the app is running?
> >
> > I've seen people suggest that you close the connection and re-open for
> every query.
> >
> > The specifics of my app is 1000+ users - dozens stay in all day long -
> others stay in for a short time (less than 30 minutes). Large WAN - dozens
> of buildings across town.
> >
> > Thanks in advance.
>
>|||how do you share that connection between users ?
you are going to have to manage your own "pool" technically.
Keeping a global connection around is kind of an old mentality than in
today's environment does not make sense.
In short, your application will not scale at all if you attempt to do this.
Connection pooling built into OLE\DB pools connections so that the
authentication is not performed with each use of a shared connection.
trust me. you are trying to do manually, what will be done better for you
Automatically.
This is a well published "best practice" or "pattern" for data access in
Enterprise applications.
hope this helps, if you want more details other then "Because I said So"
just let me know and I'll point you to white papers galore (Starting with
"Data Access Best Practices" docs)
Cheers,
Greg J
PDX, Oregon|||Jaxon,
Every white paper I read is about WEB Access and ASP pages.
This is not what we have here. We have a school district - on an internal network - many buildings - 1000+ teachers. Teachers get into attendance app for less than 30 minutes and post attendance for classes. Admin folks and secretaries get in for the whole day - call up kids, start maintenance - get phone calls - interruptions.
What do you mean "share the connection". I meant "global connection" in VB - global to all the forms that the user might call up in the app - I didn't mean global to all users.
Each workstation runs the app and makes a connection - no sharing involved. We do all our server side work with SPROCS - so ADO calls the SPROC from VB - returns the recordset and then the connection stays open until the next ADO/SPROC call.
We use win-nt authentication - so taking advantage of SQL pooling of connections so a similiar one can be found doesn't really make sense to us.
I've found info that says that establishing the connection can be time consuming - so why relinquish it and re-establish it'
Other programmers at this school district use ACCESS to touch there DB's. I see that ACCESS opens "several" connections for just one user at a time - this seems more of a waste of resources.
"Jaxon" wrote:
> how do you share that connection between users ?
> you are going to have to manage your own "pool" technically.
> Keeping a global connection around is kind of an old mentality than in
> today's environment does not make sense.
> In short, your application will not scale at all if you attempt to do this.
> Connection pooling built into OLE\DB pools connections so that the
> authentication is not performed with each use of a shared connection.
>
> trust me. you are trying to do manually, what will be done better for you
> Automatically.
>
> This is a well published "best practice" or "pattern" for data access in
> Enterprise applications.
> hope this helps, if you want more details other then "Because I said So"
> just let me know and I'll point you to white papers galore (Starting with
> "Data Access Best Practices" docs)
>
> Cheers,
> Greg J
> PDX, Oregon
>
>|||see inline:
> Every white paper I read is about WEB Access and ASP pages.
There are many white papers on Data Access Strategies and best practices for
N-Tier Applications. It is essentially the same for Web Apps. Web apps can
be (and likely should be) designed as n-tier apps.
> This is not what we have here. We have a school district - on an internal
network - many buildings - 1000+ teachers. Teachers get into attendance app
for less than 30 minutes and post attendance for classes. Admin folks and
secretaries get in for the whole day - call up kids, start maintenance - get
phone calls - interruptions.
That's fine. This still works for N-Tier Architecture
> What do you mean "share the connection". I meant "global connection" in
VB - global to all the forms that the user might call up in the app - I
didn't mean global to all users.
if Each user keeps a Global Connection object in their App on the client
side, you likely will run out of connections quickly and requests will start
to queue up. This is not scalable as larger number of clients adds up.
Connections are a precious resource that should be obtained late and
released early so that connections dont become your system bottleneck.
> Each workstation runs the app and makes a connection - no sharing
involved. We do all our server side work with SPROCS - so ADO calls the
SPROC from VB - returns the recordset and then the connection stays open
until the next ADO/SPROC call.
This sounds like a class 2-tier or Client Server app to me then. likely too
late to turn it into an N-Tier App...you may be stuck. However, I would
still not keep global connections around.
> We use win-nt authentication - so taking advantage of SQL pooling of
connections so a similiar one can be found doesn't really make sense to us.
if each user logs in directly to sql server, you are rigth. You might want
to rethink this and have your code access the DB using a handful of standard
logins (ReadOnly, Read Write, REad Write Delete, Admin, Etc). Then you can
take advantage of pooling and you can scale better
> I've found info that says that establishing the connection can be time
consuming - so why relinquish it and re-establish it'
You're right. You dont want to do this. You want to try to pool connections.
> Other programmers at this school district use ACCESS to touch there DB's.
I see that ACCESS opens "several" connections for just one user at a time -
this seems more of a waste of resources.
Yes Access connectivity to a SQL Server DB can be downright crippling.
hope all this info helps. Sounds like you are already married to an
architecture that you wont be able to change. You may be stuck into doing
what you are currently doing...
Cheers
GAJ|||Thanks greatly for the info...
It would not be impossible for us to set a timeout on the connection and simply re-establish if it's not open. We probably have only 3 or 4 sub's that actually request data from the SPROCS on the server. If we start to see a problem with connection issues - we can experiment with that.
Whenever I go into CURRENT ACTIVITY it appears that the ACCESS clients are using 4 times more connections to there DB's than we are to our DB - but we aren't going to fully roll this out till next September.
One last question - what have you read or what experience do you have with CONNECTION maximums in SQL?
"Jaxon" wrote:
> see inline:
> > Every white paper I read is about WEB Access and ASP pages.
> There are many white papers on Data Access Strategies and best practices for
> N-Tier Applications. It is essentially the same for Web Apps. Web apps can
> be (and likely should be) designed as n-tier apps.
> >
> > This is not what we have here. We have a school district - on an internal
> network - many buildings - 1000+ teachers. Teachers get into attendance app
> for less than 30 minutes and post attendance for classes. Admin folks and
> secretaries get in for the whole day - call up kids, start maintenance - get
> phone calls - interruptions.
> That's fine. This still works for N-Tier Architecture
> >
> > What do you mean "share the connection". I meant "global connection" in
> VB - global to all the forms that the user might call up in the app - I
> didn't mean global to all users.
> if Each user keeps a Global Connection object in their App on the client
> side, you likely will run out of connections quickly and requests will start
> to queue up. This is not scalable as larger number of clients adds up.
> Connections are a precious resource that should be obtained late and
> released early so that connections dont become your system bottleneck.
> >
> > Each workstation runs the app and makes a connection - no sharing
> involved. We do all our server side work with SPROCS - so ADO calls the
> SPROC from VB - returns the recordset and then the connection stays open
> until the next ADO/SPROC call.
> This sounds like a class 2-tier or Client Server app to me then. likely too
> late to turn it into an N-Tier App...you may be stuck. However, I would
> still not keep global connections around.
> >
> > We use win-nt authentication - so taking advantage of SQL pooling of
> connections so a similiar one can be found doesn't really make sense to us.
> if each user logs in directly to sql server, you are rigth. You might want
> to rethink this and have your code access the DB using a handful of standard
> logins (ReadOnly, Read Write, REad Write Delete, Admin, Etc). Then you can
> take advantage of pooling and you can scale better
> >
> > I've found info that says that establishing the connection can be time
> consuming - so why relinquish it and re-establish it'
> You're right. You dont want to do this. You want to try to pool connections.
> >
> > Other programmers at this school district use ACCESS to touch there DB's.
> I see that ACCESS opens "several" connections for just one user at a time -
> this seems more of a waste of resources.
> Yes Access connectivity to a SQL Server DB can be downright crippling.
> hope all this info helps. Sounds like you are already married to an
> architecture that you wont be able to change. You may be stuck into doing
> what you are currently doing...
>
> Cheers
>
> GAJ
>
>|||in line:
> It would not be impossible for us to set a timeout on the connection and
simply re-establish if it's not open. We probably have only 3 or 4 sub's
that actually request data from the SPROCS on the server. If we start to
see a problem with connection issues - we can experiment with that.
That is one idea (timeout stuff). Since only a few subs actually hit the db,
you *Could* have those subs call a com component that handles are your data
access. Then the COM component could manage all the connection stuff for
you. Since everyone goes through the COM object for DB Access, technically
you would only need one login, and hence , connections would be pooled.
(that is classic N-Tier bread - n - butter) food for thought....
> Whenever I go into CURRENT ACTIVITY it appears that the ACCESS clients are
using 4 times more connections to there DB's than we are to our DB - but we
aren't going to fully roll this out till next September.
>
Yeah, access as a front end sucks. It is well documented that Access eats up
connections (I dont remember why. I saw an article explaining this in the
past. I think it was written by Bob Beauchamin)
> One last question - what have you read or what experience do you have with
CONNECTION maximums in SQL?
Not sure what you are asking here ....? SQL server can handle thousands of
connections. however, each connection consumes resources on both the client
and on the server (Socket connections, memory, etc)
Enjoying the chat. Best Wishes
GAJ
> "Jaxon" wrote:
> > see inline:
> >
> > > Every white paper I read is about WEB Access and ASP pages.
> > There are many white papers on Data Access Strategies and best practices
for
> > N-Tier Applications. It is essentially the same for Web Apps. Web apps
can
> > be (and likely should be) designed as n-tier apps.
> >
> > >
> > > This is not what we have here. We have a school district - on an
internal
> > network - many buildings - 1000+ teachers. Teachers get into attendance
app
> > for less than 30 minutes and post attendance for classes. Admin folks
and
> > secretaries get in for the whole day - call up kids, start maintenance -
get
> > phone calls - interruptions.
> >
> > That's fine. This still works for N-Tier Architecture
> >
> > >
> > > What do you mean "share the connection". I meant "global connection"
in
> > VB - global to all the forms that the user might call up in the app - I
> > didn't mean global to all users.
> >
> > if Each user keeps a Global Connection object in their App on the client
> > side, you likely will run out of connections quickly and requests will
start
> > to queue up. This is not scalable as larger number of clients adds up.
> >
> > Connections are a precious resource that should be obtained late and
> > released early so that connections dont become your system bottleneck.
> >
> > >
> > > Each workstation runs the app and makes a connection - no sharing
> > involved. We do all our server side work with SPROCS - so ADO calls the
> > SPROC from VB - returns the recordset and then the connection stays open
> > until the next ADO/SPROC call.
> >
> > This sounds like a class 2-tier or Client Server app to me then. likely
too
> > late to turn it into an N-Tier App...you may be stuck. However, I would
> > still not keep global connections around.
> >
> > >
> > > We use win-nt authentication - so taking advantage of SQL pooling of
> > connections so a similiar one can be found doesn't really make sense to
us.
> >
> > if each user logs in directly to sql server, you are rigth. You might
want
> > to rethink this and have your code access the DB using a handful of
standard
> > logins (ReadOnly, Read Write, REad Write Delete, Admin, Etc). Then you
can
> > take advantage of pooling and you can scale better
> >
> > >
> > > I've found info that says that establishing the connection can be time
> > consuming - so why relinquish it and re-establish it'
> >
> > You're right. You dont want to do this. You want to try to pool
connections.
> >
> > >
> > > Other programmers at this school district use ACCESS to touch there
DB's.
> > I see that ACCESS opens "several" connections for just one user at a
time -
> > this seems more of a waste of resources.
> >
> > Yes Access connectivity to a SQL Server DB can be downright crippling.
> >
> > hope all this info helps. Sounds like you are already married to an
> > architecture that you wont be able to change. You may be stuck into
doing
> > what you are currently doing...
> >
> >
> > Cheers
> >
> >
> > GAJ
> >
> >
> >|||Thanks again for the info...
Here's a quick synopsis on who we are, what we do and how we decided to do it.
We do enterprise apps for municipalities, school districts - labor unions...
We came from 2 decades of mainframe Digital VAX systems - large and small - with our own proprietary RDBMS. We developed our own because we liked the ability to create "functions" in the RDBMS to perform business logic. This was a novel idea 20 years ago. If we needed to calculate if a kid got on the honor roll, we create a function called HONOR - probably developed it in ASSEMBLER - and "hooked" it into our equation parser/compiler in the RDBMS.
With the "loss" of Digital, we needed to port our stuff to PC's - MS with SQL 2000 finally had a product that could handle the systems we had - 2.5 millions rows in some tables - large scale stuff.
On the VAX we had a "general maintenance program" - we could setup maintenance forms with no programming. SCREEN files would tell the system where to draw input boxes - etc. Since it was fully integrated in our RDBMS, we could put business hooks where ever we wanted.
So, here we are 3 years into the VB w/MS SQL conversion and we have once again created a "general maintenance program" - basically a VB program that can create FORMS out of nothing - getting the x/y/size info from a table - binding to SQL SPROCS based on a pattern we developed.
We decided against 3-tier, as we wanted just this one VB APP to support schools, towns - whatever we wanted - calling SPROCS to fill TEXT BOXES with VIEW data - MS FLEX GRIDS with EDITABLE data - etc. Every FORM has the same "functionality buttons" - and as many text boxes and grids as you like - all defined in a SQL table.
The VB Client doesn't know if it's maintaining a STUDENT - a VENDOR - a DOCTOR - it's vanilla - lightweight - no business logic.
All business logic in SPROCS - in T-SQL. Basically the SPROCS are our middle tier - so in a way, it's SQL for DATA, SPROCS for business and VB thin-client to maintain it all.
It's been a very good experience so far. We even have our own report writer - much more functionality than Crystal - and once again - it's homegrown so if we have a odd quirk we need to handle, we can do it.
"Jaxon" wrote:
> in line:
> > It would not be impossible for us to set a timeout on the connection and
> simply re-establish if it's not open. We probably have only 3 or 4 sub's
> that actually request data from the SPROCS on the server. If we start to
> see a problem with connection issues - we can experiment with that.
> That is one idea (timeout stuff). Since only a few subs actually hit the db,
> you *Could* have those subs call a com component that handles are your data
> access. Then the COM component could manage all the connection stuff for
> you. Since everyone goes through the COM object for DB Access, technically
> you would only need one login, and hence , connections would be pooled.
> (that is classic N-Tier bread - n - butter) food for thought....
> >
> > Whenever I go into CURRENT ACTIVITY it appears that the ACCESS clients are
> using 4 times more connections to there DB's than we are to our DB - but we
> aren't going to fully roll this out till next September.
> >
> Yeah, access as a front end sucks. It is well documented that Access eats up
> connections (I dont remember why. I saw an article explaining this in the
> past. I think it was written by Bob Beauchamin)
> > One last question - what have you read or what experience do you have with
> CONNECTION maximums in SQL?
> Not sure what you are asking here ....? SQL server can handle thousands of
> connections. however, each connection consumes resources on both the client
> and on the server (Socket connections, memory, etc)
>
> Enjoying the chat. Best Wishes
>
> GAJ
> >
> > "Jaxon" wrote:
> >
> > > see inline:
> > >
> > > > Every white paper I read is about WEB Access and ASP pages.
> > > There are many white papers on Data Access Strategies and best practices
> for
> > > N-Tier Applications. It is essentially the same for Web Apps. Web apps
> can
> > > be (and likely should be) designed as n-tier apps.
> > >
> > > >
> > > > This is not what we have here. We have a school district - on an
> internal
> > > network - many buildings - 1000+ teachers. Teachers get into attendance
> app
> > > for less than 30 minutes and post attendance for classes. Admin folks
> and
> > > secretaries get in for the whole day - call up kids, start maintenance -
> get
> > > phone calls - interruptions.
> > >
> > > That's fine. This still works for N-Tier Architecture
> > >
> > > >
> > > > What do you mean "share the connection". I meant "global connection"
> in
> > > VB - global to all the forms that the user might call up in the app - I
> > > didn't mean global to all users.
> > >
> > > if Each user keeps a Global Connection object in their App on the client
> > > side, you likely will run out of connections quickly and requests will
> start
> > > to queue up. This is not scalable as larger number of clients adds up.
> > >
> > > Connections are a precious resource that should be obtained late and
> > > released early so that connections dont become your system bottleneck.
> > >
> > > >
> > > > Each workstation runs the app and makes a connection - no sharing
> > > involved. We do all our server side work with SPROCS - so ADO calls the
> > > SPROC from VB - returns the recordset and then the connection stays open
> > > until the next ADO/SPROC call.
> > >
> > > This sounds like a class 2-tier or Client Server app to me then. likely
> too
> > > late to turn it into an N-Tier App...you may be stuck. However, I would
> > > still not keep global connections around.
> > >
> > > >
> > > > We use win-nt authentication - so taking advantage of SQL pooling of
> > > connections so a similiar one can be found doesn't really make sense to
> us.
> > >
> > > if each user logs in directly to sql server, you are rigth. You might
> want
> > > to rethink this and have your code access the DB using a handful of
> standard
> > > logins (ReadOnly, Read Write, REad Write Delete, Admin, Etc). Then you
> can
> > > take advantage of pooling and you can scale better
> > >
> > > >
> > > > I've found info that says that establishing the connection can be time
> > > consuming - so why relinquish it and re-establish it'
> > >
> > > You're right. You dont want to do this. You want to try to pool
> connections.
> > >
> > > >
> > > > Other programmers at this school district use ACCESS to touch there
> DB's.
> > > I see that ACCESS opens "several" connections for just one user at a
> time -
> > > this seems more of a waste of resources.
> > >
> > > Yes Access connectivity to a SQL Server DB can be downright crippling.
> > >
> > > hope all this info helps. Sounds like you are already married to an
> > > architecture that you wont be able to change. You may be stuck into
> doing
> > > what you are currently doing...
> > >
> > >
> > > Cheers
> > >
> > >
> > > GAJ
> > >
> > >
> > >
>
>|||> 2.5 millions rows in some tables - large scale stuff.
LOL! That's not very "large scale" in my experience.
No comments:
Post a Comment