WCF OperationContract的调整实例化与并发TSQL化与、实例、WCF、OperationContract

2023-09-02 02:05:25 作者:扬起微笑丶活得高傲

在WPF .NET 4.0应用程序 在目前托管在思杰 在MSSQL 2008 R2后端 在DB尺寸可达100 GB 在TSQL搜索将返回100个对象的时间和命中12表 在大多数搜索&LT; 1秒,几乎从不>10秒 在TSQL(SP)更新一次 阅读次数:写> 10000:1 在一个单一的数据库,可以有100个活跃用户,但从来没有超过10 活动连接。 在SQL框中只执行数据加载,然后当越过25% 根据50%的客人 WPF .NET 4.0 application Currently hosted in Citrix MSSQL 2008 R2 back end DB size up to 100 GB TSQL search will return 100 objects at a time and hits 12 tables Most searches < 1 second and almost never > 10 seconds TSQL (SP) updates are one at a time Reads:Write > 10000:1 A single database may have 100 active users but never more than 10 active connections. The SQL box only goes over 25% when performing a data load and then stays under 50%

通过WCF迁移到客户端服务器。我的第一个WCF。

Moving to client server via WCF. My first WCF.

由于没有Web客户端主机在内部服务?? 的思考 在以后将创建一个姊妹产品和主机在Azure上 思维,要求会议?? 如果我想错了,请让我知道

我在哪里输了就是为OperationContract的实例和并发性。

Where I am lost is is OperationContract Instancing and Concurrency.

有关的搜索实例化,我应该去PerSession?如果是的话,我应该保持SQL连接打开?

For search Instancing should I go PerSession? And if so should I hold the SQL connection open?

更新是从搜索方式不同。有6个不同的更新OperationContracts(对于不同的数据类型)。更新是一次一个,并经由PK和将达到源表和日志表。这可能更有意义作为单个实例和ConcurrencyMode多发,并保持连接?如果是这样,我管理并发?

Update is way different from search. There are 6 different update OperationContracts (for different data types). Update is one at a time and via the PK and will hit the source table and a log table. That may make more sense as a Single Instance and ConcurrencyMode Mutiple and hold the connection? If so I do I manage concurrency?

还有一个批量更新,但我愿意只把它作为一个系列单更新的现在。

There is also a bulk update but I am willing to just treat it as a series of single updates for now.

主要目标是数据的完整性,然后可用性,然后可扩展性。

Primary objective is data integrity, then availability, and then scalability.

据我所知,可能不会很难回答。任何指针或引用的材料?我应该如何进行压力测试?如何mangage和监督的过程?

I understand there may not be hard answers. Any pointers or reference material? How should I stress test? How to mangage and monitor the process?

有大量的数据来测试的,我会报告结果。

Have a lot of data to test against and I will report results.

推荐答案

找了个博客,直接解决了我的问题。

Found a blog that address my questions directly

WCF的实例化,并发和节流部分-1

WCF的实例化,并发和节流部分-2

WCF的实例化,并发和节流部分-3

PerCall 您可以考虑在这些情况下,这个实例化模式。

PerCall You may consider this instancing mode in these circumstances.

如果你的服务是无状态

If your service is stateless

如果您的服务具有重量轻初始化code(或没有)。

If your service has light-weight initialization code (or none at all).

如果你的服务是单线程的。

If your service is single threaded.

我的方法适合所有的这些标准。一旦信道被创建InstanceContextMode PerCall的开销不超过创建类的实例更。连接到SQL的开销也很小,因为它会举行一个连接池。我正在这太复杂了。

My methods fit all those criteria. Once the channel is created the overhead of InstanceContextMode PerCall is no more than creating an instance of a class. The overhead of connecting to SQL is also small as it will hold a connection pool. I was making it too complex.

如果有人有更多的补充,那么我会很乐意接受你的答案。

If someone has more to add then I would be happy to accept your answer.