简体   繁体   English

对WCF服务和内部客户端的性能问题

[英]Performance concern on WCF service and internal clients

In a large scale modular web application based on Asp.Net Mvc , I have implemented a WCF self-hosting mechanism to provide communication every modules with each other. 在基于Asp.Net Mvc大规模模块化Web应用程序中,我实现了WCF自托管机制,以提供每个模块之间的通信。 This was a good practice for me, because by this mechanism the modules have became independent and there is not any direct references. 这对我来说是一个好习惯,因为通过这种机制,模块已变得独立,并且没有任何直接引用。 and the next advantage is external applications or the clients if my customers have been able to access these services through WCF service. 如果我的客户能够通过WCF服务访问这些服务,则下一个优势是外部应用程序或客户端。

The mechanism is the searching and injecting the services from module by the IoC features and hosting them with BasicHttpBinding binding type. 机制是通过IoC功能从模块中搜索和注入服务,并使用BasicHttpBinding绑定类型托管它们。

Also the Endpoints of the serivces are configured in a particular URL plus service name (for example the consider the MyService : http://localhost:8080/Services/MyService ) 还在特定的URL和服务名称中配置了服务的端点(例如,考虑MyServicehttp://localhost:8080/Services/MyService

想象场景

My concern is performance of communication of the modules inside the app process, which they are the same machine, same process in IIS and differs to the external clients. 我关心的是应用程序进程内部模块的通信性能 ,这些模块是同一台计算机,在IIS同一进程,并且与外部客户端不同。

Is there any distinction between external clients and internal ones in communication layers, OR NOT they are be treated by the same behavior? 外部客户端和内部客户端在通信层之间是否有任何区别,还是以相同的行为对待它们?

If NO , Which features are need to increase the internal clients performance? 如果为 ,则需要哪些功能来提高内部客户端的性能?

When you're talking about external clients, you must keep your services must compatible as you can, so you can use http binding, so clients from different plataforms can consume your services. 在谈论外部客户端时,必须使服务必须尽可能兼容,以便可以使用http绑定,以便来自不同平台的客户端可以使用您的服务。

But when you'retalking about internal clients, all using .Net, you can handle different. 但是,当您谈论所有使用.Net的内部客户端时,您可以处理不同的事情。 You can use tcp binding to improve your performance, since all clients are internal. 由于所有客户端都是内部客户端,因此可以使用tcp绑定来提高性能。

There is a sensible performance difference between a http and tcp clients, you see a benchmark here: http://media.techtarget.com/TheServerSideNET/downloads/DotNet-WebSphere_Web_Services_Benchmark.pdf http和tcp客户端之间存在明显的性能差异,您可以在此处查看基准: http : //media.techtarget.com/TheServerSideNET/downloads/DotNet-WebSphere_Web_Services_Benchmark.pdf

So, you can improve your performance doing your service accepting both http and tcp bindings, and setting your internal clients to consume your service over a tcp binding. 因此,通过接受HTTP和TCP绑定的服务,以及将内部客户端设置为通过TCP绑定使用服务,可以提高性能。

Here is also a good link talking about tcp and http bindings: TCP Vs. 这也是谈论tcp和http绑定的好链接: TCPVs。 Http Benchmark Http基准

Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM