We are working on server-less solutions in Azure and using a lot of Node.js functions to connect to Atlas.
It’s turned out that we have “connections” problem. Let me explain what is the problem:
Every time when a new function instance is fired up by Azure, we need to fire up a connection to Atlas and then function become active, let’s say for 5 min. Then a new a new function instance generates and a new connection is needs to be created.
But then in our Test environment we’ve got 14000 connections very quickly, we were very supersized.
By looking at the performance for this solution, we realized it would be much more efficient to create one Atlas connection and use it across all node.js function instance withing one microservice.
We have done some research and it’s turned out that the same problem happened in AWS cloud, when people use Lambda functions.
We have found this article: https://docs.atlas.mongodb.com/best-practices-connecting-to-aws-lambda/ and as a best practice it’s recommended to use “callbackWaitsForEmptyEventLoop”. But the problem that we can’t find analog in Azure functions.
Can someone please help us?