Locking App

  • First, let me say up front, that 1) I am not a DBA. I am just the application developer and 2) I know this is an open ended question.

    Having said that, my app on my customers server will lock up, become non-responsive etc. . . when usage starts to increase.

    Where or what can I start looking at to see what is causing this? I am guessing there is some sort of contention going on or possibly dead locks or . . .

    I'm pretty sure that it is a straight "out of the box" install. So there could be a number of settings that can be tweaked.

    The guy who is on site and is suppose to be the DBA just says it is my app, therefore my problem.

    Any suggestions welcome.

    __________________________________________________________________________________________________________
    How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • LinksUp (12/30/2013)


    First, let me say up front, that 1) I am not a DBA. I am just the application developer and 2) I know this is an open ended question.

    Having said that, my app on my customers server will lock up, become non-responsive etc. . . when usage starts to increase.

    This, usually, is a memory leak at the code level of some kind, or at least used to be before garbage collectors got more robust.

    Where or what can I start looking at to see what is causing this? I am guessing there is some sort of contention going on or possibly dead locks or . . .

    I'm pretty sure that it is a straight "out of the box" install. So there could be a number of settings that can be tweaked.

    The guy who is on site and is suppose to be the DBA just says it is my app, therefore my problem.

    That's usually the case, actually. If you're an SA on the box, though, you can look for a few things. First, regarding deadlocks, you want to look in the server logs. If you're not SA or equivalent you won't have access.

    However, deadlocks, on their own, shouldn't lock out the system unless the app's error controls are very weak. A deadlocked query will report that it was killed and should be resubmitted. If you're logging your db call errors from the app side, you should see them there.

    During the lockup, you want to try to look at sys.sysprocesses and see if there's any long running queries. If there is, you have some ammo for discussion with your DBA. Again, you'll need SA rights. If there is, you want to look for either blocking chains or a query that's just taking a long time with no blocking. If you find a query running long with no blocking I recommend you starting up a trace to locate the problem child (RPC and ad-hoc queries, get the starting and ending so you can check durations) and health check those procs for optimization. If there's blocking you've probably got a lot of edits going on simultaneously and those need to be optimized and tightened in scope.

    If you don't see this telltale sign, I hate to be the bearer of bad news, but it's most likely either app or network. If the server is responsive, there are no long queries, no blocking chains, and no pressure (I/O, Memory, CPU) then the DB server is healthy.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • Thanks for the suggestions. I will be looking at this and a number of other suggestions I have found while researching this!

    __________________________________________________________________________________________________________
    How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • I just thought I would share what I have found so far.

    The main issue is that the app seems to be locked up. It is not. Something in SQL was blocking the app from continuing.

    Running exec sp_who2 shows which spid's are being blocked and who is doing it.

    This nifty little bit of code shows the last sql statement execute by a spid.

    --From SQLServerPlanet.com

    SELECT er.session_id, SQLStatement =

    SUBSTRING

    (

    qt.text,

    er.statement_start_offset/2,

    (case when er.statement_end_offset = -1

    then len(convert(nvarchar(max), qt.text)) * 2

    else er.statement_end_offset

    end - er.statement_start_offset) / 2

    )

    FROM sys.dm_exec_requests er

    CROSS APPLY sys.dm_exec_sql_text(er.sql_handle) as qt

    WHERE er.session_id = 78

    With that information, it pointed me to a sp that was using WITH ROWLOCK on the SELECT & UPDATE statements.

    Removing the hint seem to have taken care of the issue.

    The SP in question returns the next available sequence number for receipt numbers and such. If 2 workstations are entering payments, I need to investigate how to make sure that each user gets the true next available number.

    __________________________________________________________________________________________________________
    How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply