You are designing a solution for a startup company, the proposed solution is like this You suggest they use ECS instances to process requests from mobile App clients, and use SLB to distribute data traffic and ensure the load across each backend ECS instance is balanced.
Moreover to deal with volatile fluctuations in business volume (page views are much higher on the weekends), you also suggest they use Auto Scaling to dynamically increase or reduce computing resources.
The company is satisfied with the solution you proposed. However, they have one concern that when removing an idle instance from the scaling group: if Auto Scaling shuts the instance down directly, the service running on that instance will be abruptly terminated, resulting in poor user experience.
In order to eliminate your customer's concern, which of the following solutions should you recommend them?
- Find the ECS instance that is going to be removed from the backend server pool of the SLB instancer and automatically set the weight of this ECS instance to 0. This instance will not be assigned with new requests, and will be automatically removed from the backend server pool after existing tasks are completed.
- First, insert a script into the image for creating the ECS instance Second, make the script run automatically when the operating system in this ECS instances is about to shut down. This script contains the processing logic that can ensure the instance finish all the remaining tasks before shutting down.
- Find the ECS instance that is going to be removed from the backend server pool of the SLB instance, and manually remove this instance from the backend server pool Applications running on this ECS instance will normally return results, but this instance will not be assigned with new requests.
- Use the Lifecycle Hook function embedded m Auto Scaling Define a suitable timeout and a web hook to do the necessary work before the instance is removed.
Answer(s): D
Explanation:
According to the Alibaba Cloud Auto Scaling documentation1, the Lifecycle Hook feature allows you to perform custom operations on instances that are added to or removed from a scaling group. You can define a lifecycle hook to specify a timeout period and a web hook URL.
When an instance is about to be removed, Auto Scaling sends a notification to the web hook URL and waits for a response. During the timeout period, you can perform the necessary operations on the instance, such as gracefully shutting down the service, backing up the data, or sending a custom notification. After the operations are completed, you can send a response to the web hook URL to confirm the removal of the instance. This way, you can ensure that the instance is removed without affecting the user experience or causing data loss. Therefore, option D is the best solution to eliminate the customer's concern.
Reference:
Lifecycle hooks and Alibaba Cloud Auto Scaling.
Reveal Solution Next Question