[erlang-questions] How to manage C ports that are suppose to handle a very high number of requests
Thu Aug 25 18:59:05 CEST 2016
On 08/25/2016 06:01 AM, Arshad Ansari wrote:
> Hello there,
> I had earlier asked about how to access LuaJIT from erlang [http://erlang.org/pipermail/erlang-questions/2016-August/089939.html <http://erlang.org/pipermail/erlang-questions/2016-August/089939.html%5C>] 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.
You can use CloudI (http://cloudi.org) 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 https://github.com/CloudI/CloudI/blob/develop/src/api/c/cloudi.i). 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 (https://bugs.erlang.org/browse/ERL-140). For comparison, pure Erlang messaging can go beyond 100k req/s.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions