Faster when Switched Off

Due a real-time communication requirement in a project, yesterday I began to dive into "websockets" (more precisely, with Ratchet). And I had the same impression that NoSQL-mania previously gave to me: those "blazing fast new tool!" promises are completely false.

Yes, that kind of tool itself is faster for sure. But just as long as they handle a minor level of complexity, lefting you (and your own code) to care about stuffs previously delegated to affordable commodity middleware.

Look at NoSQL data bases: impressive speed in writing and reading when compared to a more classic SQL database, but no ability to directly perform data aggregation (that is: no relationships). As most of scenarios involve different kind of data to be related and matched one with the other, adopting a NoSQL solution you take the duty to read, search, match, aggregate, or even worse replicate the same informations in different structures to smash together (and keep up-to-date) the collections you need. And, as you may be the most gifted developer on Earth, I don't really bet that your PHP or Python algorithm to retrieve and relate scattered informations can be faster than a join executed by native C code which has been more and more optimized in the last 20 years. Without mentioning the time you spend to write that algorithm, and the obvious cost.

Same with WebSockets servers: they are not intrinsecally faster, but force you to be. As any old-school web server provides out-of-the-box to spawn and fork and thread to satify all incoming requests, and scaling (at least, at reasonable levels) is mostly a matter of available silicon, with a websocket server you run on a single thread, and all parallelization of the work is up to you. If in any classic setup, for example, scheduling an image resize on a queue is an eventual option, in this new world it becomes a strict requirement.

The only direct advantages of that kind of platforms are A) make developers horny, and B) double the invoiced expenses, as the time to tame them and compensate their lacks is doubled. It exists a very limited and specific realm in which those have any kind of usefulness; in all (many) others, it is a lot more convenient to keep them switched off.

Show Comments