"accept" and socket read/write

Richard Gaskin ambassador at fourthworld.com
Thu Feb 12 10:55:01 EST 2015


Peter TB Brett wrote:

 > On 2015-02-12 02:02, Richard Gaskin wrote:
 >> Phil Davis wrote:
 >>> As it stands right now, the engine is single-threaded so there's no
 >>> distributing of anything to other cores within a single instance of
 >>> your application. As for the future, I can't address that.
 >>
 >> If Mark Wieder would be kind enough to add forking to the Server
 >> engine we could pass socket connections to child processes, and build
 >> our own NgineX.
 >
 > Tum-ti-tum... *hums innocently*
 >
 >                                      Peter
 >
 > P.S. 8

Is there a build of v8 that allows OS API calls available?

Once it is, it'll be nice to have Mark Wieder use it to write all my 
code for me. :)

More seriously, I haven't yet used fork() in any language so I recognize 
my thinking is prone to unrealistic optimism, but in what little reading 
I've done it doesn't seem the most complicated thing anyone's ever done, 
so once I get a v8 build that will let me explore that and a little time 
on my hands between client work I'm anxious to see what could be done 
with that.

In the meantime, thinking about this some more last night it occurs to 
be that a similar solution might be had using a forwarding load balancer 
to map subdomains to different LC instances. This way the main instance 
running on a root domain www.domain.com could forward clients to 
w1.domain.com or w2.domain.com or w32.domain.com, with worker instances 
handling the individual requests for the relatively low cost of an extra 
forward.

This may still be unrealistic optimism, but my monitoring of the 
resource load of LC server instances shows most of mine running with 
between 2 and 4 MBs RAM, so even on a cheap VPS with just 1 GB RAM you 
could comfortably have more than 50 workers running simultaneously.

All that's a lot of work, though, and given the expectations of browsers 
for the full HTTP 1.1 spec I wouldn't recommend building a complete Web 
server in LC.

Once we get a version of LC that can fork we can craft a FastCGI 
solution that'll work well with not only Apache and Litespeed but NginX 
as well.

But for other socket servers using a custom protocol, I don't think it's 
unrealistic to be able to solve the C10k problem with LiveCode and a 
little R&D time.

Very exciting prospect.  I wish I had a problem big enough to need such 
a solution.  Anyone here building a MMORPG?

-- 
  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