I have a web app that queries a database.  When a certain function of the site is accessed, the user is experiencing 30-45 seconds of timeout before data is displayed from the database.  I have the WhoIsActive stored procedure on the DB.  When I execute the stored procedure while the website is timing out, I see the ASYNC_NETWORK_IO wait.

 If I take the exact query that is being executed, and run it directly on the DB server, the query executes in 1-2 seconds.  

The app and DB server is hosted at a 3rd party provider, but I brought the DB to a local dev box and am not seeing the see results.  The data is displaying on the website in 2-3 seconds as expected.

What can I check on either the app or db server as this appears to be network related?

Any help is greatly appreciated.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Marten RuneSQL Expert/Infrastructure ArchitectCommented:
This is usually where SQL Server is waiting for a client to finish consuming data. It could be that the client has asked for a very large amount of data or just that it’s consuming it reeeeeally slowly because of poor programming – I rarely see this being a network issue. Clients often process one row at a time – called RBAR or Row-By-Agonizing-Row – instead of caching the data on the client and acknowledging to SQL Server immediately."

from: http://www.sqlskills.com/blogs/paul/wait-statistics-or-please-tell-me-where-it-hurts/

is it a large result set, or is the client machine using it's CPU at a 100%. Then it's most likely on the client side of the application. Remember in a 3 tier application, the client = server asking Querys to SQL Server.

Regards Marten

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sciggsAuthor Commented:
The query is returning just under 8000 records, so it's not too terribly large in my opinion.  Watching CPU and RAM usage while the particular query is run, resources remain fairly low (under 40% utilization) and there are not many large spikes.
Marten RuneSQL Expert/Infrastructure ArchitectCommented:
Those 8000 records. are there by chance any nVarchar, Binary or nText columns returning?

Run a profiler, make sure it includes the showplan (i e excutionplan).
run the app. Now run the Query from SSMS and include actual executionplan.

Compare the two. Are they the same, then the Waits are outside of SQL.
Is memory configured correctly on the sql, so that it doesnt starve the OS.
Remember it's the package, OS + SQL that delivers to the clients.

Those 40% utilization, did you check per processor/core. i e 40% could be one CPU at 80% on a dual core, or on a quadcore, one CPU at 100% = 25% utilization.

Regards Marten
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Marten RuneSQL Expert/Infrastructure ArchitectCommented:
Got any updates, answers to my questions, or information regarding status, progress?

Regards Marten
Vitor MontalvãoMSSQL Senior EngineerCommented:
sciggs, do you still need help on this question?
One thing you can do is in the app change the connection property to timeout after, let's say, 1 min, 60 secs. The default value for a connection is 30. In this case could be that sometimes the network is overloaded with something, could be your result set or something else, which can delay the retrieval of the result set to go over 30secs.
Anthony PerkinsCommented:

I think you are confusing ConnectionTimeout with CommandTimeout.  Also, with ADO.NET the default ConnectionTimeout is 15 seconds, The default for CommandTimeout is 30 seconds.  CommandTimeout has to be set in code.
Correct, the command timeout for the connection setup in application. You can change the default for that to be at least 1 min and see if that solves the problem.
sciggsAuthor Commented:
We added additional RAM to the web application and that has resolved (or at least masked) the problem.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.