On our ASP.Net website, we\'ve had some requests timeout. AppDynamics shows that the SQL procedure calls are returning in a matter of seconds, but we\'re spending 100+ seco
In my case it was indeed, as Jouni mentions, very slow transmitting of the query results. I use Automapper to prepare data for sending to client. So, it's unclear what exact property caused the load but to be sure I've cut all compound ones I don't need to show on client side. (I originally needed a collection to show in grid on client side.) The execution became very fast.
Not sure if you already have resolved this, but: SNI is SQL Server Network Interface, and the mentioned method exists in most ADO.NET full call stacks that wait for data from SQL Server. This is regardless of whether the higher-level implementation is EF, raw ADO.NET or whatever.
I'm not sure which metric or signal AppDynamics uses to capture the completion of a stored procedure execution, but you could be seeing this kind of behavior if your stored procedure completes relatively fast, but transmitting the query result from the server to your client takes a while.
Without knowing more about your infrastructure, it is very hard to help further. If the problem still persists, I would recommend running the same query in SQL Server Management studio with SET STATISTICS TIME ON and "Include Client Statistics" switched to on. Perhaps those numbers would give you an idea on whether data transfer is actually the problem.
I've came across similar issue - it turns out that SqlDataReader.Dispose can get stuck for very lengthy time if you break early from large select.
see: https://github.com/dotnet/corefx/issues/29181