<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 08/25/2016 06:01 AM, Arshad Ansari
wrote:<br>
</div>
<blockquote
cite="mid:CABzi3tvgdF5zmqRYb94zwV+pNhQ3q0fHqAttQ-=fX5iK5_nz9Q@mail.gmail.com"
type="cite">
<div dir="ltr">Hello there,
<div><br>
</div>
<div>I had earlier asked about how to access LuaJIT from erlang
[<a moz-do-not-send="true"
href="http://erlang.org/pipermail/erlang-questions/2016-August/089939.html%5C">http://erlang.org/pipermail/erlang-questions/2016-August/089939.html</a>]
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.</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
</div>
</blockquote>
You can use CloudI (<a class="moz-txt-link-freetext" href="http://cloudi.org">http://cloudi.org</a>) to handle more throughput
with the Lua code using minimal latency. A Lua CloudI API doesn't
currently exist but a basic SWIG file can create a Lua CloudI API
based on the C CloudI API (using
<a class="moz-txt-link-freetext" href="https://github.com/CloudI/CloudI/blob/develop/src/api/c/cloudi.i">https://github.com/CloudI/CloudI/blob/develop/src/api/c/cloudi.i</a>).
However, keep in mind that any usage of an Erlang Port type is
limited to roughly 30-55k req/s and this issue is not a high
priority for the Erlang/OTP team
(<a class="moz-txt-link-freetext" href="https://bugs.erlang.org/browse/ERL-140">https://bugs.erlang.org/browse/ERL-140</a>). For comparison, pure
Erlang messaging can go beyond 100k req/s.<br>
<br>
Best Regards,<br>
Michael<br>
<br>
</body>
</html>