Hacker News new | past | comments | ask | show | jobs | submit login

I build Lua programs in prod. I use fennel or moonscript as the frontend, and everything runs on openresty (cli tools using resty and servers using the full stack).

Parallelism is enabled by a data flow architecture on top on nginx workers (compare TPL Dataflow in C# or Intel TBB in C++).

Concurrency is enabled using coroutines (nginx threads). It's virtually impossible to write blocking code and that's without any async or other bs in sight.

It's really fcking fast. Like, some parts of the overall arch are rust, but in the real, io bound world there's virtually no speed difference. Of course safety is good. But you get types and other neat zero cost abstractions for Lua using Haxe.

This Dataflow architecture also benefits from openresty built in concurrency safe queues, maps etc with atomic commit and cross worker access. Everything feels so damn effortless. I didn't have to do any work on making it scale. Just tweak the number of workers knob and boom, almost linear benefit. That's for rust and Lua, both awesome at parallelism in this case.

Anyway, even though I never write pure Lua, I still think it should have won against python (man did we try, even riding that ML wave).

I'm in love, but me is not many.

What sort of queueing mechanism do you use? I’ve bee trying to get into OpenResty but there are few documented examples of that kind of thing, and anything that does Dataflow is interesting to me.

Bidirectional queues are built-ins in openresty[1]. The scheduler is project-specific and uses that.

[1] - https://openresty-reference.readthedocs.io/en/latest/Lua_Ngi...

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact