mssql_connect fails under heavy load

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
snicolas
Forum Commoner
Posts: 97
Joined: Tue Nov 09, 2004 8:32 am

mssql_connect fails under heavy load

Post by snicolas »

I have a strange behaviour happening since Friday.

I use mssql_connect to connect to my db on every page.
My code looks like this:
<?php
@session_start();
include("checkconnection.php"); //just checking if connection is there
include("settings.php");//include settings conenction
$sql = new mod_db();
?>
Here i do my select etc..
<?include("closeconnection.php");//close conenction?>

My connection connect to the remote machine properly and to my DB most of the time, but sometimes (since Friday), i get a connection error message looking like that:

Warning:mssql_connect_db():Unable to connect to database "MyDB".

I cannot understand why iut started doing this as no major changes have been made to the code.

Spomebody got an idea?

s
snicolas
Forum Commoner
Posts: 97
Joined: Tue Nov 09, 2004 8:32 am

Post by snicolas »

Anybody has an answer?
How to check the different connection to the mssql server?

thanx

S
rehfeld
Forum Regular
Posts: 741
Joined: Mon Oct 18, 2004 8:14 pm

Post by rehfeld »

if your sure you havent changed anything, id ask your host
snicolas
Forum Commoner
Posts: 97
Joined: Tue Nov 09, 2004 8:32 am

Post by snicolas »

trouble, is that i am my own host!
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

check the network infrastructure.
snicolas
Forum Commoner
Posts: 97
Joined: Tue Nov 09, 2004 8:32 am

Post by snicolas »

What do you mean network infrastructure??
I checked the SQL process, and there is no overload.
snicolas
Forum Commoner
Posts: 97
Joined: Tue Nov 09, 2004 8:32 am

Post by snicolas »

What is the big difference between:
mssql_connect or mssql_pconnect

I understand mssql_pconnect creates a persistent connection and will not open a new one if one is already opne.
Which one to use to make the application as stable as possible?

s
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

If you are your own host - you'll need to delve into your mysql config. There are a few tutorials around on how to optimise mysql to get the most connections/stability under heavy usage. Google is your first stop...:)

In my experience - leave out persistent connections. Most mention of them states they help with heavy use - but if your maximum connections are low... Disaster...:)
Post Reply