性能IIS VS C#套接字应用程序 [英] Performance IIS VS C# socket application

查看:338
本文介绍了性能IIS VS C#套接字应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C#中编写了一个非常基本的小型套接字服务器,并将性能与IIS进行了比较。无论C#实现如何,IIS的速度似乎要快2倍。

I wrote a small very basic socket server in C# and compared performance to IIS. IIS seems to be around 2 times faster no matter the C# implementation.

IIS如何如此之快以及如何使我的C#代码具有竞争力(如果有的话)?

How is IIS so fast and how can I make my C# code competitive (if at all)?

推荐答案

由于我们无法访问IIS代码,因此我们无法回答这个问题。多年来,IIS已经过优化,可以重用连接,优化调用,使用与操作系统的低级连接等。您无法在C#中编写一个简单的socket
应用程序跟上它。至少没有大量的工作,可能不仅仅是一个人的帮助。

This isn't really a question we can answer as we don't have access to the IIS code. IIS has been optimized over the years to reuse connections, optimize calls, use low level connections to the OS, etc. You aren't going to be able to write a simple socket app in C# that is going to be able to keep up with it. At least not without a lot of work and probably more than just a single person helping.

如果你需要一个HTTP服务器,那么使用IIS(用于.NET框架)或者可能是Kestrel(用于.NET Core)。除了学术目的之外,编写自己的作品并不能很好地利用你的时间。

If you need an HTTP server then use the IIS (for .NET framework) or perhaps Kestrel (for .NET Core). Writing your own, other than for academic purposes, isn't a good use of your time.


这篇关于性能IIS VS C#套接字应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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