Newly released Deno 1.9 promises “Rust-like” performance, still outrun by Node.js

There is no incentive swapping to Deno, especially not from Node.js. Node.js has history and is not exactly a performance beast on its own, but it does have strong support for native add-ons. These can seamlessly augment and boost Node.js to heights way above what is possible with Deno.

Above simple bar chart plots the new web I/O performance of Deno 1.9. With this new release, Deno is finally utilizing the Rust-written “Hyper” — a native HTTP server built for speed. This finally brings a big boost over the prior, scripted-and-sluggish, HTTP server built on Deno’s own TypeScript APIs.


A 12x performance boost to Node.js

I recently hooked up my Raspberry Pi 4 to my TV and because I hadn’t benchmarked something in a while I decided to see if I could serve 100k HTTP req/sec from this little thing, over an actual Ethernet cable.

I have no fan on this thing, so I use a chunk of metal to passively cool it down somewhat.

I began by installing Ubuntu Server 20.10 for ARM64 via the Raspberry Pi Imager tool.

After booting Ubuntu on the Pi4, I then installed C++ build tools and cloned & built µWebSockets:

git clone --recursive
cd uWebSockets

Then I simply ran the HelloWorldThreaded executable and started htop.

If you don’t know about µWebSockets, this is roughly how…

A technical explanation for those interested in the gory details

Imagine being a paperboy, tasked with delivering letters to a set of houses by car. Would you drive around all houses, delivering one letter at every stop, going round all houses many times until you have no more letters to deliver? Or would you sort the letters by house, then drive one round delivering all letters in one go, one bundle of letters per house?

A shockingly huge majority of web servers will drive that car all day long, stopping for one single letter a time. Socket.IO, one of the most popular pub/sub implementations used is such a case. Other…

Newly released Deno 1.0 does not make any sense to me

10 years ago we saw both Node.js and Golang release for the first time. Node.js was adopted at a rapid rate by scripters fed up with the old PHP/Apache set-up. Golang had a slower start to its adoption, opting for a co-routine design from the very start, probably discouraging unfamiliar users. It has since accelerated its adoption significantly, as co-routines has become increasingly mainstream and accepted.

Node.js on the other hand began with nothing but callbacks, adding promises later on and finally async/await co-routines. While Node.js has aged with this transition from callbacks to co-routines, Golang has had co-routines since…

Practical benchmark of TLS 1.3 WebSockets on limited hardware

If you’ve ever checked your stocks during the virus outbreak, you might have noticed that valuations are updated without you having to reload the page. This happens with Yahoo Finance, TradingView and many others.

These updates are due to WebSockets, persistent connections that receive updates whenever they are sent. The back-end will hold a connection to your web browser for the duration of your visit, keeping you up to date. This connection is not free, and will require back-end resources.

Depending on what kind of software being used back-end, this cost can vary greatly, as hardware requirements will scale at…

Live updates don't have to be very expensive

WebSockets are everywhere on the modern web. They deliver live financial updates, betting, social feeds, chat, collaborative editing, gaming, notifications and pretty much everything that is not a client-initiated request. If something updates on its own, chances are you stumbled upon a WebSocket. Even distributed tech like WebRTC requires WebSockets for peer discovery and signaling.

The Raspberry Pi 4 is a ~$60 fanless ARM64 computer

This luxury of having web apps react to live events and updates does however not come for free. Because WebSockets are persistent, they last for the entire user session and potentially longer than this. …

Forking an open source project is one of the core rights given to every developer. If enough competence, money and vision agree to fork a project turned sour, it can rearrange the power structure for the better. One example of a successful and excellent fork is LibreOffice, which was forked from OpenOffice over various issues with how Oracle (and earlier Sun Microsystems) had neglected third party contributions.

Creating a successful fork takes competence, time, money and knowledge of the code base. In the case of LibreOffice, The Document Foundation was created as the new steering and financial organ.

LibreOffice was…

µWebSockets (“uws”) is an open source WebSocket server with more than 40 million downloads

Back in 2015 I worked for a start-up as a GPGPU programmer, writing OpenCL kernels for clusters of AMD graphics adapters. We needed WebSockets they told me, many of them. Well what the fuck is a WebSocket and where can I get many of them?

I started testing and benchmarking a few alternatives such as libwebsockets, WebSocket++ and ws (for Node.js). The results were way off my expectations — I knew one TCP socket would be roughly a handful of bytes in terms of user space memory footprint, yet these servers were giving me WebSockets requiring multiple kilobytes of user…

You don’t need decade-old hacks & quirks to build real-time apps.

µWebSockets.js is an open source WebSocket server developed since early 2016. It implements standard WebSockets — something today’s web browsers all support without polyfill or helpers. They are standard, simply put. Since inception, µWebSockets.js has established the reputation of being very optimized and fast, lean and stable. Now I want to show you how simple it can be to use!

As a reference we’ll consider the very popular Socket.IO. We’ll be looking at the basics of a collaborative drawing app, comparing the two different technologies in terms of simplicity and productivity. …

A scientific comparison using stock exchanges and Socket.IO

Pub/sub is a well known and popular abstraction for working with real-time messaging. You subscribe to a set of “topics” and receive messages published under those. This simple abstraction makes it easier to build many real world applications without having to manage socket groups manually.

Sadly, most if not all popular pub/sub implementations in the Node.js ecosystem are exceedingly inefficient as compared to what is technically possible, and can greatly reduce server performance as load increases.

The most well-known example has to be Socket.IO. It markets itself with the bold line “FEATURING THE FASTEST AND MOST RELIABLE REAL-TIME ENGINE”, managing…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store