zeus
3 years ago
2 changed files with 61 additions and 0 deletions
@ -1,6 +1,7 @@ |
|||||
* xref:index.adoc[datacollector] |
* xref:index.adoc[datacollector] |
||||
* xref:index-structure.adoc[project structure] |
* xref:index-structure.adoc[project structure] |
||||
** xref:index-vuejs.adoc[Vue.js] |
** xref:index-vuejs.adoc[Vue.js] |
||||
|
** xref:index-nodejs.adoc[Node JS] |
||||
** xref:index-mongo.adoc[Mongo] |
** xref:index-mongo.adoc[Mongo] |
||||
** xref:index-redis.adoc[Redis] |
** xref:index-redis.adoc[Redis] |
||||
* xref:index-src.adoc[src-files] |
* xref:index-src.adoc[src-files] |
||||
|
@ -0,0 +1,60 @@ |
|||||
|
= NodeJS -> services readmongo_service, dummy_service |
||||
|
|
||||
|
|
||||
|
|
||||
|
TIP: As an asynchronous event-driven JavaScript runtime, Node.js is designed to build scalable network applications. |
||||
|
|
||||
|
Almost no function in Node.js directly performs I/O, so the process never blocks. Thanks to this, scalable systems is very reasonable to be developed in Node.js. |
||||
|
|
||||
|
https://nodejs.org/en/docs/guides/blocking-vs-non-blocking/[Overview of Blocking vs Non-Blocking^] |
||||
|
|
||||
|
TIP: *Node.js* is similar in design to, and influenced by, systems like *Ruby's Event Machine* and *Python's Twisted.* |
||||
|
|
||||
|
Node.js takes the event model a bit further. It presents an *event loop as a runtime construct* instead of a library. |
||||
|
|
||||
|
*In other systems, there is always a blocking call to start the event-loop.* |
||||
|
|
||||
|
Typically, |
||||
|
|
||||
|
- behavior is defined through callbacks at the beginning of a script, |
||||
|
|
||||
|
- and at the end a server is started through a blocking call like *EventMachine::run().* |
||||
|
|
||||
|
[NOTE] |
||||
|
==== |
||||
|
In Node.js, there is no such start-the-event-loop call. |
||||
|
|
||||
|
- *Node.js* simply *enters the event loop after executing the input script.* |
||||
|
|
||||
|
- *Node.js exits the event loop* when there are *no more callbacks to perform.* |
||||
|
==== |
||||
|
|
||||
|
|
||||
|
Node.js being *designed without threads* doesn't mean you can't take advantage of multiple cores in your environment. |
||||
|
|
||||
|
Child processes can be spawned by using our *child_process.fork() API,* and are designed to be easy to communicate with. |
||||
|
|
||||
|
TIP: Built upon that same interface is the cluster module, which *allows you to share sockets between processes* to enable load balancing over your cores. |
||||
|
|
||||
|
|
||||
|
=== Video = intro |
||||
|
|
||||
|
|
||||
|
**** |
||||
|
TIP: NodeJS in 10 Minutes and Netflix |
||||
|
|
||||
|
video::2gQG4cFjahw[youtube] |
||||
|
|
||||
|
video::CZ3wIuvmHeM[youtube] |
||||
|
**** |
||||
|
|
||||
|
netflix |
||||
|
|
||||
|
* 6:50 monolithic |
||||
|
* 8:24 minroservices |
||||
|
* 19:00 microservice |
||||
|
* 37:00 |
||||
|
|
||||
|
https://netflix.github.io[Netflix on Github] |
||||
|
|
||||
|
|
Loading…
Reference in new issue