on 2025 Mar 17 12:38 AM
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?
Request clarification before answering.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
User | Count |
---|---|
79 | |
12 | |
9 | |
8 | |
7 | |
5 | |
4 | |
4 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.