@ -0,0 +1,125 @@ |
|||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
||||
|
<html xmlns="http://www.w3.org/1999/xhtml"> |
||||
|
<head> |
||||
|
<style type="text/css"> |
||||
|
ul { |
||||
|
padding: 0; |
||||
|
margin: 0; |
||||
|
} |
||||
|
</style> |
||||
|
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js?ver=3.1.3'></script> |
||||
|
<script type="text/javascript" src="../sh_main.js"></script> |
||||
|
<script type="text/javascript" src="../sh_javascript.min.js"></script> |
||||
|
<link type="image/x-icon" rel="icon" href="../favicon.ico" /> |
||||
|
<link type="image/x-icon" rel="shortcut icon" href="../favicon.ico" /> |
||||
|
<link type="text/css" rel="stylesheet" href="../pipe.css" /> |
||||
|
<link type="text/css" rel="stylesheet" href="../sh_vim-dark.css" /> |
||||
|
<link rel="alternate" |
||||
|
type="application/rss+xml" |
||||
|
title="node blog" |
||||
|
href="http://feeds.feedburner.com/nodejs/123123123"/> |
||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> |
||||
|
<title>node.js</title> |
||||
|
</head> |
||||
|
<body> |
||||
|
<div id="intro"> |
||||
|
<img id="logo" src="../logo.png" alt="node.js"/> |
||||
|
</div> |
||||
|
<div id="content" class="clearfix"> |
||||
|
<div id="column1" class="interior"> |
||||
|
<h2>About</h2> |
||||
|
|
||||
|
<pre> |
||||
|
var http = require('http'); |
||||
|
http.createServer(function (req, res) { |
||||
|
res.writeHead(200, {'Content-Type': 'text/plain'}); |
||||
|
res.end('Hello World\n'); |
||||
|
}).listen(1337, "127.0.0.1"); |
||||
|
console.log('Server running at http://127.0.0.1:1337/');</pre> |
||||
|
|
||||
|
<p>Node's goal is to provide an easy way to build scalable |
||||
|
network programs. In the "hello world" web server example |
||||
|
above, many client connections can be handled concurrently. |
||||
|
Node tells the operating system (through <code>epoll</code>, |
||||
|
<code>kqueue</code>, <code>/dev/poll</code>, or |
||||
|
<code>select</code>) that it should be notified when a new |
||||
|
connection is made, and then it goes to sleep. If someone new |
||||
|
connects, then it executes the callback. Each connection is |
||||
|
only a small heap allocation.</p> |
||||
|
|
||||
|
<p>This is in contrast to today's more common concurrency |
||||
|
model where OS threads are employed. Thread-based networking |
||||
|
is relatively inefficient and very difficult to use. See: <a |
||||
|
href="http://www.kegel.com/c10k.html">this</a> and <a |
||||
|
href="http://bulk.fefe.de/scalable-networking.pdf">this</a>. |
||||
|
Node will show much better memory efficiency under high-loads |
||||
|
than systems which allocate 2mb thread stacks for each |
||||
|
connection. Furthermore, users of Node are free from worries |
||||
|
of dead-locking the process—there are no locks. Almost no |
||||
|
function in Node directly performs I/O, so the process never |
||||
|
blocks. Because nothing blocks, less-than-expert programmers |
||||
|
are able to develop fast systems.</p> |
||||
|
|
||||
|
<p>Node is similar in design to and influenced by systems like |
||||
|
Ruby's <a href="http://rubyeventmachine.com/">Event |
||||
|
Machine</a> or Python's <a |
||||
|
href="http://twistedmatrix.com/">Twisted</a>. Node takes the |
||||
|
event model a bit further—it presents the event loop as a |
||||
|
language construct instead of as a library. In other systems |
||||
|
there is always a blocking call to start the event-loop. |
||||
|
Typically one defines behavior through callbacks at the |
||||
|
beginning of a script and at the end starts a server through a |
||||
|
blocking call like <code>EventMachine::run()</code>. In Node |
||||
|
there is no such start-the-event-loop call. Node simply enters |
||||
|
the event loop after executing the input script. Node exits |
||||
|
the event loop when there are no more callbacks to perform. |
||||
|
This behavior is like browser javascript—the event loop is |
||||
|
hidden from the user.</p> |
||||
|
|
||||
|
<p>HTTP is a first class protocol in Node. Node's HTTP library |
||||
|
has grown out of the author's experiences developing and |
||||
|
working with web servers. For example, streaming data through |
||||
|
most web frameworks is impossible. Node attempts to correct |
||||
|
these problems in its HTTP <a |
||||
|
href="https://github.com/joyent/http-parser/tree/master">parser</a> |
||||
|
and API. Coupled with Node's purely evented infrastructure, it |
||||
|
makes a good foundation for web libraries or frameworks.</p> |
||||
|
|
||||
|
<p>But what about multiple-processor concurrency? Aren't |
||||
|
threads necessary to scale programs to multi-core computers? |
||||
|
You can start new processes via <code><a |
||||
|
href="http://nodejs.org/docs/latest/api/child_processes.html#child_process.fork">child_process.fork()</a></code> |
||||
|
these other processes will be scheduled in parallel. For load |
||||
|
balancing incoming connections across multiple processes use |
||||
|
<a href="http://nodejs.org/docs/latest/api/cluster.html">the |
||||
|
cluster module</a>.</p> |
||||
|
|
||||
|
<p>See also:</p> |
||||
|
<ul> |
||||
|
<li><a href="http://s3.amazonaws.com/four.livejournal/20091117/jsconf.pdf">Slides from JSConf 2009</a></li> |
||||
|
<li><a href="http://nodejs.org/jsconf2010.pdf">Slides from JSConf 2010</a></li> |
||||
|
<li><a href="http://www.yuiblog.com/blog/2010/05/20/video-dahl/">Video from a talk at Yahoo in May 2010</a></li> |
||||
|
</ul> |
||||
|
<p><a href="/">Go back to the home page</a></p> |
||||
|
</div> |
||||
|
<div id="column2" class="interior"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div id="footer"> |
||||
|
<p>Copyright <a href="http://joyent.com">Joyent, Inc</a>, Node.js |
||||
|
is a <a href="trademark-policy.pdf">trademark of Joyent, Inc</a>. |
||||
|
</div> |
||||
|
|
||||
|
<script type="text/javascript"> |
||||
|
var gaJsHost = (("https:" == document.location.protocol) ? |
||||
|
"https://ssl." : "http://www."); |
||||
|
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); |
||||
|
</script> |
||||
|
<script type="text/javascript"> |
||||
|
try { |
||||
|
var pageTracker = _gat._getTracker("UA-10874194-2"); |
||||
|
pageTracker._trackPageview(); |
||||
|
} catch(err) {}</script> |
||||
|
<script type="text/javascript">highlight(undefined, undefined, 'pre');</script> |
||||
|
</body> |
||||
|
</html> |
After Width: | Height: | Size: 1.2 KiB |
@ -0,0 +1,153 @@ |
|||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
||||
|
<html xmlns="http://www.w3.org/1999/xhtml"> |
||||
|
<head> |
||||
|
<style type="text/css"> |
||||
|
ul { |
||||
|
padding: 0; |
||||
|
margin: 0; |
||||
|
} |
||||
|
</style> |
||||
|
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js?ver=3.1.3'></script> |
||||
|
<script type="text/javascript" src="../sh_main.js"></script> |
||||
|
<script type="text/javascript" src="../sh_javascript.min.js"></script> |
||||
|
<link type="image/x-icon" rel="icon" href="../favicon.ico" /> |
||||
|
<link type="image/x-icon" rel="shortcut icon" href="../favicon.ico" /> |
||||
|
<link type="text/css" rel="stylesheet" href="../pipe.css" /> |
||||
|
<link type="text/css" rel="stylesheet" href="../sh_vim-dark.css" /> |
||||
|
<link rel="alternate" |
||||
|
type="application/rss+xml" |
||||
|
title="node blog" |
||||
|
href="http://feeds.feedburner.com/nodejs/123123123"/> |
||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> |
||||
|
<title>node.js</title> |
||||
|
</head> |
||||
|
<body> |
||||
|
<div id="intro"> |
||||
|
<img id="logo" src="../logo.png" alt="node.js"/> |
||||
|
</div> |
||||
|
<div id="content" class="clearfix"> |
||||
|
<div id="column1" class="interior"> |
||||
|
<p>Node's most valuable feature is the friendly and colorful community of developers. There are many places where this group congregates on the internet. This page attempts to highlight the best forums.</p> |
||||
|
|
||||
|
<h2>Periodicals</h2> |
||||
|
|
||||
|
<p><a href="http://howtonode.com/">How To Node</a> has a |
||||
|
growing number of useful tutorials. <a |
||||
|
href="http://planetnodejs.com">Planet Node</a> is an |
||||
|
aggregator of Node developer blogs. <a |
||||
|
href="http://nodeup.com/">NodeUp</a> |
||||
|
is a podcast covering the latest Node news in the |
||||
|
community. The <a |
||||
|
href="http://stackoverflow.com/questions/tagged/node.js">Stack |
||||
|
Overflow node.js tag</a> is collecting new information |
||||
|
every day.</p> |
||||
|
|
||||
|
|
||||
|
<h2>GitHub</h2> |
||||
|
<p>All development takes place at <a |
||||
|
href="http://github.com/joyent/node">http://github.com/joyent/node</a>. |
||||
|
The comments on commit messages are often source of heated |
||||
|
discussion regarding core development. The <a |
||||
|
href="http://github.com/joyent/node/wiki">GitHub Node |
||||
|
wiki</a> is full of useful links for newcomers. Don't |
||||
|
miss <a |
||||
|
href="https://github.com/joyent/node/wiki/Projects,-Applications,-and-Companies-Using-Node">Projects, |
||||
|
Applications, and Companies Using Node</a> or the <a |
||||
|
href="https://github.com/joyent/node/wiki/modules">very |
||||
|
long list of Node modules</a>, many of which are |
||||
|
published in the <a href="http://search.npmjs.org/">npm |
||||
|
registry</a>.</p> |
||||
|
|
||||
|
<p><a href="http://notinventedhe.re/on/2011-7-26"><img |
||||
|
src="not-invented-here.png" width="100%" /></a> Bugs |
||||
|
should be reported to <a |
||||
|
href="https://github.com/joyent/node/issues">https://github.com/joyent/node/issues</a>. |
||||
|
Fixes to the code are welcome! Please see our <a |
||||
|
href="https://github.com/joyent/node/wiki/Contributing">contirbuting |
||||
|
guidelines</a> for information on how to submit a |
||||
|
patch.</p> |
||||
|
|
||||
|
<h2>Mailing Lists</h2> |
||||
|
|
||||
|
<p>The <a |
||||
|
href="http://groups.google.com/group/nodejs">user |
||||
|
mailing list</a> is used for announcements, discussion, |
||||
|
and flame wars about Node. The <a |
||||
|
href="http://groups.google.com/group/nodejs-dev">internal |
||||
|
development mailing list</a> is used for discussion of |
||||
|
internal design and feature proposals.</p> |
||||
|
|
||||
|
<h2>IRC</h2> |
||||
|
|
||||
|
<p>For real-time chat about Node development go to |
||||
|
<code>irc.freenode.net</code> in the <code>#node.js</code> |
||||
|
channel with an <a href="http://www.mirc.com">IRC</a> <a |
||||
|
href="http://colloquy.info/">client</a> or connect in |
||||
|
your web browser to the channel using <a |
||||
|
href="http://webchat.freenode.net/?channels=node.js">freenode's |
||||
|
WebChat</a>. Felix Geisendörfer keeps <a |
||||
|
href="http://nodejs.debuggable.com/">logs of the |
||||
|
channel</a> for those who miss a day.</p> |
||||
|
|
||||
|
<h2>Conferences</h2> |
||||
|
|
||||
|
<p><a href="http://www.nodeconf.com/">NodeCamp</a> |
||||
|
conferences are the main event in the United States; they |
||||
|
are organized by Mikeal Rogers. <a |
||||
|
href="http://nodefest.jp/">NodeFest (東京Node学園祭)</a> |
||||
|
is organized by the <a href="http://nodejs.jp">Node.js |
||||
|
Japan user group</a>. <a |
||||
|
href="http://nodecamp.de/">NodeCamp.de</a> in Cologne, |
||||
|
Germany is organized by <a href="railslove.de">Rails |
||||
|
Love</a>. An <a href="http://nodejsconf.it/">Italian |
||||
|
Node.js Conference</a> exists as well. <a |
||||
|
href="http://nodesummit.com/">Node Summit</a> is a |
||||
|
conference in San Francisco focusing on the adoption of |
||||
|
Node in larger companies. <a |
||||
|
href="http://jsconf.com/">JSConf</a> organizes the main |
||||
|
JavaScript conferences.</p> |
||||
|
|
||||
|
<h2>Localized Sites</h2> |
||||
|
|
||||
|
<p><code>nodejs.org</code> does not maintain any |
||||
|
translations into other languages. However there are |
||||
|
community websites in various languages with mailing lists |
||||
|
and translations of the website.</p> |
||||
|
|
||||
|
<p><a href="http://nodejs.ru/">nodejs.ru</a> Russian blog. |
||||
|
<br/> |
||||
|
<a href="http://nodejs.ir">nodejs.ir</a> Iran group in Persian |
||||
|
<br/> |
||||
|
<a href="http://nodejs.jp/">nodejs.jp</a> Japan user group |
||||
|
<br/> |
||||
|
<a href="http://cnodejs.org">CNodeJS.org</a> Chinese community |
||||
|
<br/> |
||||
|
<a href="http://nodejs.co.il">nodejs.co.il</a> Israeli wiki |
||||
|
<br/> |
||||
|
<a href="http://nodejs.hk">HKNoJ</a> Hong Kong community |
||||
|
<br/> |
||||
|
<a href="http://nodejs.tw">nodejs.tw</a> Taiwan community</p> |
||||
|
<p><a href="/">Go back to the home page</a></p> |
||||
|
</div> |
||||
|
<div id="column2" class="interior"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div id="footer"> |
||||
|
<p>Copyright <a href="http://joyent.com">Joyent, Inc</a>, Node.js |
||||
|
is a <a href="trademark-policy.pdf">trademark of Joyent, Inc</a>. |
||||
|
</div> |
||||
|
|
||||
|
<script type="text/javascript"> |
||||
|
var gaJsHost = (("https:" == document.location.protocol) ? |
||||
|
"https://ssl." : "http://www."); |
||||
|
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); |
||||
|
</script><script src="../ga.js" type="text/javascript"></script> |
||||
|
<script type="text/javascript"> |
||||
|
try { |
||||
|
var pageTracker = _gat._getTracker("UA-10874194-2"); |
||||
|
pageTracker._trackPageview(); |
||||
|
} catch(err) {}</script> |
||||
|
<script type="text/javascript">highlight(undefined, undefined, 'pre');</script> |
||||
|
|
||||
|
|
||||
|
</body></html> |
After Width: | Height: | Size: 199 KiB |
After Width: | Height: | Size: 7.4 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 2.5 KiB |