TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

More than one million requests per second in Node.js

255 点作者 _e3th超过 8 年前

17 条评论

erichocean超过 8 年前
Happy µWS &quot;customer&quot; here. I&#x27;ve been using the C++ library standalone in production since October (i.e. without Node.js).<p>Crazy fast, ultra-low memory usage, and was easy to integrate into our codebase. Author is hilarious and deeply cares about performance.<p>Easily the best C++ WebSocket library. I&#x27;m not at all surprised Alex has managed to get some additional performance out of HTTP on Node.js as well.
评论 #13567737 未加载
评论 #13568324 未加载
halayli超过 8 年前
often times webserver benchmarks are misleading because of how the tests were done.<p>nginx is a fully fledged webserver with logging enabled out of the box, and other bells and whistles. By just having logs enabled for example you&#x27;re adding significant load on the server because of log formatting, writes to disk, etc.<p>At the very least include the configs of each server tested.
评论 #13566263 未加载
TheAceOfHearts超过 8 年前
Although it mirrors what the other parent comments are making, I wish there was more information readily available (or maybe it is, and I&#x27;m just not aware of where to look for it?) information about what real-world performance is like in different cases.<p>For example, in my job, since none of the frontend APIs need to handle that many requests at once, we&#x27;re considering setting up a few node &quot;frontend APIs&quot; to lift application complexities from our JS single page app up one level. Stuff like having to hit multiple inconsistent APIs, dealing with formatting issues, etc. If you have a single API it seems much easier to deal with that, as well as expand it as time goes on. But due to lack of knowledge and experience, I don&#x27;t have as much confidence with pushing this decision as I&#x27;d like. We&#x27;ll obviously end up investing time and effort in performing benchmarks to make sure it meets our requirements first, but as since we&#x27;re a startup that&#x27;s not so large, we can&#x27;t realistically afford to dump THAT much time into something that doesn&#x27;t end up getting us some clear benefits.<p>A bit related to the topic... I know it&#x27;s not exciting and sexy, but I wish more people wrote about larger non-trivial applications and how they end up tackling the challenges they encountered and details of the kinds of scales they handled. Both with respect to architecture and scaling. Maybe it&#x27;s my lack of experience, but I find it really difficult to guess at how much money certain things will end up costing before doing a &quot;close-to-real-world implementation&quot;.
评论 #13566359 未加载
评论 #13566374 未加载
评论 #13566371 未加载
评论 #13567187 未加载
jterry超过 8 年前
This looks interesting. I&#x27;m surprised there aren&#x27;t many existing native HTTP modules for NodeJS. Found websockets&#x2F;was as an alternative <a href="https:&#x2F;&#x2F;github.com&#x2F;websockets&#x2F;ws" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;websockets&#x2F;ws</a><p>It would be a fun experiment to implement a native HTTP module in Rust using Neon. <a href="https:&#x2F;&#x2F;github.com&#x2F;neon-bindings&#x2F;neon" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;neon-bindings&#x2F;neon</a>
c8g超过 8 年前
&gt;HTTP pipelining (made famous by Japronto)<p>&gt;Japronto&#x27;s own (ridiculous) pipeline script<p>are you trolling? :)
评论 #13566379 未加载
xorcist超过 8 年前
Really? 5x faster than plain nginx? That&#x27;s .. remarkable, if true. I can&#x27;t seem to find the sources for that benchmark however.
评论 #13567981 未加载
评论 #13566849 未加载
PunchTornado超过 8 年前
This kind of benchmark is completely useless.<p>You tune the heck out of node.js and then take another tool without tuning it (JVM, apache, nginx etc), give it a ridiculous task that you&#x27;ll never find in real world and present your results as if they are meaningful.<p>Why do people still waste time doing it?
评论 #13566794 未加载
评论 #13566766 未加载
评论 #13566774 未加载
评论 #13567268 未加载
评论 #13567488 未加载
评论 #13566744 未加载
ttt111222333超过 8 年前
&gt; As http sockets in µWS build on the same networking stack as its websockets, you can easily scale to millions of long polling connections, just like you can with the websockets. This is simply not possible with the built-in Node.js http networking stack as its connections are very heavyweight in comparison.<p>I&#x27;m a bit confused by what&#x27;s going on here. Are you saying the network stack required to do websockets is vastly superior to the network stack of http, and hence using a websockets network stack in http calls can produce superior results? (I didn&#x27;t know the underlying networking would be different and any clarity would be helpful).<p>I&#x27;m not really understanding the differences but it is definitely interesting nonetheless.
评论 #13566556 未加载
socmag超过 8 年前
Fantastic work Alex. I sent you email earlier when I saw this.<p>It really is stunning, and yes microbenchmarks are very important to me and my product. I personally really do want to know how much every piece costs so I can budget memory cycles and machines. So thanks for providing the data. Even if it is slightly &quot;ballpark&quot;.<p>We use it in our server as well (and have done for ages), and uWS just plain rocks.<p>Highly recommended
rafaelferreira超过 8 年前
I&#x27;d love to see a design document explaining the differences from, say, nginx, that enable this kind of performance results.
albertTJames超过 8 年前
Thanks for this amazing work ! Can&#x27;t wait to use it.<p>As a community we have to work on addons and make node the true versatile and performant language it should be :)<p><a href="https:&#x2F;&#x2F;nodejs.org&#x2F;api&#x2F;addons.html" rel="nofollow">https:&#x2F;&#x2F;nodejs.org&#x2F;api&#x2F;addons.html</a>
评论 #13566407 未加载
bhouston超过 8 年前
This is pretty great stuff. Please keep it up and don&#x27;t pay attention to the naysayers. This type of optimization is great and will pay dividends down the road for a lot of projects if this can take off.
yunda超过 8 年前
What if standard http module to be replace with this in express? Is it going to work?
diegorbaquero超过 8 年前
uWS certainly reduces the overhead to a minimum, saving lots of memory that can be used to scale up and saving CPU left to your app&#x27;s code. I wrote this article a few months ago when I switched to uws in the WebTorrent tracker. <a href="https:&#x2F;&#x2F;hackernoon.com&#x2F;%C2%B5ws-as-your-next-websocket-library-d34209686357?source=linkShare-a1d0f3f9aca2-1486218881" rel="nofollow">https:&#x2F;&#x2F;hackernoon.com&#x2F;%C2%B5ws-as-your-next-websocket-libra...</a>
评论 #13567754 未加载
bfrog超过 8 年前
I&#x27;m more interested in the techempower style benchmarks, at least those show some sort of semblance of real life usage. Do some queries, return encoded json etc.
qaq超过 8 年前
I think the key benefit is actually significantly reduced memory footprint.
评论 #13567075 未加载
notzorbo3超过 8 年前
It&#x27;s important to note that with all these &quot;X requests per second&quot; benchmarks, they&#x27;re almost never testing actual performance, but rather just less features. The architecture (event loop, forking, threading or any combination of those) also matters a lot, but they serve <i>completely</i> different purposes.<p>For example, they&#x27;re using Apache as a reference point, but Apache does <i>so</i> much more than their code example. For one thing, you&#x27;ll want to try disabling .htaccess support and static file serving so Apache doesn&#x27;t actually hit the disk, like their code example doesn&#x27;t.<p>I&#x27;ve found it trivial to make Python perform on the order of dozens of millions of requests per second, and I can keep scaling that basically indefinitely. But all I&#x27;m really testing, as is the given code example in the article, is a bit of looping and string manipulation.
评论 #13566242 未加载
评论 #13566241 未加载
评论 #13566762 未加载