- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试评估在新系统中使用哪种通信技术,现在看起来 Remoting 是我们唯一的选择,因为 WCF 的性能很糟糕。
与调用控制台应用程序中托管的远程处理接口(interface)相比,我已经对使用 nettcp 调用托管在 IIS7 中的 WCF 服务进行了基准测试。 WCF 服务大约需要 4.5 秒来执行 1000 个请求,同步地在一个端点上(它只是返回一个对象的新实例)。远程客户端执行相同任务的时间小于 0.5 秒。
这是 WCF 客户端代码:
public class TcpNewsService : INewsService
{
private INewsService _service = null;
Lazy<ChannelFactory<INewsService>> _newsFactory = new Lazy<ChannelFactory<INewsService>>(() =>
{
var tcpBinding = new NetTcpBinding
{
//MaxBufferPoolSize = int.MaxValue,
//MaxBufferSize = int.MaxValue,
//MaxConnections = int.MaxValue,
//MaxReceivedMessageSize = int.MaxValue,
PortSharingEnabled=false,
TransactionFlow = false,
ListenBacklog = int.MaxValue,
Security = new NetTcpSecurity
{
Mode = SecurityMode.None,
Transport = new TcpTransportSecurity
{
ProtectionLevel = System.Net.Security.ProtectionLevel.None,
ClientCredentialType = TcpClientCredentialType.None
},
Message = new MessageSecurityOverTcp
{
ClientCredentialType = MessageCredentialType.None }
},
ReliableSession = new OptionalReliableSession { Enabled = false }
};
EndpointAddress endpointAddress = new EndpointAddress("net.tcp://localhost:8089/NewsService.svc");
return new ChannelFactory<INewsService>(tcpBinding, endpointAddress);
});
public TcpNewsService()
{
_service = _newsFactory.Value.CreateChannel();
((ICommunicationObject)_service).Open();
}
public List<NewsItem> GetNews()
{
return _service.GetNews();
}
}
var client = new TcpNewsService();
Console.WriteLine("Getting all news");
var sw = new System.Diagnostics.Stopwatch();
sw.Start();
for (int i = 0; i < 1000; i++)
{
var news = client.GetNews();
}
sw.Stop();
Console.WriteLine("Finished in " + sw.Elapsed.TotalSeconds);
Console.ReadLine();
<system.serviceModel>
<services>
<service behaviorConfiguration="NewsServiceBehavior" name="RiaSpike.News.Service.NewsService">
<endpoint address=""
binding="netTcpBinding"
bindingConfiguration="tcpBinding"
contract="RiaSpike.News.Types.INewsService">
</endpoint>
<endpoint address="http://localhost:8094/NewsService.svc"
binding="basicHttpBinding"
bindingConfiguration="httpBinding"
contract="RiaSpike.News.Types.INewsService">
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="NewsServiceBehavior">
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="httpBinding">
<security mode="None">
<transport clientCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
<netTcpBinding>
<binding name="tcpBinding" portSharingEnabled="false">
<security mode="None">
<transport clientCredentialType="None" />
<message clientCredentialType="None" />
</security>
<reliableSession enabled="false" />
</binding>
</netTcpBinding>
</bindings>
[ServiceBehavior(
ConcurrencyMode = ConcurrencyMode.Multiple,
InstanceContextMode = InstanceContextMode.Single,
AddressFilterMode = AddressFilterMode.Any
)]
public class NewsService : MarshalByRefObject, INewsService
{
public List<NewsItem> GetNews()
{
return new List<NewsItem>
{
new NewsItem { Descripion = "The Description", Id = 1, Title = "The Title"}
};
}
}
var iserver = (INewsService)Activator.GetObject(typeof(INewsService), "tcp://127.0.0.1:9000/news");
var sw = new System.Diagnostics.Stopwatch();
sw.Start();
for (int i = 0; i < 1000; i++)
{
var news = iserver.GetNews();
}
sw.Stop();
Console.WriteLine("Finished in " + sw.Elapsed.TotalSeconds);
Console.ReadLine();
public class Global : System.Web.HttpApplication
{
private TcpServerChannel _quote;
protected void Application_Start(object sender, EventArgs e)
{
_quote = new TcpServerChannel(9000);
if (ChannelServices.RegisteredChannels.Length ==0)
{
ChannelServices.RegisterChannel(_quote, false);
}
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(NewsService),
"news",
WellKnownObjectMode.SingleCall);
_quote.StartListening(null);
}
}
最佳答案
这仅测试顺序、同步、调用。 IIS 托管的 WCF 服务提供了更多的基础架构来处理更高的负载,并且可能会在高负载测试(具有大量并发连接的测试)中胜过远程处理。
远程端点也可以托管在 IIS 中,但可以获得相同的优势。 WCF 也可以托管在控制台中。你真的在这里比较苹果和橘子。
关于.net - 与 Remoting 相比,为什么 WCF 性能如此缓慢?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4371661/
有什么区别 git ls-remote --heads origin 和 git ls-remote . "refs/remotes/*" ? --heads origin 版本需要一段时间才能运行,
当我执行 git remote -v 时,我得到了 origin git@xxx.yyy.cc:name fetch) origin git@xxx.yyy.cc:name (push) 为什么
要构建我的远程环境,我需要设置几个环境变量(它们在 docker-compose 文件中使用)。这些是在我的 ZSH 环境中设置的,因此从终端运行 docker-compose build 可以按预期
我有一个创建多个 Docker 镜像的项目。我想在 vscode-remote 中为每个图像设置一个 devcontainer,以便我可以为每个图像启动一个容器。 我一次只需要启动并连接到一个容器/图
我设置了以下 Remote : $ git remote korg rorg 以及以下分支: $ git branch -a * (no branch) remotes/korg/gingerbr
这是我得到的错误。我有一个简单的 .Net Remoting 设置。连接空闲几分钟后出现此错误。 对象“/7966b546_734e_410d_817a_a0e701f114f6/lfxehvbczn
我有两个远程 git 分支(称它们为“RemoteA”和“RemoteB”)。 “RemoteB”在过去的某个时候从“RemoteA”中分离出来。在那之后,许多提交已应用于两个分支,但我现在希望“Re
我知道使用下面的 git 命令我可以列出我所有的“远程”分支... [someone@someone-pc somerepo]$ git ls-remote Username for 'https:/
我最需要的是一些建议。 我有以下示例: 应用程序1.exe - 有对象 MyList 应用程序2.exe - 需要访问 MyList 并与对象交互,就好像它是从 Application2 创建的一样。
我有一个大型应用程序,它通过 .net 远程处理使用 COM 从 Web 层调用到中间层。在此模式下启动和运行非常慢。 COM 边界的两边都是我们的代码。 我希望能够(可选)在单个进程中运行它。相当多
假设我有两个 Remote :origin 和 upstream。有没有一种方法可以将对象 upstream 推送到 origin,以便其他从 origin 克隆我的 repo 的人能够运行像 git
简而言之; 如何删除远程多个 merge 的 Remote ? 更多背景; 我有一个 git 存储库,其中包含数十个已 merge 到 master 中的 Remote 。我可以使用以下方法一次删除这
我有一个仓库的本地 git clone。我当然可以使用 git remote 查看我的本地远程 origin。但是,我可以看到我的 Remote origin 的 Remote 吗?我可以查看有关这些
先决条件 - 远程服务器和客户端均已设置,客户端能够通过客户端激活的业务对象在服务器端调用方法并从服务器端接收事件。 在保持服务器和客户端运行的情况下更改远程服务器的IP地址,客户端仍然可以执行上述任
我正在设置一个新的远程主机,每次启动它时,我都会收到以下错误输出:有关如何解决此问题的任何反馈或指示? Pseudo-terminal will not be allocated because st
我只是不明白 Git 的帮助页面。那么会发生什么或有什么区别? 假设我有一个带有子模块 B 的 Git 项目 A。子模块 B 确实有一个子模块 C。克隆存储库后,A 指向 B 的特定提交。B 指向 C
我在 Java 中使用 rmi。但是有一个 ExportException“远程对象实现非法远程接口(interface)”。 这是我的代码,有人可以帮帮我吗? public interface Re
我对 git 越来越熟悉了,但是我遇到了一些让我困惑的事情。我们在这里使用本地镜像,因为我们的线路很慢。为了指向镜子,我在 .gitconfig 中有一些常用的东西。 当我想推送时,问题就来了。看来我
我设置了一个带有 conan“远程”存储库的 jfrog artifactory 来代理官方 conan-center 存储库。我看到三个不同的 conan-center URL,具体取决于我阅读的来
我无法使用 VSCode 远程 SSH 在我的远程服务器上保存任何文件,因为我不是 root 用户。 我关注了 official documentation关于如何使用 SSH 配置文件设置 ssh
我是一名优秀的程序员,十分优秀!