Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
977 views
in Technique[技术] by (71.8m points)

.net - WCF OperationContract Tuning Instancing and Concurrency with TSQL

  • 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%

Moving to client server via WCF. My first WCF.

  • Since no web client thinking of hosting as a service in house ??
  • Later will create a sister product and host on Azure
  • Thinking to require sessions ??
  • If I am thinking wrong please let me know

Where I am lost is is OperationContract Instancing and Concurrency.

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

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.

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Found a blog that address my questions directly

wcf-instancing-concurrency-and-throttling-part-1

wcf-instancing-concurrency-and-throttling-part-2

wcf-instancing-concurrency-and-throttling-part-3

PerCall You may consider this instancing mode in these circumstances.

  • If your service is stateless

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

  • If your service is single threaded.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...