Skip to content

Commit

Permalink
Add documentation of new environment variables (#259)
Browse files Browse the repository at this point in the history
Document SR_THREAD_COUNT and SR_MODEL_TIMEOUT environment variables and update default thread count to 4.
[ committed by @billschereriii  ]
[ reviewed by @ashao  @mellis13 ]
  • Loading branch information
billschereriii authored Jun 10, 2022
1 parent da06abc commit 3d239fb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
19 changes: 19 additions & 0 deletions doc/runtime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ The functions for changing this default behavior are:
The function ``Client.use_model_ensemble_prefix()`` controls
object prefixing for model and script data.

Model Execution Environment Variable
====================================

The ``SR_MODEL_TIMEOUT`` environment variable defines a timeout
on the length of time SmartRedis will wait for a model to
execute. The value for this variable is measured in milliseconds,
and the default value is one minute.

Connection and Command Execution Environment Variables
======================================================

Expand All @@ -130,3 +138,14 @@ The user can set these environment variables to adjust command execution behavio
``SR_CMD_TIMEOUT`` should be specified in seconds. Note that ``SR_CMD_INTERVAL``
and ``SR_CMD_TIMEOUT`` are read during client initialization and not
before each command execution.

The environment variable ``SR_THREAD_COUNT`` is used by SmartRedis to determine
the number of threads to initialize when building a worker pool for parallel task
execution. The default value is four. If the variable is set to zero, SmartRedis
will use a default number of threads equal to one per hardware context in the
processor on which the library is running (more specifically, SmartRedis will
use the result of a call to std::thread::hardware_concurrency() as the number
of threads to create). This default will generally give good
performance; however, if the SmartRedis library is sharing the processor hardware
with other software, it may be useful to specify a smaller number of threads for
some workloads.
4 changes: 1 addition & 3 deletions include/redisserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -559,10 +559,8 @@ class RedisServer {

/*!
* \brief Default number of threads for thread pool
* (zero, special value that translates to one
* per hardware context)
*/
static constexpr int _DEFAULT_THREAD_COUNT = 0;
static constexpr int _DEFAULT_THREAD_COUNT = 4;

/*!
* \brief Seeding for the random number engine
Expand Down

0 comments on commit 3d239fb

Please sign in to comment.