Your Choice JavaScript News

Node News Friday, March 9 Scala, Scala scala, Cpu intensive code & more…

Node News TLDR / Table of Contents

  • Make the front-page title less jargony by lihaoyi · Pull Request #852 · scala/scala-lang
    • The current title is pretty strange; it really doesn’t mean anything to me, someone who has been using Scala for a long time, and would mean even less to a newcomer. We should dispense with the jargon and say what people would be interested in hearing, in plain language that…
    • Scala, Scala Scala, high-performance systems, language,
  • CPU Intensive Node.js: Part 1 –
    • We explore the issues and solutions around running CPU intensive code in Node.js; in particular in a web server. Node.js’ single-threaded approach to running user code (the code that you write) can…
    • CPU intensive code, ARTIFICIAL CPU INTENSIVE, CPU Intensive Node.js, example experiences performance, JavaScript event loop
  • Comparing AWS Lambda performance of Node.js, Python, Java, C# and Go
    • AWS recently announced their support for both C# (Net Core 2.0) and Go programming languages for Lambda functions. As an engineer who maintained serverless-golang, I was curious to learn how the…
    • AWS Lambda, AWS Lambda functions, performance, AWS Lambda users, AWS Lambda platform
  • Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
  • Already on GitHub?
  • Sign in to your account

Tags: Scala, Scala Scala, high-performance systems, language,

  • In this case, we modify Node.js hello world example using the sleep package to simulate a web server where each request takes five seconds running CPU intensive code (complete example available).
  • index.js – /* eslint-disable no-console */ – const http = require(‘http’); – const { sleep } = require(‘sleep’);const hostname = ‘127.0.0.1’; – const port = 3000;const server = http.createServer((req, res) = { – sleep(5); // ARTIFICIAL CPU INTENSIVE – res.statusCode = 200; – res.setHeader(‘Content-Type’, ‘text/plain’); – res.end(‘Hello hostname, () =…
  • ; – app.get(‘/intense’, (req, res) = { – sleep(5); // ARTIFICIAL CPU INTENSIVE – res.send(‘Hello () = console.log(‘Example app listening on port 3000!’))
  • Fork – Similar to other programming languages, Node.js can fork new child processes to handle intensive CPU tasks without blocking the parent processs event loop.
  • Next Steps – There is a common solution to this sort of Node.js problem (web server with CPU intensive endpoints): setting up a queue and a pool of worker processes.

Tags: CPU intensive code, ARTIFICIAL CPU INTENSIVE, CPU Intensive Node.js, example experiences performance, JavaScript event loop

  • AWS recently announced their support for both C# (Net Core 2.0) and Go programming languages for Lambda functions.
  • Similar to the original performance tests, well ignore the initial cold start timeand focus only on the duration metric to compare runtime performance between the different languages.
  • The script executes a load test across all twelve APIs over a one-hour period: – Observation 1.Net Core 2.0 significantly outperformsBoth C# and F# on.Net Core 2.0 exceeds all expectations and outperforms all other runtimes in average duration.
  • Observing the average durations on the graph, both C# and F# on.Net Core 2.0 are consistently lower than other runtimes throughout the 1-hour period: – Average Duration of C# on.Net Core2.0Observation 2Go performance is comparable toJavaThe runtime performance of Go is very similar to Javawith slightly less variance.
  • xObservation 3Consistent performance of compiled vsdynamicIn the original 2017 benchmark results, the compiled languages of Java and.Net Core 1.0 were clearly more consistent compared to the dynamic languagesPython and Node.js.

Tags: AWS Lambda, AWS Lambda functions, performance, AWS Lambda users, AWS Lambda platform

Top Node Courses

The Complete Node.js Developer Course (2nd Edition) (60,232 students enrolled)

By Andrew Mead
  • Build, test, and launch Node apps
  • Create Express web servers and APIs
  • Store data with Mongoose and MongoDB
  • Use cutting-edge ES6/ES7 JavaScript
  • Deploy your Node apps to production
  • Create real-time web apps with SocketIO

Learn more.


Angular (Angular 2+) & NodeJS - The MEAN Stack Guide (26,806 students enrolled)

By Maximilian Schwarzmüller
  • Build real Angular + NodeJS applications
  • Understand how Angular works and how it interacts with Backends
  • Connect any Angular Frontend with a NodeJS Backend
  • Use MongoDB with Mongoose to interact with Data on the Backend
  • Use ExpressJS as a NodeJS Framework
  • Provide a great user experience by using Optimistic Updating on the Frontend
  • Improve any Angular (+ NodeJS) application by adding Error Handling

Learn more.