Long-running Stored Procedure stalls whole site

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
4/3/2013 5:22:13 PM
Gravatar
Total Posts 27

Long-running Stored Procedure stalls whole site

I made a long-running stored procedure (2-5 minutes) which is called from a custom module. Whenever the module is refreshed no other page will respond until the long-running SP is done, as if the page refreshes were sequential.

Is this expected behavior?

I'm using MojoPortal 2.3.9.4 with SQL Server 2008 R2.

4/3/2013 5:38:55 PM
Gravatar
Total Posts 18439

Re: Long-running Stored Procedure stalls whole site

I don't really like the way you ask this question, your custom code is hanging your site and you think it is caused by mojoPortal?

mojoPortal code is not hanging your site. Start with the assumption that your own code is at fault instead.

A long running process should not be run in the context of a web request. Consider launching it on a background thread so it does not block the web ui thread. Consider whether your code or procedure is consuming too much processor or memory while it runs possibly starving the web app of resources.

4/3/2013 6:17:53 PM
Gravatar
Total Posts 27

Re: Long-running Stored Procedure stalls whole site

My apologies if it looked as if I was saying MojoPortal was buggy and my custom module was flawless. What hangs the site is my module indeed, mainly because I didn't even know that there was a WebUI thread and it could be blocked.

My long running SP is a set of remote conections where some of them are expected to timeout. It's lightweight but lengthy because each failed connection adds 30 seconds to the execution.

I'll have to redesign this and actually read about the WebUI thread.

4/3/2013 6:51:32 PM
Gravatar
Total Posts 18439

Re: Long-running Stored Procedure stalls whole site

There is not just one thread, web apps are multi threaded. I only meant running a long task in a web request blocks the current thread that i serving the current web request, there is a pool of threads available to a web app, but a single bad performing thread can still bring an app to its knees.

Without knowing more about what your code is actually doing I cannot offer suggestions other than look at the processor and memory utilization on the web server and database server while it runs, consider whether it is locking or blocking any resources or opening lots of db connections etc

You must sign in to post in the forums. This thread is closed to new posts.