从LINQ到SQL的糟糕SQL性能

时间:2021-03-09 23:07:47

I have a WPF at a customer site that makes calls to a remote SQL 2005 server using Linq To Sql.

我在一个客户站点上有一个WPF,它使用Linq to SQL调用远程SQL 2005服务器。

Almost everyday the customer experiences aweful slow downs, and I am not sure what to do.

几乎每天顾客都会经历令人敬畏的慢下来,我不知道该怎么做。

The quick fix is to restart the mssql service and that seems to do the job, but that is not a solution.

快速修复是重新启动mssql服务,这似乎可以完成这项工作,但这不是解决方案。

Tonight I used the SQL profiler and tuning wizard, but got no suggestions :(

今晚我使用了SQL分析器和调优向导,但是没有得到任何建议:

I'm really lost.

我真的失去了。

Any ideas?

什么好主意吗?

Thanks! Jon

谢谢!乔恩

1 个解决方案

#1


1  

Sounds like you're draining your connection pool. How many users has your appliaction? Make sure you dispose of all DbConnection as soon as you're done with them, don't open them for too long.

听起来你在耗尽你的连接池。你的应用程序有多少用户?确保在处理完所有DbConnection之后立即处理它们,不要太长时间地打开它们。

Normally Linq2Sql Datatacontext will take care of that for you (open/close), except you pass in an already open connection. However you must make sure to dispose the datacontext too, so it can in turn dispose of the connection.

通常Linq2Sql Datatacontext会为您处理这个问题(打开/关闭),除非您传入一个已经打开的连接。但是,您必须确保也要处理datacontext,以便它可以反过来处理连接。

link on ConnectionPooling

链接ConnectionPooling

#1


1  

Sounds like you're draining your connection pool. How many users has your appliaction? Make sure you dispose of all DbConnection as soon as you're done with them, don't open them for too long.

听起来你在耗尽你的连接池。你的应用程序有多少用户?确保在处理完所有DbConnection之后立即处理它们,不要太长时间地打开它们。

Normally Linq2Sql Datatacontext will take care of that for you (open/close), except you pass in an already open connection. However you must make sure to dispose the datacontext too, so it can in turn dispose of the connection.

通常Linq2Sql Datatacontext会为您处理这个问题(打开/关闭),除非您传入一个已经打开的连接。但是,您必须确保也要处理datacontext,以便它可以反过来处理连接。

link on ConnectionPooling

链接ConnectionPooling