Posts Tagged ‘connection pooling’

SQL Server: Understanding and Controlling Connection-Pooling Fragmentation

By Mohammed Mawla October 7th, 2008 at 4:08 pm
Posted in SQL Server
Tags:

I got the idea for this article when one of our clients complained that their server’s performance was degrading during business hours. They thought it was weird that at the same time, SQL Server would list more than 1200 connections on SQL server Activity Monitor.

The server hosts more than 50 databases that serve an ASP.NET application hosted on some servers in a web farm. These servers issue connections to the databases in a distributed manner to balance the web application load. I tried to discover what these connections were doing and to what databases they were connected. Connections grouped by database:

select  db_name(dbid) , count(*) 'connections count'
from master..sysprocesses
where spid > 50 and spid  @@spid
group by  db_name(dbid)
order by count(*) desc

This showed some databases having more than 300 connections associated with them.

What about logins used?

select  loginame , nt_username, count(*) 'Connections count'
from master..sysprocesses
where spid > 50 and spid  @@spid
group by  loginame , nt_username
order by count(*) desc

This showed a mix of windows domain accounts (those with values in column nt_username, e.g: domain\user) beside SQL authentication accounts (those with column nt_username empty, e.g: “sa”).

In order to reduce the number of times that new connections must be opened, applications may use connection pooling. This was clearly not the case here, and all these connections resulted in what is known as “pool fragmentation”.

So what’s connection pooling? how does it work, what can cause pool fragmentation and how can we avoid/reduce it?

(more…)

Review: Building High-Performance Drivers for Oracle Database 11g (White paper)

By John Scoles July 16th, 2008 at 2:52 pm
Posted in DBD::OracleOracle
Tags:

Building High-Performance Drivers for Oracle Database 11g: OCI Tips and Tricks (PDF). I had the opportunity to have an early look at this white paper by Luxi Chidamdaram.

The paper goes over what needs to be done to use OCI effectively, especially in a web environment. The step-by-step approach taken in this document is very readable and the well explained code snippets make it a very good reference — great for comparing your code to the “proper” way to do it.

The novice OCI programmer will find the initial sections of great benefit, as it takes a lot of mystery out of OCI programming. For the more advanced OCI-head, the document is full of good examples of how to manage connections, sessions, and pooling–with an examination of what type of pooling is needed in a given situation.

One highlight for me was the section on database events, which are covered very effectively with some practical examples.

In short, this white paper is a must-read for both the OCI master and the novice, with some great pointers on how to use what is already in OCI and what is new in 11.