Configuration for autoscaling
You can configure the parameters that are required for autoscaling in the
rseapi.env
file. The configuration is shared by the primary server and overflow
servers. For the changes to take effect, restart the server.
Enable autoscaling
The autoscaling feature is disabled by default. To enable it, set these two parameters to
true
:
RSEAPI_REDIRECT_ENABLE=true # Default to false
RSEAPI_OVERFLOW_ENABLE=true # Default to false
Enable validating available resource
To validate available resource when handling incoming requests at a server, set
RSEAPI_REDIRECT_ENABLE
to true
. When enabled, the server checks
against its threshold setting when it accepts a new request. If the threshold is reached, the
request will be forwarded to an overflow server if it is configured; otherwise, it will be
denied.
Enable forwarding requests
To enable a server to forward a request to an overflow server in the overflow autoscaling
mechanism, set RSEAPI_OVERFLOW_ENABLE
to true
.
RSEAPI_REDIRECT_ENABLE=true
is a prerequisite for enabling
RSEAPI_OVERFLOW_ENABLE
. You must set RSEAPI_REDIRECT_ENABLE=true
for RSEAPI_OVERFLOW_ENABLE
to be effective.
Specify the limit threshold
To specify the expected capacity of a server instance including user session and thread count, which is based on system and process configuration, set the following parameters:
#RSEAPI_MAX_USERS=50 # Default to 50
#RSEAPI_MAX_THREADS=1200 # Default to 1200
Define the overflow chain of servers
n
, call it server n
,
use the parameter RSEAPI_OVERFLOW_FOR_n
to specify the server number of its direct
overflow server. For example, RSEAPI_OVERFLOW_FOR_n=m
denotes server
m
is the direct overflow server of server n
.- Server
n
is defined withRSEAPI_HTTP_PORT_n=<port_number>
, andSERVER_NUM=n
, orSRVNUM
used in the server started task. - The port of all overflow servers must be defined per their server number.
- To assign a specific JMON port for server
n
, use the corresponding parameterRSEAPI_JMON_PORT_n
. For example,RSEAPI_JMON_PORT_n=3800
. If it is not set, the default JMON port from the base configuration will be used for this server.
The defined direct overflow server can have its own direct overflow server. Continue to define its direct overflow to form the overflow chain until the last overflow server.
Primary 1 (P1) -> 2 -> 3 -> 4
RSEAPI_OVERFLOW_FOR_1=2
RSEAPI_OVERFLOW_FOR_2=3
RSEAPI_OVERFLOW_FOR_3=4
RSEAPI_PORT_HTTP_1="4082"
RSEAPI_PORT_SHUTDOWN_1="4083"
RSEAPI_PORT_HTTP_2="4091"
RSEAPI_PORT_SHUTDOWN_2="4092"
Other optional configurations
- It is optional to check thread count or memory usage. To skip the check, set the following
parameters. They default to
false
if not set.#RSEAPI_SKIP_THREADS_CHECK=true #RSEAPI_SKIP_MEMORY_CHECK=true
- Initially, when checking the port status of its overflow server, if the overflow port is used by
another application, the server turns off the autoscaling feature. To enable a recheck of overflow
server status, set the following parameter to
true
. It defaults tofalse
if not set.#RSEAPI_OVERFLOW_PORT_IN_USE_RECHECK=true
- After restarting an overflow server, the server will wait for some time before checking the
overflow server for its readiness to accept requests. Use this parameter to specify the time in
millisecond that the server should wait before starting the check. The default is
3000
milliseconds.#RSEAPI_OVERFLOW_SPAWN_WAIT_MSEC=3000
- When a server estimates that it needs its overflow server, for example when its resource usage
reaches a certain threshold level, it will check the status of its overflow server. The check can be
done by placing a status checking request to the overflow server. If the direct overflow server is
not up, the server will start it up.
The active status of the overflow server is cached. When the cache is expired, the server will issue the status checking request to the overflow server for a live update. Use the following parameter to set the expiration time for the cache. The default is 2 minutes.
#RSEAPI_OVERFLOW_CHECK_MINUTE=2