TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Optimizing Nginx, Node.js and networking for heavy workloads

146 pointsby gnwover 12 years ago

6 comments

aromanover 12 years ago
Good read, but despite being a major proponent of Node.js and many of the ideals it seeks to embrace, I'm not sure I'm comfortable with calling Apache "archaic". It's not like IE6, which has objectively no redeeming value as a modern platform target -- it did back in the day for sure, and is still relevant in some spheres, but overall I don't think anyone (even Microsoft) would argue that IE6 is "archaic".<p>But to call Apache, one of the most popular and successful <i>actively developed</i> webservers _archaic_? I think that's a bit much. It's not inherently <i>bad</i> just because it's not really targeting the C10K problem... just different.<p>[A minor nitpick to be sure, but it bothered me nonetheless as I feel like I'm seeing this "Threads bad. Async good." rhetoric passed around as fact all over the place and it's starting to feel a bit like Animal Farm ;)]
评论 #5092249 未加载
评论 #5093075 未加载
评论 #5093484 未加载
No1over 12 years ago
For the tl;dr people:<p>On the nginx side, author discusses tweaking sysctl.conf, cutting down the number of sockets stuck in TIME_WAIT, some other tweaks for performance resulting in a 90% reduction in occupied sockets. On the node.js side, author uses the cluster module to fully utilize available CPU cores, arriving at N-1 for the magic number of node processes to spawn, where N is the # of CPU cores.<p>Definitely suggested reading for anyone running Nginx + Node.js
silentehover 12 years ago
enabling<p>net.ipv4.tcp_tw_reuse<p>net.ipv4.tcp_tw_recycle<p>can create unexpected problems with NAT, so use it with caution.
评论 #5092023 未加载
评论 #5091981 未加载
r4vikover 12 years ago
have you tried making nodejs listen on a unix socket <a href="http://nodejs.org/docs/v0.5.4/api/net.html#socket.connect" rel="nofollow">http://nodejs.org/docs/v0.5.4/api/net.html#socket.connect</a> and then set your proxy upstreams in nginx to use that?<p>edit:<p>scratch that, it seems you're using node on cluster of servers (not on same box as nginx). In which case the article is good advice.
zeropover 12 years ago
should nginx be only used for serving static files. Does it have any advantage when used to serve plain data API. I want to expose REST api (django + uwsgi) over web, but not sure if should use nginx for it.
评论 #5093118 未加载
评论 #5093076 未加载
评论 #5094212 未加载
评论 #5094401 未加载
nigglerover 12 years ago
Does this setup work with web sockets?
评论 #5091889 未加载
评论 #5093192 未加载