[erlang-questions] How to manage C ports that are suppose to handle a very high number of requests

Taavi Talvik taavi@REDACTED
Thu Aug 25 17:05:43 CEST 2016

Maybe something like poolboy is useful for you:


best regards,

> On 25 Aug 2016, at 16:01, Arshad Ansari <arshadansari27@REDACTED> wrote:
> Hello there,
> I had earlier asked about how to access LuaJIT from erlang [http://erlang.org/pipermail/erlang-questions/2016-August/089939.html] and based on the responses, I decided to go with C port. It was working all great. Except, when I tried to call the same C-Port [luajit] code from erlang-diameter server. Since the requests were high, but not very high (approx 10K per second), the code fails with stack overflow on c side.
> Now I thought, I would create a seperate C port for each requests but that would mean there will be around 10K c-port processes. I'm now wondering how to handle this size of requests from the c port. Any help or direction is appreciated. Please let me know if my question is not clear. I'm attaching the code to access lua that works with single instance of c-port process.
> Regards
> Arshad
> /************ CODE Details *********************/
> erl_com.c contains code to send/receive data from c side
> port.c runs the lua code and has main
> script.lua 
> relay.erl starts the relay server and c port to talk to lua
> relay_cb.erl handles requests and communicates with lua
> <script.lua><relay.erl><relay_cb.erl><node.erl><port.c><erl_comm.c>_______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

More information about the erlang-questions mailing list