I'm trying to mimic the node module to implement an asynchronous runtime for Scala Native.
I noticed that the node module can accept only two connections concurrently.
Is there a reason for that?
Can this limit change?
Ideally it should be configurable.
For example, an application like this:
const express = require('express')
const app = express()
app.get('/', (req, res) => setTimeout(function() {res.send('Hello, Unit!\n');}, 5000))
app.listen(5000)
would take ~5 seconds to serve 500 concurrent requests on normal express.
Converting it to unit it would take ~20 minutes!
This is a limitation of router-application exchange protocol. We are currently working to improve it. This required for Nodejs and Go modules too. You don't need to change your module, just wait a little :)
Tried the version 1.19.0 and it seems that the parallelism level has increased a lot! Thank you!
It is still limited and still not configurable, is there some other work planned?
There are some other work planned on each language modules (threads, asynchronous interface support etc.). If your module is similar to Nodejs or Go module, there were some changes in these modules for more effectively use specific of socket operations. Please check, maybe your module also need similar changes? Is it possible to review the sources of your module to understand the bottlenecks?
If your module is similar to Nodejs or Go module, there were some changes in these modules for more effectively use specific of socket operations.
Since the language semantics is basically based on Node.js I'm trying to copy the Node.js behaviour.
Is it possible to review the sources of your module to understand the bottlenecks?
My code isn't open source yet (I still have some cleanup to do first).
I'm referring to a Node.js express Hello world app I used to try the improvements.
After some more tests I think the parallelism level is not limited at all, when you open too many connections simultaneously it refuses some of them, but I noticed the same behaviour on vanilla express.
Please check, maybe your module also need similar changes?
Yes, I noted the add_port / remove_port interface changed a bit and I'm adapting to the changes :)
If you think all the work to be done on accepting requests concurrently, you can close this issue.
Yes, I noted the add_port / remove_port interface changed a bit and I'm adapting to the changes :)
Yes, now your module need to read from 2 ports (sockets).
The next important change is the change in nxt_uv_read_callback() - new function nxt_unit_process_port_msg() needs to be called to process message read from specific port.
I'm closing this since the problem is solved! Thank you very much 馃檹
Most helpful comment
This is a limitation of router-application exchange protocol. We are currently working to improve it. This required for Nodejs and Go modules too. You don't need to change your module, just wait a little :)