的HttpListener VS本地HTTP性能 [英] HTTPListener vs Native HTTP performance

查看:1238
本文介绍了的HttpListener VS本地HTTP性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

快速背景:据我所知,的HttpListener使用HTTP.SYS的内核驱动程序,理应使得一个伟大的表演者。但是,这样做有管理的HTTP服务器和本地VC之间的一些性能指标评测时,++服务器我看到在机端约15 MB / s的增加。测试设置是两名实验机新格式化了1GB网卡。在本机端我看到大约110 MB / s的时候使用的HttpListener我看到〜94 MB /秒(最大100),接近网卡减去开销,100%。

Quick Background: I understand that HTTPListener uses http.sys kernel driver which supposedly makes it a great performer. However, when doing some performance benchmarks between a managed http server and a native vc++ server I am seeing approx 15 MB/s increase on the native side. Test setup is two lab machines freshly formatted with 1gb nics. On the native side I am seeing about 110 MB/s which is close to 100% of the nic minus overhead, when using HTTPListener I am seeing ~94 MB/s (max 100).

测试是苹果,苹果,

  • 同时发送相同的有效载荷(〜120 MB)
  • 在我使用的是相同的托管客户端应用程序来测试服务器
  • 有关管理我已禁用内格尔(但经测试两种方式,结果是一样的)
  • 在我运行一个批处理的测试和计算吞吐量,有趣的注意的是,管理的标准偏差较高,即结果并不如一致相比,原生。

总的来说,我想到的是我应该可以用的HttpListener得到接近110 MB的本地服务器的/秒,15 MB / s的似乎是pretty的成本很高。

Overall I expect that I should be able to get close to the 110 MB/s of the native server via HTTPListener, 15 MB/s seems pretty costly.

问题: 1.是否有其他优化的管理,我很想念? 2.什么是一些潜在的瓶颈,我看着HTT presponseStream通过反射,看起来像有一些封送处理事情,但没有明显的问题,事实上,当使用分块它会产生一个相同的块阵列作为我的本地服务器。

Questions: 1. Are there other optimizations for managed that I am missing? 2. What are some potential bottlenecks, I looked at the HTTPResponseStream via reflector, looks like there is some marshaling going on, but no glaring issues, In fact when using chunking it produces an identical chunk array as my native server.

任何想法是AP preciated,

Any ideas are appreciated,

推荐答案

它使用的Http.sys并不意味着没有一个原生到管理过渡的事实。从上述的MSDN文章:

The fact that it uses Http.sys doesn't mean that there isn't a native-to-managed transition. From the above-mentioned MSDN article:

HTTP.sys中提供了连接管理,带宽限制,以及Web服务器日志记录。

HTTP.sys provides connection management, bandwidth throttling, and Web server logging.

凭借正在运行管理code中的事实,你有互操作(原产于管理的,不能与COM互操作混淆),你有垃圾回收等,它永远不会是一样快一个纯粹的原生C ++实现。

By virtue of the fact that you are running managed code, you have interop (native to managed, not to be confused with COM interop), you have garbage collection, etc. It's never going to be as fast as a pure native c++ implementation.

编辑:为了更清楚,你还在运行的.NET的过程中,你只是挂钩到IIS在内核模式下,而不是在用户模式。在这个伟大的文章是在这里: HTTP://www.west- wind.com/$p$psentations/howaspnetworks/howaspnetworks.asp

To make this clearer, you are still running a .NET process, you are just hooking into IIS in kernel mode, not in user mode. A great article on this is here: http://www.west-wind.com/presentations/howaspnetworks/howaspnetworks.asp

这篇关于的HttpListener VS本地HTTP性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆