cancel
Showing results for 
Search instead for 
Did you mean: 

How to Implement Load Balancing in SAP CAP Node.js on BTP?

fabi2295
Explorer
0 Kudos
334

What are the steps to implement load balancing for a Node.js application using SAP Cloud Application Programming (CAP) on SAP BTP to ensure high availability and avoid service downtime during high traffic flows, so that no service becomes unavailable or overloaded?

View Entire Topic
Beyhan
Product and Topic Expert
Product and Topic Expert

yes, the Cloud Foundry platform has a routing component which distributes the requests to an app instances by default in round robin algorithm. Additionally, I would recommend you to check the High Availability at Platform and Application Level section in the SAP BTP help portal. 

fabi2295
Explorer

Incredible, I got it. I ran some tests, and it's indeed balancing automatically. I also enabled the autoscaler with the CPU configuration so that when it reaches 5%, it adds another instance.

Test: I triggered a script that makes 4 * 10,000 calls to the service, and it automatically added or removed instances based on CPU usage.

Config:

{
	"instance_min_count": 1,
	"instance_max_count": 5,
	"scaling_rules": [
		{
			"metric_type": "cpuutil",
			"breach_duration_secs": 60,
			"threshold": 5,
			"operator": ">",
			"adjustment": "+1"
		},
		{
			"metric_type": "cpuutil",
			"breach_duration_secs": 60,
			"threshold": 5,
			"operator": "<",
			"adjustment": "-1"
		}
	]
}

 

3 CPU's

fabi2295_0-1742231551349.jpeg