473,699 Members | 2,263 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1463
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*******@disc ussions.microso ft.com> wrote in message
news:58******** *************** ***********@mic rosoft.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*******@disc ussions.microso ft.com> wrote in message
news:58******** *************** ***********@mic rosoft.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
7692
by: Jonas Knaus | last post by:
hello until now i allways wrote all my sql-stuff in my presentation-layer. i heard about that model of that presentation- / businesslogic- and data access layer -model. i found some example on the internet, but not very useful. does anyone has some examples for this ??? i would by very happy !!!
4
2764
by: Mark | last post by:
OK. Here we go. I have an ASP.NET application that does many hits to a SQL Server DB on a separate server. When I first created this application (2 years ago) and was very new to ASP/ASP.NET, to make the SQL connection string global throughout the application I created a .vb file within the application project and declared a public SQLConnection: Public ors_wnf As SqlConnection = New...
2
6819
by: Steve Foo | last post by:
I have been posting this question in google group, EE, and Oracle OTN forum and still no cannot find a suitable solution for it. I have contacted Singapore Microsoft support regarding the problem .Unfortunately they are not able to help me and eventually direct me here i'm not 100% sure if this problem is due to ODP.net provider or asp.net IIS setting Hopefully Microsoft Experts here can help me up. Thx Introduction...
2
2327
by: Vinod | last post by:
All, .NET Web Service needs to talk to third party software through TCP/IP sockets. Do we have any .Net Framework in place which can do a TCP/IP
9
5724
by: Not Me | last post by:
Hi, I'm using asp.net 2 with an sql server 2000 database. What steps if any, must I take to ensure connection pooling efficiently? for any 'manual' connections made, I open the sqlconnection obtaining the connection string from configurationmanager.connectionstrings, and close the connection as soon as it's been finished with. I haven't run any tests yet but just wondered if there's something I
9
2031
by: Tomasz | last post by:
Hello everybody, i'm writing an application, which should be connected all the time to the database. So i want to test it in few ways if reconnection works in order. First thing i tried to do is killing my apps process from MS SQL (2005 Express). Problem is that after i have still "Open" status for SqlConnection.Status. That means, that "Status" property is not enough to test :( I would like to not to test the connection everytime with...
16
2866
by: crbd98 | last post by:
Hello All, Some time ago, I implemented a data access layer that included a simple connectin pool. At the time, I did it all by myself: I created N connections, each connection associated with a worker thread that would execute the db commands. The pool was fixed and all the connections were created when the db access class was instantiated. The connections remained opened during the whole execution. If a connection was not available...
0
6605
viswarajan
by: viswarajan | last post by:
Introduction This article is to go in deep in dome key features in the ADO.NET 2 which was shipped with VS 2005. In this article I will go trough one of the key features which is the Connection Pooling. This feature is a key feature plays an important role in the performance in most of business application or Data driven application. What's Connection Pooling?
2
1457
by: Tom | last post by:
I try to do the following: Generate a pooled connection in a web application. I use the following code: In my Global.asax.cs protected void Application_Start(object sender, EventArgs e) { //Creating a global pooled connection object ConnectionStringSettings DBconn =
0
8628
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9199
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9054
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8899
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7785
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5884
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3075
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2362
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.