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 test is not even fair; Deno in this test has no URL router — while Node.js has, with uWebSockets.js. Still, we can get Node.js to beat Deno 1.9, handling more than double the amount of requests per second.

Of course, Deno is marketed with the same exact honor by association


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 https://github.com/uNetworking/uWebSockets
cd uWebSockets
make
./HelloWorldThreaded

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…


A seamless performance boost for Python backends

The Python scripting environment is shockingly well-designed. Almost every thing I dislike about Node.js, Python does better. For one, Python does not enforce any one particular event-loop but rather employs a plug in system where you can replace the whole thing, parts of it, or only a fraction of it.

µWebSockets for Python integrates with asyncio by replacing a small part of the event-loop; the Selector. Everything else is left as is, making a minimal change while allowing seamless integration without disturbing other asyncio projects running on the same thread.

import uws import asyncio # Integrate with asyncio asyncio.set_event_loop(uws.Loop()) app…


µ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. …

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