Simple auto scaling logic for software scalling

Here in this post i will list sample code(not exact code but more like pseudo code) to explain how auto scaling components works. We can use this logic in scalable load balancers to take decisions based on number of requests. 

required_instances =  request_in_fly / number_of_max_requests_per_instance;
if (required_instances > current_active_instance)
{
    //This need scale up
    if(required_instances < max_allowed)
     {
       spwan_inatances( required_instances - current_active_instance );
       wait_sometime_to_activate_instances();
     }
    else{
     //Cannot handle load
    }
}
else
{
    //This is scale down decision
    if(required_instances > min_allowed)
    {
      terminate_inatances( current_active_instance - required_instances );
      wait_some_time_to_effect_termination();
    }
}

No comments:

Post a Comment

Empowering the Future of API Management: Unveiling the Journey of WSO2 API Platform for Kubernetes (APK) Project and the Anticipated Alpha Release

  Introduction In the ever-evolving realm of API management, our journey embarked on the APK project eight months ago, and now, with great a...