Delay in processing messages in local NodeJS server

Hi All,

I see that in the local NodeJS cloud code, all the incoming messages from the Particle cloud is handled by putting the handler function (routeMessage) into the event loop queue via the process.nextTick call. Is there a delay set in processing the request?

We have implemented our own CoAP message type that is handled along with other communication messages between the device to NodeJS. We send these messages at 10HZ frequency from each Photon device and we have 22 of the connected and sending to a single NodeJS instance (220 requests per second). We have used PM2 to load balance the NodeJS instance. But we see that the messages are not handled well and there is huge queue of events emitted for handling the requests. Requests are handled very late due to the increasing queue and at times, the NodeJS stops accepting new connections.

Has anyone faced this issue before? Any ide how to solve this? We are running the local NodeJS server on an 8GB, 4-core machine.