When writing a service-stack that utilize both process and machine clustering (or should be capable of that), there are a few things that must be worked out beforehand.


  • First of all you need a reliable message system and adaptable message format - so that the services can communicate and speak the same language if you will; a message system that keeps track of what has been sent, so it can match that up with the responses as they come in (this is how things work in an asynchronous reality). Once a message arrives, it calls a procedure you provided when you first sent the request.
  • Secondly, you need a zero-configuration mechanism so each service can find and register with the master or core. This registration process also informs the core about the protocols each service provides. So that when a message with that signature arrives - the server knows where to delegate them (and likewise, keep track of the caller so that the response is returned to the correct caller).


What I just described is the Ragnarok message framework, which is an integral part of the Quartex Pascal run-time library. This is the message system that powers the Quartex Media Desktop, both on the server-side of things, but interestingly enough also between hosted HTML5 applications (running inside an IFrame window) and the desktop itself.


We are going to explore this topic further when we look at the Ragnarok system in detail -- but in conclusion to why Node.js makes such good sense for service coding in 2020:


instead of having a single, monolithic service that can be difficult to maintain, the Node.js way is to divide that monolith into several isolated services; services that each communicate with a master service that acts as a gateway to your software. This architecture performs just as well, in some cases it even outperforms, the old native monolithic single exe-file; a technology dating back to the late 90s and early 2k's.


As a bonus, Node.js services and servers are Docker compatible, which means that once you have written them -- you can isolate your entire service stack as docker modules. You can then deploy your infrastructure virtually anywhere, and scale up your instances as you need them.


All of it from the comfort of object pascal that you know and love.