ASP.NET Website no Response while Processing Long Process
When my Application face a long-time process, i.e fetch a query (SELECT a, b, c FROM d) This query needs 10 seconds to be completed in the MSSQL Management Studio, but when the ASP.NET application try to fetch 开发者_JS百科it, it refuse to return any response to any other requests made on that Server.
I am hosting my Application on VPS Server with good specifications, and I am giving this example the (SELECT a, b, c FROM d) just to tell you the issue, it can be any process, maybe processing a movie, or even fetching some data through external API that is experiencing some slow-down,or whatever.
Any help or suggestions would be highly appreciated.
When you make a call on a page, then this page is use one of the application pool to get the data. If this call is make 10 seconds to complete then this pool is stack on this request.
To avoid this stop, I can suggest some ways.
You can use more than one application pool. How ever in this case you going to face some other problems and for solve them you must use mutex in some parts of your program, because you going to face muthithread synchronize issues,
You can use threads to run paraller with the page, and make a thread process, and release the page, and then make some refress to get the results... or make any other thread tricks to release the pool from processing.
You can optimize your sql 10 seconds to run somthing is too much time. In my programs the only routing that take this time to compliete is some statistics calculations. I make them run on background, cache the results, and then just show the results when they request for.
Hope this help you.
i highly recommend that you familiarize yourself with Sql Profiler that comes with Sql Server Studio.
Launch it, and see what goes to/from your sql server and for how long.
do you get any exceptions back or just timeout?
can you step through the code?
is it a local server (your machine) or some other machine? (possible could be network connectivity issues)
精彩评论