Question

Nodejs app platform event loop

I currently have a few apps deployed on app platform with NodeJS, some are microservices while others are more front-end.

My question is, how does app platform handle the event loop and traffic.

For example.

App 1 is a crud type app, lets say we are running 2 ‘apps’ for this application, so essentially there are ‘2’ event loops.

Question being, how does app platform know what ‘app’ to send the request to, in regards to what event loop has less in the que? Generally speaking the event loop is not clogged up, but I have noticed sometimes that a ‘request’ may take longer to return the results, leading me to think something is blocking the event loop or there is some congestion there but the odd thing is, there was only one other user at the time of testing, but two ‘apps’ running?

The only thing I can think of is the router may only be looking at resource consumption and because container 1 had low CPU / Memory, it just sent traffic to the same ‘app’ however that app may have more hanging around in the event loop then the idle app.

I hope that make sense, I’m trying to wrap my head around that and how the routing is actually working. I feel like the router should be sending traffic to the instance that has the least connections or traffic to ensure proper balancing but I’m not sure if that is the case.


Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
June 11, 2022

Hi there,

The load balancing that comes with the App Platform is a built-in part that can’t be configured.

It is distributing incoming requests evenly across all containers that pass a health check and are tasked with providing capacity to your service.

Hope that helps!

- Bobby.