How to Improve WCF Data Services Performance

前端 未结 8 561
有刺的猬
有刺的猬 2020-12-24 08:34

I\'m new to WCF Data Services so I\'ve been playing. After some initial tests I am disappointed by the performance of my test data service.

I realize that because a

相关标签:
8条回答
  • 2020-12-24 09:03

    How do you pass those 25 iterations for WCF?

    var WCFobj = new ...Service();
    foreach(var calling in CallList)
       WCFobj.Call(...)
    

    If you call like that it means you call WCF 25 times, which consumes too many resources.

    For me, I used to build up everything into a DataTable and user table name to stored procedure I'm calling; DataRow is params. When calling, just pass the DataTable in encrypted form by using

    var table = new DataTable("PROC_CALLING")...
    ...
    StringBuilder sb = new StringBuilder();
    var xml = System.Xml.XmlWriter.Create(sb);
    table.WriteXml(xml);
    var bytes = System.Text.Encoding.UTF8.GetBytes(sb.ToString());
    [optional]use GZip to bytes
    WCFobj.Call(bytes);
    

    The thing is you pass all 25 calls at once, that can save performance significantly. If the return object is same structure, just pass it as DataTable in bytes form and convert it back to DataTable.

    I used to implement this methods with GZip for import/export data modules. Passing large amount of bytes is going make WCF unhappy. Its depends whatever you want to consume; computing resources or networking resources.

    0 讨论(0)
  • 2020-12-24 09:06

    Consider deploying as a windows service instead? IIS may have ASAPI filters, rewrite rules, etc that it runs through. even if none of these are active, the IIS pipeline is so long, something may slow you down marginally.

    a service should give you a good baseline of how long it takes the request to run, be packed, etc, without the IIS slowdowns

    0 讨论(0)
提交回复
热议问题