471,350 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

Connection pooling for internet apps?

I wanted to post this on the SQL newsgroup, but I get a 'page not found' when
trying to go to that newsgroup. Since it is a C# app, I'll try it here.

I have a C# web application (.NET 1.1). I multi-thread requests to 10
different tables (full text indexed tables) on the same database. These are
done concurrently, not consecutively. In order to get this to work, I have
to open 10 connections to the database. According to the documentation,
pooling is on by default. I get some sporadic errors that make me think that
connection pooling may not be working correctly, or perhaps there is a bug in
connection pooling. For example, I occasionally get an error indicating that
the specified connection is in use. I get a stack dump when this happens,
but it happens in seemingly random locations in my code. I can never
recreate the problem, because when I try to recreate it, it works fine. I
just can't figure out why the code works 99% of the time, but 1% of the time
it will tell me the connection is in use. Other times I get an error saying
that a specified column does not exist in the collection (on sql readers
specifically), even though I know it does. Again, when trying to recreate
the error, it works perfectly. It would appear to be some type of corruption
in the connection, that is the only thing that really makes sense.
Dec 28 '05 #1
5 1352
KJ
I too have experienced the seemingly random "connection is in use"
error, and was unable to solve it, except to serialize the database
calls (which is not necessarily a bad idea on a single-processor
machine). Of course, you can turn connection pooling off in the
connection string if need be (Pooling=false) to see if there is a
difference. Another thing to investigate is whether all the objects
used to connect and execute commands are disposed properly.

Hope this helps.

Dec 28 '05 #2

"Brian Kitt" <Br*******@discussions.microsoft.com> wrote in message
news:58**********************************@microsof t.com...
I wanted to post this on the SQL newsgroup, but I get a 'page not found'
when
trying to go to that newsgroup. Since it is a C# app, I'll try it here.

I have a C# web application (.NET 1.1). I multi-thread requests to 10
different tables (full text indexed tables) on the same database. These
are
done concurrently, not consecutively. In order to get this to work, I
have
to open 10 connections to the database. According to the documentation,
pooling is on by default. I get some sporadic errors that make me think
that
connection pooling may not be working correctly, or perhaps there is a bug
in
connection pooling. For example, I occasionally get an error indicating
that
the specified connection is in use. I get a stack dump when this happens,
but it happens in seemingly random locations in my code. I can never
recreate the problem, because when I try to recreate it, it works fine. I
just can't figure out why the code works 99% of the time, but 1% of the
time
it will tell me the connection is in use. Other times I get an error
saying
that a specified column does not exist in the collection (on sql readers
specifically), even though I know it does. Again, when trying to recreate
the error, it works perfectly. It would appear to be some type of
corruption
in the connection, that is the only thing that really makes sense.


Where does the SQL server run on? Same machine as client? What OS?
How many concurent connections are there allowed for SQL?

Willy.
Dec 28 '05 #3
I've tried both configurations. Originally they were on 2 seperate servers
on the same network segment, same physicial location, just connected through
a switch. I've since moved them to the same machine hoping to eliminate the
problem, but the frequency and seemingly randomness of the problem has not
changed. I am running on Windows Server 2003 Enterprise, SQL Server 2000
SP4. The original configuration had 1 Gig of Ram on each machine. The
current configuration (where they are on the same machine) has 2 Gig of Ram.
This database is not what I would call extremely busy, but that is obviously
relative. We have had 90,000 visitors to our website in 6 months. That's
about 15,000 per month, or 500 per day. To me, that's low to medium usage.

The application DOES beat the heck out of the database. Depending on
options, it starts up to 15 threads all running multi-threaded. About 8 to
10 of the threads will open independent connections to the database. All
connections are opened sequentially at the start of the process, and when all
threads complete, all connections are closed, then disposed.

The method I use for managing my connections is to have a class called
'global'. This class is instantiated at the start of my web request, at
which point all connections are opened. The connection variables are all
defined at the class level as private variables, NOT static variables. This
should keep each web request completely independent of each other, not? I
mean, is it possible that 2 users at the same time could somehow walk over
each other? If the connections were static, then I would think that is a
possibility, but they are not static.

"Willy Denoyette [MVP]" wrote:

"Brian Kitt" <Br*******@discussions.microsoft.com> wrote in message
news:58**********************************@microsof t.com...
I wanted to post this on the SQL newsgroup, but I get a 'page not found'
when
trying to go to that newsgroup. Since it is a C# app, I'll try it here.

I have a C# web application (.NET 1.1). I multi-thread requests to 10
different tables (full text indexed tables) on the same database. These
are
done concurrently, not consecutively. In order to get this to work, I
have
to open 10 connections to the database. According to the documentation,
pooling is on by default. I get some sporadic errors that make me think
that
connection pooling may not be working correctly, or perhaps there is a bug
in
connection pooling. For example, I occasionally get an error indicating
that
the specified connection is in use. I get a stack dump when this happens,
but it happens in seemingly random locations in my code. I can never
recreate the problem, because when I try to recreate it, it works fine. I
just can't figure out why the code works 99% of the time, but 1% of the
time
it will tell me the connection is in use. Other times I get an error
saying
that a specified column does not exist in the collection (on sql readers
specifically), even though I know it does. Again, when trying to recreate
the error, it works perfectly. It would appear to be some type of
corruption
in the connection, that is the only thing that really makes sense.


Where does the SQL server run on? Same machine as client? What OS?
How many concurent connections are there allowed for SQL?

Willy.

Dec 29 '05 #4
KJ
When are the connection objects disposed?

Jan 4 '06 #5
I dispose of all objects in the Page_Unload method.

"KJ" wrote:
When are the connection objects disposed?

Jan 6 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Jonas Knaus | last post: by
9 posts views Thread by Not Me | last post: by
16 posts views Thread by crbd98 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.