{"id":3982,"date":"2022-08-31T15:15:53","date_gmt":"2022-08-31T15:15:53","guid":{"rendered":"https:\/\/obambu.com\/guide\/?p=3982"},"modified":"2022-08-31T15:15:54","modified_gmt":"2022-08-31T15:15:54","slug":"what-is-node-js","status":"publish","type":"post","link":"https:\/\/obambu.com\/guide\/what-is-node-js\/","title":{"rendered":"What is Node.js"},"content":{"rendered":"\n<p>Node.js is an open source and cross platform Java-script runtime environment that runs on a JavaScript engine and executes <strong>Java code<\/strong>.<\/p>\n\n\n\n<p>Node.js allows developers to write command line tools and do server scripting to make dynamic web content before the page is sent to the user\u00b4s browser.<\/p>\n\n\n\n<p>In essence, it\u00b4s a platform that is very useful for <strong>web development<\/strong>. But it\u00b4s a bit complex for newcomers and can be inefficient if used in determined aspects in web development. Think of it as a tool that is very useful in certain niches of the web development process. Here we\u00b4ll get into how it works and where it\u00b4s best to use.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How does it work?<\/h2>\n\n\n\n<p>Node.js operates on a <strong>single thread<\/strong> and uses <strong>non-blocking I\/O calls<\/strong>, allowing it to support tens of thousands of concurrent connections held in the event loop. This contrasts with traditional web-serving techniques, where each connection spawns a new thread, using up <strong>RAM <\/strong>and eventually maxing-out at the amount of RAM available.<\/p>\n\n\n\n<p>For you to better understand this process, let\u00b4s see how Node.js processes connections step by step:<\/p>\n\n\n\n<ol class=\"wp-block-list\" type=\"1\"><li>\u00a0The program maintains a <strong>limited number of threads<\/strong> to serve the request<\/li><li>When a request comes, <strong>Node.js<\/strong> puts it on queue<\/li><li>Then the <strong>single thread loop<\/strong> comes to action, waiting indefinitely for requests<\/li><li>When the <strong>request <\/strong>is received, the <strong>loop <\/strong>picks it up and checks to see If it requires a blocking input\/output<strong> (I\/O) operation<\/strong><\/li><li>If it has a blocking request, it assigns a <strong>thread <\/strong>from the limited amount the program has<\/li><li>After the <strong>blocking task <\/strong>is completed, the event <strong>loop <\/strong>monitors blocking requests and adds them to the queue. That\u2019s how it keeps its non-blocking nature.<\/li><\/ol>\n\n\n\n<p>Because Node.js uses a <strong>limited amount of threads<\/strong>, it uses less memory which makes for a faster task execution. This makes the use of Node.js perfect for real-time applications.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Where should you use Node.js?<\/h2>\n\n\n\n<p>Now that you know what Node.js and how it works, here is the best places to use it:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Chat<\/h3>\n\n\n\n<p>The chat application is truly the ideal use case for <strong>Node.js<\/strong> because it is a small, widely distributed, data-intensive (but low processing\/computation) application with significant traffic. As it&#8217;s straightforward yet covers most of the paradigms you&#8217;ll ever use in a regular Node.js application, it&#8217;s also a fantastic use-case for learning.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Data streaming<\/h3>\n\n\n\n<p>HTTP requests and responses on most web platforms are data streams. This allows you to use Node.js to implement features as file processing while they\u00b4re downloading. Which can be useful for real time audio and video encoding, also for proxying between data sources &nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Application and system monitoring<\/h3>\n\n\n\n<p>A useful thing you can do with <strong>Node.js<\/strong> is a real time monitoring dashboard for your website. The program is a perfect fit for tracking visitors and seeing their interactions in real time.<\/p>\n\n\n\n<p>By adding <strong>targeted interactions<\/strong> with your visitors and opening a communication channel when they reach a certain stage of your funnel, you can collect real-time statistics from your users.<\/p>\n\n\n\n<p>With Node.js you can also <strong>setup a dashboard<\/strong> for your clients to have a monitoring page, were the program creates a loop to check the services\u00b4 status and push the data to clients.<\/p>\n\n\n\n<p>These statuses can be reported in real time and create the possibility of creating a Network operations centre.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Where you don\u00b4t want to use Node.js<\/h2>\n\n\n\n<p>As we\u00b4ve seen, the platform is very useful for processing information in real time to create dashboards or stream files. Here\u00b4s a few instances were using Node.js is a bad idea:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Heavy server processing or computing<\/h3>\n\n\n\n<p><strong>Node.js<\/strong> is not the ideal program for doing heavy computing or data processing tasks. <strong>Intensive CPU<\/strong> operations null the event driven non-blocking I\/O model that the platform is characterised by.<\/p>\n\n\n\n<p>When you execute heavy tasks on Node.js, the requests will be blocked.  Whilst the thread is occupied with number crunching.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion.<\/h2>\n\n\n\n<p>Node.js is a very useful platform for web developing and management. But it\u00b4s use must be specific to the programs characteristics . If you have to do heavy computing that requires more than one core, then you shouldn\u00b4t use it.<\/p>\n\n\n\n<p>However if your work doesn\u00b4t require CPU intensive operations or blocking resources, you can use it to have fast and scalable network applications in real-time.<\/p>\n\n\n\n<p>Here at <a href=\"http:\/\/obambu.com\/en\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Obambu<\/strong><\/a>, we allow the use of Node.js for web development on any of our <strong>hosting plans and VPS<\/strong>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Node.js is an open source and cross platform Java-script runtime environment that runs on a JavaScript engine and executes Java code. Node.js allows developers to write command line tools and do server scripting to make dynamic web content before the page is sent to the user\u00b4s browser. In essence, it\u00b4s a platform that is very<\/p>\n","protected":false},"author":2,"featured_media":3983,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":{"0":"post-3982","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-web-hosting"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v16.6.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>What is Node.js - Obambu Guide | Navigating the Web Hosting World<\/title>\n<meta name=\"description\" content=\"Node.js is an open source and cross platform that runs on JavaScript. it allows developers to write commands and make dynamic web content.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/obambu.com\/guide\/what-is-node-js\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is Node.js - Obambu Guide | Navigating the Web Hosting World\" \/>\n<meta property=\"og:description\" content=\"Node.js is an open source and cross platform that runs on JavaScript. it allows developers to write commands and make dynamic web content.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/obambu.com\/guide\/what-is-node-js\/\" \/>\n<meta property=\"og:site_name\" content=\"Obambu Guide | Navigating the Web Hosting World\" \/>\n<meta property=\"article:published_time\" content=\"2022-08-31T15:15:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-08-31T15:15:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/obambu.com\/guide\/wp-content\/uploads\/2022\/08\/g5jph62pwes.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1600\" \/>\n\t<meta property=\"og:image:height\" content=\"1200\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/obambu.com\/guide\/#website\",\"url\":\"https:\/\/obambu.com\/guide\/\",\"name\":\"Obambu Guide | Navigating the Web Hosting World\",\"description\":\"Explore dozens of tutorials and how-to guides on Obambu Guide. Learn, Build, Grow!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/obambu.com\/guide\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/obambu.com\/guide\/what-is-node-js\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/obambu.com\/guide\/wp-content\/uploads\/2022\/08\/g5jph62pwes.jpg\",\"contentUrl\":\"https:\/\/obambu.com\/guide\/wp-content\/uploads\/2022\/08\/g5jph62pwes.jpg\",\"width\":1600,\"height\":1200,\"caption\":\"what is node.js\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/obambu.com\/guide\/what-is-node-js\/#webpage\",\"url\":\"https:\/\/obambu.com\/guide\/what-is-node-js\/\",\"name\":\"What is Node.js - Obambu Guide | Navigating the Web Hosting World\",\"isPartOf\":{\"@id\":\"https:\/\/obambu.com\/guide\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/obambu.com\/guide\/what-is-node-js\/#primaryimage\"},\"datePublished\":\"2022-08-31T15:15:53+00:00\",\"dateModified\":\"2022-08-31T15:15:54+00:00\",\"author\":{\"@id\":\"https:\/\/obambu.com\/guide\/#\/schema\/person\/7cfedd97f012c03c8c95528885e359e2\"},\"description\":\"Node.js is an open source and cross platform that runs on JavaScript. it allows developers to write commands and make dynamic web content.\",\"breadcrumb\":{\"@id\":\"https:\/\/obambu.com\/guide\/what-is-node-js\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/obambu.com\/guide\/what-is-node-js\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/obambu.com\/guide\/what-is-node-js\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/obambu.com\/guide\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"What is Node.js\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/obambu.com\/guide\/#\/schema\/person\/7cfedd97f012c03c8c95528885e359e2\",\"name\":\"Alejandro Prieto\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/obambu.com\/guide\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/obambu.com\/guide\/wp-content\/uploads\/2021\/07\/20200731_145844.jpg\",\"contentUrl\":\"https:\/\/obambu.com\/guide\/wp-content\/uploads\/2021\/07\/20200731_145844.jpg\",\"caption\":\"Alejandro Prieto\"},\"url\":\"https:\/\/obambu.com\/guide\/author\/alejandro\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/obambu.com\/guide\/wp-json\/wp\/v2\/posts\/3982","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/obambu.com\/guide\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/obambu.com\/guide\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/obambu.com\/guide\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/obambu.com\/guide\/wp-json\/wp\/v2\/comments?post=3982"}],"version-history":[{"count":1,"href":"https:\/\/obambu.com\/guide\/wp-json\/wp\/v2\/posts\/3982\/revisions"}],"predecessor-version":[{"id":3984,"href":"https:\/\/obambu.com\/guide\/wp-json\/wp\/v2\/posts\/3982\/revisions\/3984"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/obambu.com\/guide\/wp-json\/wp\/v2\/media\/3983"}],"wp:attachment":[{"href":"https:\/\/obambu.com\/guide\/wp-json\/wp\/v2\/media?parent=3982"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/obambu.com\/guide\/wp-json\/wp\/v2\/categories?post=3982"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/obambu.com\/guide\/wp-json\/wp\/v2\/tags?post=3982"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}