I am now writing a node.js socket application.
As it involves some CPU intensive tasks, it would be quite troublesome for multi-connections tasks.
Here is what the problem is: Let task A be the CPU intensive tasks, it is invoked by connection A. Let task B be the very lightweight tasks, it is invoked by all other connections, let say, > 10k connections.
When connection A invokes a lot of task A "nearly at the same time" (which is normal in my design, as every packet is needed to be processed). The tasks will be scheduled like this:
Task B cannot interrupt in the middle of task A tasks. So most likely, other users cannot do anything on this node.js server.
Except threading/cluster ,are there any ways to reschedule the tasks executed like this, make task A has the lowest priority?
Thanks!
There is some possibilities: