KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to port a simple async TCP server in F# to C# 4. The server receives a connection, reads a single request and streams back a sequence of responses before closing the connection. Async in C# 4 looks tedious and error prone so I thought I'd try using WCF instead. This server is not unlikely to see 1,000 simultaneous requests in the wild so I think both throughput and latency are of interest. I've written a minimal duplex WCF web service and console client in C#. Although I'm using WCF instead of raw sockets, this is already 175 lines of code compared to 80 lines for the original. But I'm more concerned about the performance and scalability: Latency is 154× worse with WCF. Throughput is 54× worse with WCF. TCP handles 1,000 simultaneous connections easily but WCF chokes on just 20. Firstly, I'm using the default settings for everything so I'm wondering if there is anything I can tweak to improve these performance figures? Secondly, I'm wondering if anyone is using WCF for this kind of thing or if it is the wrong tool for the job? Here's my WCF server in C#: IService1.cs [DataContract] public class Stock { [DataMember] public DateTime FirstDealDate { get; set; } [DataMember] public DateTime LastDealDate { get; set; } [DataMember] public DateTime StartDate { get; set; } [DataMember] public DateTime EndDate { get; set; } [DataMember] public decimal Open { get; set; } [DataMember] public decimal High { get; set; } [DataMember] public decimal Low { get; set; } [DataMember] public decimal Close { get; set; } [DataMember] public decimal VolumeWeightedPrice { get; set; } [DataMember] public decimal TotalQuantity { get; set; } } [ServiceContract(CallbackContract = typeof(IPutStock))] public interface IStock { [OperationContract] void GetStocks(); } public interface IPutStock { [OperationContra
Tags (comma-separated)
Save Edits
Cancel