This SAS KB article explains how to configure the threadPoolSize parameter to control the number of threads used by Python processes.
As discussed in the “Python Scoring Engine” SAS Technical Paper, you can control the number of threads associated with the Python model by using the threadPoolSize parameter.
threadPoolSize specifies the maximum number of active Python connection threads. The default value is the larger of the number of processors that are available on the machine or twice the configured startCount.
If the value of threadPoolSize is less than the number of defined Python engines, only that number of Python engines actually connect to the controller.
As a result, you need to set the threadPoolSize configuration parameter to a value that is at least equal to the number of engines so that all engines can connect to the Python controller.
To control the number of threads used by the Python model, complete the following steps:
1. In /<SASConfig>/Lev1/Applications/SASFraudManagement/<SAS Fraud Management version>/<Auth domain>/engine/ServerN/etc/ose.xml, define the threadPoolSize parameter.
<bean id="pythonController" class="com.sas.finance.fraud.engine.python.PythonController">
<property name="config.startCount" value="${PYTHON_PROCESS_COUNT}" />
<property name="config.restartCount" value="${PYTHON_RESTART_COUNT}" />
<property name="config.serverPort" value="${PYTHON_PORT}" />
<property name="config.logDir" value="${PYTHON_CWD}" />
<property name="config.msgAPIdir" value="${MSGAPI_HOME}" />
<property name="config.threadPoolSize" value="10" />
<property name="config.socketTimeoutMillis" value="${PYTHON_SOCKET_TIMEOUT_MILLIS}" />
<property name="config.PythonTimeoutMillis" value="${PYTHON_ENGINE_TIMEOUT_MILLIS}" />
<property name="config.processBuilder.command" value="${PYTHON_CMD}" />
<property name="config.processBuilder.cWD" value="${PYTHON_CWD}" />
<property name="config.processBuilder.env">
<map merge="true">
<entry key="PYTHONPATH" value="${PYTHON_PATH}" />
<entry key="OSE_SCOREMATCH" value="" />
</map>
</property>
</bean>
2. If you want to control this value via the /<SASConfig>/Lev1/Applications/SASFraudManagement/<SAS Fraud Management version>/<Auth domain>/engine/ServerN/etc/ose.properties file, set a property name for the value in ose.xml and ose.properties.
Here is an example:
In ose.xml, set the following:
<bean id="pythonController" class="com.sas.finance.fraud.engine.python.PythonController">
<property name="config.startCount" value="${PYTHON_PROCESS_COUNT}" />
<property name="config.restartCount" value="${PYTHON_RESTART_COUNT}" />
<property name="config.serverPort" value="${PYTHON_PORT}" />
<property name="config.logDir" value="${PYTHON_CWD}" />
<property name="config.msgAPIdir" value="${MSGAPI_HOME}" />
<property name="config.threadPoolSize" value="${PYTHON_THREADPOOL_SIZE" />
<property name="config.socketTimeoutMillis" value="${PYTHON_SOCKET_TIMEOUT_MILLIS}" />
<property name="config.PythonTimeoutMillis" value="${PYTHON_ENGINE_TIMEOUT_MILLIS}" />
<property name="config.processBuilder.command" value="${PYTHON_CMD}" />
<property name="config.processBuilder.cWD" value="${PYTHON_CWD}" />
<property name="config.processBuilder.env">
<map merge="true">
<entry key="PYTHONPATH" value="${PYTHON_PATH}" />
<entry key="OSE_SCOREMATCH" value="" />
</map>
</property>
</bean>
Then, in ose.properties, set the following:
PYTHON_CWD = ${LOGS_DIR}
PYTHON_CMD = python3 -u ${PYTHON_HOME}/ose.py -v -d /<NFS mount>/Deployment_Directory
PYTHON_PATH = ${PYTHON_HOME}:${MSGAPI_HOME}:${PROTOBUF_HOME}:/usr/lib64/python3.6/:/usr/
lib64/python3.6/lib-dynload/
PYTHON_PORT = 3978
PYTHON_PROCESS_COUNT = 2
PYTHON_RESTART_COUNT = 2
PYTHON_ENGINE_TIMEOUT_MILLIS = 1000
PYTHON_SOCKET_TIMEOUT_MILLIS = 2000
PYTHON_THREADPOOL_SIZE = 10
Note: You must restart (stop/start) SAS® OnDemand Decision Engine in order for the above changes to be effective.