最适合低延迟网络应用程序的语言/库?
我正在计划一个需要快速(尽可能快)TCP 服务器访问的项目。我一直在用 Netty 测试 Java,用 BOOST 测试 C++。该项目需要多线程(如果这影响任何建议)。
在我的测试中(不彻底,但足以提供洞察力),似乎 Java 服务器的响应速度远不如用 C 或 C++ 编写的服务器那么快。这是真的还是我的实现/设置很可能是错误的?
我在 Objective C 方面也有一些经验,如果它是合理的,并且生成的应用程序足够快,那么用 Objective C 编写服务器会很棒,因为它是我最有经验的语言。
我知道有人很可能会回应说 C 可能是速度的最佳选择,但是使用 OOP 语言进行网络有任何显着的开销吗?看来网络速度将是主要瓶颈。
感谢任何愿意向感兴趣的程序员提供一些建议的人:)
I'm planning a project that requires fast (as quick as possible) TCP server access. I've been testing out Java with Netty and C++ with BOOST. The project requires multithreading (if that affects any suggestions).
In my tests (not thorough, but enough to provide an insight) it would appear as though Java servers aren't anywhere near as quick to respond as those written in C or C++. Is this true or is my implementation/setup most likely wrong?
I've also got some experience in Objective C and if it were plausible, and the resulting application was fast enough, writing a server in Objective C would be great as it's the language I've got most experience with.
I know that someone will most likely respond saying that C is probably the best option for speed, but is there any significant overhead using an OOP language for networking? It seems as though the network speed would be the main bottleneck.
Thanks to anyone who is willing to impart some advice to an intrigued programmer :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对您来说,最重要的事情是关注如何设计服务器。说它将是多线程的并没有告诉我们任何事情。请记住,多线程远非万能药,在特定情况下多线程甚至可能有害。
之后,您对服务器应该如何工作有一个清晰的了解 - 查看有哪些语言(甚至框架)可以让您以合理的效率/复杂性比实现您想要的东西。
大多数人确实会告诉您,C++(或 C)是您任务的首选语言,因为没有任何限制,并且您可以直接访问操作系统为您提供的所有功能,但仍然有很多其他成熟的语言/框架选择正确的工具取决于您到底想要做什么的细节
The first important thing for you is to focus on how you design your server. Saying that it will be
multithreaded
doesn't tell us anything. Keep in mind thatmultithreading
is far from being the panacea, in particular situations multithreading can be even harmful.After that you have a clear understanding of how your server should work - see what languages (or even frameworks) are there that allow you to implement what you want with reasonable efficiency/complexity ratio.
Most people would indeed tell you that C++ (or C) is the language of choice for your task as there are no limitations and you have direct access to all the functionality OS gives you, but still - there are plenty of other mature languages/frameworks and picking the right tool depends on details of what exactly you want to do