For this use case I suggest using a message broker like RabbitMQ or Google PubSub etc. In the controller you only have to insert the request body into a queue and do the processing and inserting to mongo in completely separate and scalable a worker process by subscribing to that topic.
Also if you need something really fast, check out Fastify and it's benchmarks.
For this use case I suggest using a message broker like RabbitMQ or Google PubSub etc. In the controller you only have to insert the request body into a queue and do the processing and inserting to mongo in completely separate and scalable a worker process by subscribing to that topic.
Also if you need something really fast, check out Fastify and it's benchmarks.
Yeah I thought through having a queue which will take care of this process. I'll see if I can put it in a message queue.
Regarding fastify, i'll definitely give a try.