Why is node.js faster than LC server?

Richard Gaskin ambassador at fourthworld.com
Tue Dec 5 12:55:59 EST 2017


Andre Garzia wrote:

 > Some other languages support full threads and some even allow you to
 > fork().

Can you describe what you mean by fork() here?  In a discussion a while 
back I made reference to an earlier post you'd made about fork(), but 
the response from the engine team left me with the impression that it's 
merely the way processes launch other processes.  Of course we can 
launch processes right now in LC, so clearly there's something here I'm 
missing (forgive the naivete of the question; I'm only halfway into 
Robert Love's Linux System Programming).


 > ## THE ENGINE POOL ##
 > I believe it was Richard who did this, can't recall, it was definitely
 > not me. Keep a pool of engines running, lets say 20, use a node
 > balancer to round robin them.

I'm sure there are others, but I can recall three people who've 
experimented with this sort of multiprocessing: Pierre Zahores, Mark 
Talluto, and myself.

My own explorations were very superficial.  I spent more time looking 
into how much could be gained by maxing async behavior with callbacks 
within a single LC process (because of course there's no point spawning 
multiple instances of an inefficient process <g>).  I used the Raney 
mchttpd stack as a starting point, updated to send proper modern headers 
so it can be used with browsers made after 1999 <g>, and revised to use 
callbacks for all reads/writes.

The TL/DR (I was testing delivery of static files rather than DB access, 
so the comparison was with Apache2):

    The bad news is that even a slender HTTPd in LC was only slightly
    more than half as fast as Apache2.

    The good news was that a slender HTTPd thrown together in a couple
    hours in LC scripts was more than half as fast as the highly-
    optimized C written by a team of specialists in Apache2! :)

<http://lists.runrev.com/pipermail/use-livecode/2016-February/223363.html>

My takeaway was that, as nice as it is to get pretty good results from a 
scripting language like LC, if I actually need scalable multiprocessing 
it's better handled by teams/apps specializing in that.

You may find some of Pierre's posts in that thread interesting.

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com




More information about the Use-livecode mailing list