Node.js is single threaded and by default utilizes only one core of the CPU no matter how many cores the CPU has. Of course there are solutions of how to use all the cores but it's not part of this post. Just for the record, there are packages that does this job efficiently. Have a look at this link pm2.keymetrics.io/
Well, what am I trying to solve here? Imagine that you have 2 different endpoints on your application, and one of them needs a lot of processing time. What the problem would be?
Comments
The javascript engineers have been troubled often with the callbacks and the callback hell. The rescue are the promises: an easy and convenient way to handle the asynchronous calls.
What are the promises?
A promise is an alternative way which allows us to handle asynchronous operations in a more elegant way than callbacks
Let's assume a simple story which will help us understand this. (well OK, I know that its not the best example you've ever read)
A father asks his son to go and buy a newspaper. The father is awaiting for the newspaper and will start reading it when his son returns back. On the other hand, the father knows that his son, who loves playing out in the yard, has some possibilities to fall down and start crying. In this case he won't read his newspaper and he will have to care of his son. There are two cases in the story; the father will read the newspaper. The father won't read the newspaper. 12/20/2017 Comments Javascript compilation - execution
Javascript compilation - execution * In the company that I work for, we have a ceremony, called DOJO, in which any employer can present his/her ideas about any subject he/she wants to share (though we are trying to be focused on technological stuff). As such, this slide presentation was one of our DOJOs
Before diving into details in the matter of full stack applications, I would like to point out the reasons that make me start searching of something like this. You might ask "something like what?" :).
Well, firstly I started experimented with angular generator for creating a single page application that would connected with a REST API. But what about if I wanted to make any heavily data manipulation or anything sensitive? In the other hand, I met NodeJs' sockets and I would probably wanted to use them in future. For avoiding combine express with angular in a later stage, I decided to do it from beginning. 3/16/2014 Comments ado.net vs nodeJsRecently I tentative started reading about nodeJs and despite it’s a new framework I’ve been excited of the ecosystem it already has. Isn’t hard to find of what you are looking for and the nodeJs.org itself is really helpful. When I first saw nodeJs’ motto “Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications” I focused on “fast” and I immediately wanted to do some comparisons with .NET+IIS. For my comparison I used ab Apache Http Server benchmarking tool I will come back soon with more results Both of applications have identical pages. It is just 10000 list items that comes from mysql. In order to test only the application and not the database I am caching the results the first time they arrive. for .net application I used v4.5 and MVC3 and for nodeJs I used sailsJs . |
AuthorI am an Angular GDE, content creator who loves sharing knowledge TagsAll Angular Angularjs General Graphql Ionic Javascript .net Nodejs Typescript |