Timeout

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

My application sometimes conenct to database without any problems, sometimes
the next day I get frequently exception saying about timeout.

My connection string is:
Data Source=.\sqlexpress; Initial Catalog=MyMdfFile;Integrated
Security=True;Pooling=true;

1/
I think with this conenction string I am not using user instances. Am I right?

2/
what is doing MS VS or Sql Server Express when my application can not
connect, even before I could connect without any problems?

3/
I am running app in a debug mode from within MS VS 2005. Can I expect the
same problems in a releaase mode?

Thanks,

Lubomir
 
Ok, this is not a "connecting" issue as much as it is a coding or
performance issue. I suggest you take a look at my article on managing the
connection pool. http://www.betav.com/sql_server_magazine.htm

This is also discussed in Chapter 9 of my book.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
 
William (Bill) Vaughn said:
Ok, this is not a "connecting" issue as much as it is a coding or
performance issue. I suggest you take a look at my article on managing the
connection pool. http://www.betav.com/sql_server_magazine.htm

This is also discussed in Chapter 9 of my book.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)

I don't think it is a pooling rpoblem, as this problem occures mostly when I
want to connect to DB for the 1st time (when I start to work). Than, if
connection is successfull after several attempts, all works fine.

These problems are not every day... sometimes I can see a messge reporting
that remote debugger has to be shut down.
Lubomir
 
Interesting. Okay, let's assume that you walk into the system first thing in
the morning. At that point the SQL Server service is probably running but
none of the databases are spun up and most of the DLLs have probably been
pushed out because of other activity. In this case it might take some time
to get fired up. The default timeout is 15 seconds, which ordinarily should
be enough time but if you don't have enough RAM in the system to accommodate
both the SQL Server DLLs and all of the other data load then you could have
a startup problem. How much RAM do you have?

In this case I would make sure you have at least 512MB of RAM that can be
dedicated to SQL Server (which means a minimum of 1 GB on the system that
shares functionality with other applications). I would also set Connection
Timeout=60 keyword in the ConnectionString.

I have also updated the whitepaper and posted it to my blog. See
www.betav.com/blogs/billva

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
 
Thanks, for reply.
I have 3GB of Ram, running WinXP and SQL Express.

I set timeout in a connection string in the past but the result ws the same.
Once it helped when I set timeout for a command; the very first command that
modified the database. It was command for deleting records from the testinf
database - there were always just few records only.

So now I don't have this "timeout problem" so frequently, but time to time
it coccures. Why?

Thanks,
Lubomir
 
If you say that setting the Command timeout helps, then it's probably a
QUERY timeout problem--not one associated with a connection. So, this means
that the server is too busy doing something else (like swapping out a game,
running another application that's hogging the CPU or printing a photograph)
to get the query done in time. Consider that when the server is not actively
working, it releases its non-essential DLLs to the memory pool. Once it
starts a query again, these have to come back in memory from disk. When the
database increases in size the system takes more time. When you use the
AutoClose feature, the database engine and the database must restart when
first accessed again.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
 
It sounds like it could be the reason of my problems. I am wondering how it
will be in the the release version. When a customer start tu run the
application, can he face the timeout from this reason? I don't want to set up
timeout for every SqlCommand (I don't know which one the user will use as the
first after application start).

I think in the release version the start up could be faster as there are not
any debug information and and also all development tools like debugger is not
needed to start.

Thanks,
Lubomir
 
There is not a global CommandTimeout setting but, yes, I expect that in some
SQLExpress rigs you'll need to be more cognizant of application
contention--especially on low-resource systems that have to share CPU and
RAM with other applications, games, adware, spyware, email and the OS. Also
make sure that you consider NOT closing connections at each opportunity.
This leaves the database open and in place--not subject to the additional
overhead of restarting it...

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
 
Back
Top