Nodejs Embedded Applications

Source: Internet
Author: User

1) starting from the Nodejs V4 version has been released for the embedded operating environment, my board is Cortex A5, armv7 architecture, with the latest version node-v9.9.0-linux-armv7l.tar.gz

node-v9.9.0-linux-arm64.tar.gz 21-mar-2018 20:05 17909317
Node-v9.9.0-linux-arm64.tar.xz 21-mar-2018 20:07 10789576
node-v9.9.0-linux-armv6l.tar.gz 21-mar-2018 15:19 17149093
Node-v9.9.0-linux-armv6l.tar.xz 21-mar-2018 15:37 10302588
node-v9.9.0-linux-armv7l.tar.gz 21-mar-2018 11:40 17190798
Node-v9.9.0-linux-armv7l.tar.xz

Official website Https://nodejs.org/download/release

Document Manual https://nodejs.org/api/

Chinese Community https://cnodejs.org/

2) Installation
CP node-v4.9.1-linux-armv7l.tar.gz/usr/local/
cd/usr/local/
Tar xvf node-v4.9.1-linux-armv7l.tar.gz

3) can also compile their own source code
./configure--prefix=/home/dong/nodejs--dest-cpu=arm--without-snapshot--without-ssl
Make
Make install

4) Add Environment variables
Path= "/usr/local/bin:/usr/bin:/bin:/usr/local/node-v4.9.1-linux-armv7l/bin"
Export Ld_library_path=/usr/local/node-v4.9.1-linux-armv7l/lib: $LD _library_path

5) Test Example Http_server_test.js
var http = require ("http");
Http.createserver (function (request, response) {
Response.writehead ($, {"Content-type": "Text/plain"});
Response.Write ("Hello World");
Response.End ();
}). Listen (8888);
Console.log ("Nodejs Start listen 8888 port!");

6) Top Resource monitoring
PID USER PR NI VIRT RES SHR S%cpu%MEM time+ COMMAND

v4.9.1
581 root 0 82616 18660 11968 S 0.0 7.4 0:03.52 node

v4.2.6
420 root 0 82760 18636 12476 S 0.0 7.4 0:02.09 node

v4.4.5
463 Root 0 82880 18992 12792 S 0.0 7.6 0:02.08 Node

v6.14.1
518 Root 0 69668 20888 15188 S 0.0 8.3 0:02.55 node

v9.9.1
518 Root 0 71240 25456 18840 S 0.0 10.2 0:02.55 Node

PID PPID USER STAT VSZ%vsz CPU%cpu COMMAND
966 783 root S 81288 32.0 0 0.0 node Http_server.test.js

Ulimit-s 512
980 783 Root S 50568 19.9 0 0.0 node Http_server.test.js

But one consequence of using ulimit is that it affects all programs that are subsequently started under the same environment (the same shell or terminal), and if it is set at startup, it affects the entire system, which is obviously not desired. There are two ways to get rid of this effect:

1) Write a shell script separately for the program that needs to modify the stack size, and call Ulimit-s before the program starts. Because the environment of the child shell does not affect the parent shell, the settings do not alter the external environment.
2) before the program run Ulimit-s modify the required stack size, after the program run again Ulimit-s modified back to the original stack size.

Or with v4.9.1 cost-effective, long-term support version, accounting for less resources, also does not affect the implementation of functions.

Nodejs Embedded Applications

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.