Adventures in Nodeland - Issue #6 - Last week I worked on Node.js core!
Hi Everyone! I’ve started a newsletter to share my thoughts on technology, the advancements of Node.js and to keep all of you up-to-date of what I’m working on. This newsletter might be weekly, biweekly or monthly… we’ll see how it evolves in the coming months.
Software Architecture
I would recommend everybody to read the article above when deciding to use AWS Lambda for your next project. The article compare the pricing cost of AWS Lambda against Fargate, EC2 and EC2 spot instances. The article is technology-agnostic and it focuses on spinning up containers/apps for CPU-intensive tasks. The outstanding result of this analysis is that AWS Lambda is 2.4 more costly than AWS Fargate, and 7.1 compared to EC2.
Things change a bit when using Lambdas for IO-bound tasks with a technology like Node.js. AWS Lambda is severely constrained by only processing one task at a time, while a Node.js server on Fargate or EC2 could serve up to several thousands of concurrent requests, depending on your data storage. I would be very very keen in seeing an in-depth analysis for this case. I think that the analysis would still hold and probably the difference is even more steep.
Fastify
After last week article from Supabase, this week it is Hasura that blogs about how to use Fastify together with the Hasura BaaS and Nuxt.js. Read up, it’s amazing stuff.
This article on Hasura has also lead to the creation fo https://www.npmjs.com/package/fastify-hasura, a new library to simplify the integration. Hasura and Fastify are such a great combo together. Good job Emmanuel Salomon!
Node.js Core
My quest to restore the performance of the upcoming Node.js v16 (https://github.com/nodejs/node/issues/37937) to the same levels of v14 has spawned two more PRs:
- Revert “timers: refactor to use optional chaining” - apparently using the optional chaining in the HTTP hot path caused the timer creation to not be inlined.
- lib: revert primordials in a hot path - reverts several changes to “primordials” that lead to a ~4% decrease in throughput; Antoine du Hamel then followed up with https://github.com/nodejs/node/pull/38248, which take a more conservative approach to the revert - while maintaining the same performance profile.
Node.js v16 is coming later this month and it will feature a “fat binary” to support both Intel and Apple Silicon macs. I’m proud of our team for being able to ship this in line with the v16 release! You can test the RC with nvm and https://gist.github.com/mcollina/7e5c0dbb14641151d42049b67db06799.
OSS life
If you have been following the last few issues of this newsletter, I have been writing about the changes to Github secrets and variables that have lead to a significant security vulnerability as well as a breakage for most of my automated dependency updates. GitHub has implemented a way to safely encrypt a secret and only expose it for certain users:
Thanks
Let me know if there are some topics you’d love to read about more, or some specific question you have about Node.js… I’ll try to answer them in the coming newsletters.