11. Tuning, Monitoring and Dashboard

11.1. Tuning

11.1.1. Number of processes

A plugin is able to run multiple processes simultaneously.

You may change the number of process allocated for each step of each plugin. In order to configure this number of processes, add or update the numprocesses parameter in the [step….] section of the config.ini plugin configuration file, e.g.:

# Number of process allocate to the step. Default value is 1
numprocesses = 3

11.1.2. Resource limits

You are able to control resource limits for each app workers of a plugin by setting the following parameters in the [app....] section of the config.ini plugin configuration file, e.g.:

# resource limit for each app worker
# rlimit_as => maximum area (in bytes) of address space which may be taken by the worker.
# rlimit_nofile => maximum number of open file descriptors for the current worker.
# rlimit_stack => maximum size (in bytes) of the call stack for the current worker.
#     This only affects the stack of the main thread in a multi-threaded worker.
# rlimit_core => maximum size (in bytes) of a core file that the current worker can create.
# rlimit_fsize =>  maximum size of a file which the worker may create.
# (empty value means no limit)
rlimit_as = 1000000000
rlimit_nofile = 1000
rlimit_stack = 10000000
rlimit_core = 100000
rlimit_fsize = 100000000

For further information about Linux resource limits, check Linux documentation.

11.1.3. Nginx tuning an rate limiting

You are able to act on Nginx tuning parameters: refer to the [nginx] section of the config/config.ini file of the MFSERV module (in the root directory of the MFSERV user).

Nginx server allows you to limit the amount of HTTP requests a user can make in a given period of time.

You can easily implement this feature by setting your plugin configuration for this purpose.

In order to understand the ‘Nginx Rate limiting’ and learn how to implement it in your plugin, read this MetWork Implement a MFSERV plugin with rate limiting.

11.1.4. Advanced settings

Some advanced settings are available for each application. Check the [app....] section of the config.ini plugin configuration file, e.g.: extra_nginx_conf_filename, extra_nginx_conf_static_filename

11.1.5. Miscellaneous

You are able to act on others tuning parameters for each app of a plugin.

# If set then the process will be restarted sometime after max_age and
# max_age + random(0, max_age) seconds.
# 0 => disable this feature
# Note: the feature is automatically disabled if workers=1
# Note: 60 seconds is a minimum
max_age = 3600

# The number of seconds to wait for a process to terminate gracefully before killing it.
# When stopping a worker process, we first send it a SIGTERM.
# A worker may catch this signal to perform clean up operations before exiting
# like finishing to reply to already accepted requests.
# If the worker is still active after graceful_timeout seconds, we send it a
# SIGKILL signal. It is not possible to catch SIGKILL signals so the worker will stop.
graceful_timeout = 30

11.2. Monitoring and Dashboards

See also

MFADMIN Documentation
mfadmin:mfadmin_monitoring_plugins.

11.2.1. Monitor a plugin

Through Metwork MFADMIN module, you may monitor the MFSERV plugins: refer to the related MFADMIN topic.

11.2.2. Dashboards

Time-series dashboards are available from MFADMIN Grafana GUI Interface.

Logs dashboards, i.e. mflog logs and Nginx access logs are available from MFADMIN Kibana GUI Interface.

You may also create your own dashboards: refer to the MFADMIN topic documentation.