Solved

Timeout waiting for SQL Connection

Posted on 2010-08-12
8
358 Views
Last Modified: 2013-11-11
While using LINQ DataContexts I'm scoping each different type of context created to a web request. Imagine on creation of data context place in the web request and reuse for any other client that wants a data context of that type.

 I have encountered the issue during penetration testing where I am running out of connections. What might be the issue?

Do you think that because the DataContext is scoped to the web request and lives for the duration of the web request after its created that I may be exceeding the connection pool limit?

DaTribe
0
Comment
Question by:Richard Lee
  • 4
  • 3
8 Comments
 
LVL 12

Expert Comment

by:NormanMaina
ID: 33421819
are you using the same connection string in all your connections?
0
 
LVL 62

Expert Comment

by:Fernando Soto
ID: 33421966
Hi DaTribe;

Well the DataContext only opens a connection to the DB when it needs to query the DB for information and then immediately closes the connection which is the default behavior. If you are manually opening the connection for the DataContext and do not close it manually the connection will remain open. If you have only lets say 100 connection in the pool and have request for more then that anything over 100 concurrent connection will have to wait for the first free connection. So in answer to your question, Yes, it is possible.

Fernando
0
 
LVL 18

Author Comment

by:Richard Lee
ID: 33426893
That's what I thought Fernando but I've found a few recommendation for this pattern across the web.

http://code.msdn.microsoft.com/multitierlinqtosql
http://www.west-wind.com/weblog/posts/246222.aspx

Any chance there is something we are missing?

DaTribe
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 62

Expert Comment

by:Fernando Soto
ID: 33429236
Hi DaTribe;

There is always the chance that someone has overlooked something working in this business. The thing is to look for the reason for why the connection is timing out. For example how many concurrent request are being made to the server and how many connections are allowed in the connection pool. Is the timeouts being caused by network congestion. As for the two links posted I have look them over and could not find what it was stating anything about timeouts. What is the exact error message that is returned when this happens?

Fernando
0
 
LVL 18

Author Comment

by:Richard Lee
ID: 33429320
The scenario is that I cannot recreate the scenario. The issue popped during penetration testing by a third party company. The condition didn't occur under normal usage of the system and this was a side effect of the penetration testing. I thought I would get some expert opinion on the pattern I posted in the links above to see if that might be a problem.

DaTribe
0
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 33429484
Well it is hard to diagnose an issue that cannot be reproduced. I do not know how to tell you how to proceed in resolving the issue. You may need to work with the 3rd party trying to pin down where it is happening if they can reproduce it.

Fernando
0
 
LVL 18

Author Closing Comment

by:Richard Lee
ID: 33430386
I think I will have to work with the 3rd party
0
 
LVL 62

Expert Comment

by:Fernando Soto
ID: 33430523
Yes, I think that is the best way to go. Good luck & Thanks.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question