HeardNode. jsRecently, it was very popular. After a brief look on the Internet, it was about an engine that executes Js in a non-browser environment (based on V8 engine extension) and comes with the Web server function. Using js to replace other traditional server-side scripts has a powerful "Everything is JS" architecture. I recently learned something about Linux, so I tried to install a node on centos.
SlaveSource codeInstallation and testing
Find the download Source Code address from the http://nodejs.org: http://nodejs.org/dist/v0.8.14/node-v0.8.14.tar.gz with wget command download:
Wget http://nodejs.org/dist/v0.8.14/node-v0.8.14.tar.gz
Tar-zxf node-v0.8.14.tar.gz
- CD to the node-v0.8.14, execute configure \ make install in sequence, compile the library to be dependent on: Yum install gcc-C ++ OpenSSL-devel
./Configuremakemake install
- Write TestCode, Save as test-web-server.js
VaR HTTP = require ('http'); http. createserver (function (req, Res) {res. writehead (200, {'content-type': 'text/plain '}); Res. end ('Hello node. JS \ n ');}). listen (8081, "192.168.1.102"); console. log ('server running at http: // 192.168.1.102: 8081 /');
Node test-web-server.js &
- Open and save firewall settings
Iptables-I input 2-P TCP -- dport 8081-J acceptservice iptables save
- Using http_load for a simple stress test, we can see that there are also 10000 requests. When the number of concurrent requests is 50, the throughput is 2869. When the number of concurrent requests is 500, the throughput is 1935, the decline trend is obvious ~