You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apisix.apache.org by Jinhua Luo <lu...@gmail.com> on 2023/01/18 03:12:08 UTC

[DISCUSS] Proposal: APISIX: upstream slow start support

Background:

Without slow start, APISIX proxies requests to additional upstream
nodes at a certain rate.
For applications that rely on caching, as well as JVM-based
applications, warming up without slow start may cause the freshly
started service to be overwhelmed by a large number of requests,
resulting in request timeouts, data loss, and poor user experience.

Design:

The weight updating will be done by the Control Plane master (elected via etcd).

A new field slow_start will be added to the node configuration.

Example:

{
  "host":"127.0.0.1",
  "port":1980,
  "weight":1,
  "slow_start":{
     "target_weight":10,
     "window":300,
     "weight_update_interval": 5,
     "start_timestamp":1673490556
  }
}

The unit of window and weight_update_interval is second.
When the start_timestamp + window < current_timestamp, the slow start is done.

Admin API:
- We need to handle route, service, and upstream resources.
- It only works for node configuration in the hash table.
- Add node
  - weight is set to 1 as an initial value
  - Initialize start_timestamp to the current timestamp value
- Modify node
  - Delete slow_start (would trigger the CP master to stop the slow
start processing)
    - reset the weight to the target_weightif not specified
  - Modify slow_start (would trigger the CP master to restart the slow
start processing)
    - reset start_timestamp to the current timestamp value