IN SQL Server 是 CLR 线程安全的 [英] IN SQL Server is CLR Threadsafe

查看:40
本文介绍了IN SQL Server 是 CLR 线程安全的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 SQL Server 和 Exchange Web 服务之间的 CLR 中有一个接口,用于在应用程序之间同步和发送电子邮件.在测试中,它可以正常工作(ed)没有任何问题;我们在生产环境中看到了一些零星的问题,其中较长的网络服务任务似乎重叠了.

I have an interface in CLR between SQL Server and the Exchange Web Services to Sync and send emails between applications. In testing this it works(ed) without any problems; we are seeing sporadic issues in the production environment where longer web service task appear to be have overlapped.

我的问题很简单,我无法通过阅读 MSDN 上的 CLR 详细信息来决定 - CLR 线程安全还是开箱即用.

My question is very simple and I cant decide from reading the CLR details on MSDN - is CLR Thread Safe or not out of the box.

如果不是,那么调用线程安全的 CLR 的最佳方法是在我的程序周围进行 applock,或者是否有不那么激烈的替代方法.

If not what is the best way of making calls to CLR that are thread safe is to applocking around my procedures or is there a less drastic alternative.

感谢您的回复;我们正在解决这是一个 EWS/Impersonation 问题而不是 SQL 问题.我们已经在几个小时内对系统进行了一组新的负载测试,即使在大量负载(比应用程序目前看到的高 1000 倍)下,我们也看不到内存泄漏/线程问题,这就是我们现在寻找其他地方的原因..

Thanks for your responses; we are coming around to this being an EWS / Impersonation issue rather than a SQL Issue. We have done a new set of load tests out of hours on the system and even under massive load (1000x higher than the application has seen so far) we can't see a memory leak / threading issue which is why we are now looking elsewhere..

推荐答案

如果您的 CLR 代码编写正确,现在已经对 CLR 进行了大量独立测试(故意试图使其失败) - 用初始化值很好地声明变量,看起来CLR 是线程安全的.

Having done much independant testing on CLR now (deliberately trying to make it fail) if your CLR code is written properly -nicely declare variables with initialisation values it appears that the CLR is thread safe.

这篇关于IN SQL Server 是 CLR 线程安全的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆