简体   繁体   English

从ASP.NET站点到LINQ to SQL存储过程的性能突然下降,包括超时

[英]Sudden degradation in LINQ to SQL stored procedure performance from ASP.NET site, including timeouts

The site is ASP.NET 2.0, using LINQ to SQL. 该站点是使用LINQ to SQL的ASP.NET 2.0。 Database is SQL Server 2008 R2. 数据库是SQL Server 2008 R2。

Been working on an issue where performance suddenly took a huge drop one day and has remained that way since. 一直致力于解决一个问题,即有一天性能突然下降了很多,此后一直保持这种状态。 Cannot figure out why. 不知道为什么。 It has been just certain functionality of the site, not necessarily a site-wide problem. 这只是站点的某些功能,不一定是站点范围的问题。 Have focused on a particular stored procedure in general that is taking a good 1000ms+ showing in profiler. 总的来说,重点是要在分析器中显示一个好1000ms +的特定存储过程。 When copying the TextData and running right in the query analyzer, it runs much quicker. 复制TextData并在查询分析器中直接运行时,它运行起来要快得多。

Have tried a sp_recompile on the stored procedure as well as the table used. 在存储过程以及所使用的表上尝试了sp_recompile。 The db server was restarted during a maintenance period and that also did not stabilize things. 数据库服务器在维护期间已重新启动,这也无法使事情稳定下来。 Is there any possible troubleshooting steps anyone could provide to help dig deeper on this? 任何人都可以提供任何可能的故障排除步骤来帮助您更深入地了解这一点吗? Absolutely stumped. 绝对难过。

It could be a parameter sniffing problem. 这可能是参数嗅探问题。 You can see the details here - http://blogs.msdn.com/b/turgays/archive/2013/09/10/parameter-sniffing-problem-and-workarounds . 您可以在此处查看详细信息-http: //blogs.msdn.com/b/turgays/archive/2013/09/10/parameter-sniffing-problem-and-workarounds As suggested in the blog, you can try the following - 按照博客中的建议,您可以尝试以下操作-

OPTION (OPTIMIZE FOR (@VARIABLE=VALUE)) 选项(为(@ VARIABLE = VALUE)优化)

OPTION (OPTIMIZE FOR (@VARIABLE UNKNOWN)) 选项(优化(@VARIABLE UNKNOWN))

Use local variables - Basically declare local variables and assign the value of the parameter to local variable and use the local variable in the query. 使用局部变量-基本上声明局部变量,并将参数的值分配给局部变量,并在查询中使用局部变量。

OPTION (RECOMPILE) - Since you have already tried that you can ignore this 选项(重新编译)-由于您已经尝试过,因此可以忽略此选项

Could you post the query snippet which is causing this issue? 您能否发布导致此问题的查询代码段?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM