Scaling Management Server
The Flexify IO Management Server accepts several environment variables that can be used to fine tune performance or scale the management server depending on the needs.
Default settings should suffice for most environments, but if you have over 20 engines, 100 endpoints/migrations, or 50 simultaneous users, you may need to scale and change some options to achieve desirable response time.
Performance-related environment variable
SERVER_TOMCAT_MAX_CONNECTIONS
Default value: 1000
Recommended value: max simultaneous engines + users * 3
Defined the maximum number of incoming connections the management server will accept and keep. Keep in mind that engines and web browsers keep connections once it’s established, even if no requests in-flight at the moment.
If the value is too low, some client may wait for the connection to become available, taking long time to send the request, appear hanging or time out.
SERVER_TOMCAT_THREADS_MAX
Default value: 10
Recommended value: depending on management server App Service or VM size
Defines the number of threads that can process requests simultaneously.
Because some threads uses two database connection, the value of SERVER_TOMCAT_THREADS_MAX should be at least two times lower than SPRING_DATASOURCE_HIKARI_MAXIMUMPOOLSIZE. Otherwise threads will wait for connections negatively affecting performance.
If the number is too low, client requests will wait in a queue for a long time before being processed, i.e. it will take long time to process requests, and management server CPU usage will be much below 100%.
If the number is too high, too many client requests will be processed at the same time, overwhelming CPU and taking long time, but the management server CPU usage will be at 100%.
Generally, if CPU/DTU is saturated, we recommend setting this parameter to the value that results in CPU/DTU usage at around 90% under normal load. It will make requests take a little longer, but will allow room for long requests.
SPRING_DATASOURCE_HIKARI_MAXIMUMPOOLSIZE
Default value: 30
Recommended value: SERVER_TOMCAT_MAX_THREADS * 2 + 10
Flexify management server will establish this number of connection to the SQL Server. Connections from this pull will be used by management server threads to serve request or run internal tasks.
If the value is too low, threads will wait for connection to be returned to the poll, limiting concurrency and increasing response time. If no connection is returned to the pull within 5 seconds (default), operation will fail with the connection is not available error.
To accommodate for updates (when two instances run at the same time), SPRING_DATASOURCE_HIKARI_MAXIMUMPOOLSIZE parameter value should at least two times less than the "Max concurrent workers" value for a given Azure SQL tier.
If the value is too high, the number of Azure SQL Server concurrent workers might be exceeded. See https://learn.microsoft.com/en-us/azure/azure-sql/database/resource-limits-dtu-single-databases to check the Max concurrent logins limit depending on the SQL Server tier and DTU.
SPRING_DATASOURCE_HIKARI_CONNECTIONTIMEOUT
Default value: 5000 (ms)
Recommended value: 5000 in production and 250 in test
Defines how long management server thread will wait for a connection to be returned to the pull is the entire pool is used. With recommended configuration, the there will always be unused connections in the pool, and this timeout should never trigger.
Troubleshooting
Insufficient management server CPU
Symptoms:
All requests take too long to complete, and
Management server CPU usage is near 100%, and
Azure SQL Server DTU usage is much below 100%
Solutions:
Scale up the App Service Plan of VM, or
Scale out the App Service Plan, or
Increase polling intervals on the engines or web console.
Insufficient SQL Server DTU
Symptoms:
All requests take too long to complete, and
Management server CPU usage is much below 100%, and
Azure SQL Server DTU usage is near 100%
Solutions:
Scale up Azure SQL Server Database, or
Increase polling intervals on the engines or web console.
Insufficient management server simultaneous connections
Symptoms:
First request takes a long time to complete, but other requests on already established connection are fast.
Both CPU and DTU usage is below 100%
Solution:
Increase SERVER_TOMCAT_MAX_CONNECTIONS.
Insufficient management server threads
Symptoms:
Requests take too long to complete, and
Management server CPU usage is much below 100%, and
Azure SQL Server DTU usage is much below 100%.
Solution:
Increase SERVER_TOMCAT_MAX_THREADS.
Too many management server threads
Symptoms:
High-resource-consuming requests take too long time, and
Management server CPU is near 100%
Solution:
This happens because such requests have to share CPU with too many parallels requests. Decrease SERVER_TOMCAT_MAX_THREADS. Short requests will take longer, and long requests will complete faster.
Insufficient SQL connections pool
Symptoms:
500 Internal Server errors on the Web Console, engines logs or clients, end
Error in the management server log
ERROR | HikariPool-1 - Connection is not available, request timed out after 10010ms
Solutions:
Increase
SPRING_DATASOURCE_HIKARI_MAXIMUMPOOLSIZE, orDecrease
SERVER_TOMCAT_MAX_THREADS.