# Configuration

RPooli is pool of R nodes, exposed over RMI and managed over a RESTful API.

## Overview

RPooli configuration files follow the .properties file format. You can read more information about the format here.

RPooli is configured by three distinct configuration files that represent three configuration domains:

• R/Rj nodes configuration, including the R code snippet to be run for each new node that is created,
• Pool configuration, including size and time-outs,
• Network configuration, including the host and port of the RMI registry.

RPooli loads these files from a detected configuration directory, which is the first file system path that exists and is a directory in the following list:

• /etc/rpooli
• ~/.rpooli
• /WEB-INF , in the web-app work dir
• the OS temporary directory

The last option is obviously a non-production grade fallback.

If any of these configuration files is missing, RPooli will use default values and will be able to start anyway.

All the configuration domains of RPooli can be modified via its API. When a configuration domain is modified via the API, the corresponding .properties file is generated and persisted in the file system, at the location where they were initially loaded from or, if none pre-existed, at the detected configuration directory.

## Examples

Here are examples of the three configuration files as well as detailed information on the properties that can be set in these files.

### R/Rj nodes configuration

The rconfig.properties file allows to control starting up nodes in the RPooli pool. An example configuration is given below and can be downloaded here.

    #
# Rpooli R/Rj Configuration Example
#
r_home.path=/usr/lib/R
java_cmd.args=-server
r_startup.snippet=library(RSBXml)\r\nlibrary(RSBJson)
debug_verbose.enabled=false
debug_console.enabled=false
node_cmd.args=
startstop_timeout.millis=30000


The different fields that can be set in the rconfig.properties file are:

• r_home.path: path to the R home directory; if you want to know what that directory is for a particular R installation you can issue the R.home() command in an interactive R session;
• java_cmd.args: extra arguments passed to the Java command that starts up the RPooli pool
• r_startup.snippet: R commands that will be executed whenever a node in the pool is started up; this can
e.g. be used to preload certain packages to save time when actual requests are being processed;
• debug_verbose.enabled: boolean to indicate whether verbose debugging output needs to be generated;
• debug_console.enabled: boolean to indicate whether a debug console needs to be enabled;
• node_cmd.args:
• startstop_timeout.millis: value in milliseconds after which the starting of nodes will timeout.

### Pool configuration.

The behaviour of the pool of R processes can be set in the poolconfig.properties file. An example configuration is given below and can be downloaded here.

    #
# RPooli Pool Configuration Example
#
max_wait.millis=3000
min_idle.millis=600000
max_total.count=20
eviction_timeout.millis=1800000
max_idle.count=10
min_idle.count=1
max_usage.count=100


The poolconfig.properties file allows the following fields to be set:

• max_wait.millis
• min_idle.millis
• max_total.count: the maximum total number of nodes that can be running in the pool;
• eviction_timeout.millis:
• max_idle.count: the maximum number of nodes that can be idling in the pool;
• min_idle.count: the minimum number of idle nodes that needs to be running in the pool;
• max_usage.count: maximum number of times a node can be used before it is shut down and restarted.

### Network configuration

The network configuration for the RPooli pool can be set in the netconfig.properties file An example configuration is given below and can be downloaded here.

    #
# RPooli Network Configuration Example
#