开发者

WCF Data Services: Call to SaveChanges() causes 100% CPU

开发者 https://www.devze.com 2023-01-01 09:54 出处:网络
I am developing a WCF Data Service over an Entity Framework 4.0 data model, but there\'s no way we can go to Production under the current circumstances.

I am developing a WCF Data Service over an Entity Framework 4.0 data model, but there's no way we can go to Production under the current circumstances.

My client application is adding and modifying a lot of objects, around 100,000. Then it calls the service's SaveChanges method to persist all changes in a single action. The WCF Data Service is hosted in an NServiceBus host process, although I don't know if that contributes to the issue.

This works, but it takes more than an hour on a 1-CPU, 4GB RAM, Win2008 x64 virtual machine. More importantly, CPU utilization goes up to 100%. RAM consumption fluctuates between 75% and 85%. T开发者_开发百科his is in a development environment virtual machine, so the SQL Server 2005 database the service is covering is local. The WCF Data Service's host process eats up around 1.2 GB during this process.

Any ideas?? Many thanks in advance!


Do you really need to modify all objects within one transaction? If no, then I would propose to hold the data context open as shortly as possible.

  • Open data context
  • update the object
  • save changes
  • close data context
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号