Environment Variables

StreamBase recognizes a set of environment variables that affect the behavior of the StreamBase Server and its components. You can define StreamBase environment variables using any of the methods native to your system. Environment variables control and take precedence over certain properties defined in server configuration files (.sbconf files).

Environment variable expansion in StreamBase Server configuration files is not limited to the variables on this page. The values of all variables in the environment that starts the StreamBase Server instance can be used, as described in Using Environment Variables in the Configuration File.

The environment variables on this page affect:

  • The behavior of the next StreamBase Server instance or client you start. That is, a change in an environment variable setting does not affect a currently running server or client.

  • The behavior of clients built with the StreamBase C++ or .NET APIs. (Java API clients use Java properties instead of environment variables, as described in Java Properties.)

The environment variables are:

Notes

  • On Windows, environment variables that you explicitly set take precedence over any corresponding StreamBase keys in the Windows registry. For further information, see StreamBase Services and Registry Keys on Windows, in the Administration Guide.

  • Starting with release 5.0, the StreamBase installer does not set the STREAMBASE_HOME or PATH environment variables, to allow support for installing multiple versions of StreamBase. See StreamBase Command Prompt for details.

STREAMBASE_CODEGEN_TRACE_TUPLES

When set to true, you can use the runtime tracing features of StreamBase Server, as described in Runtime Tracing. You can make the same setting with the -Dstreambase.codegen.trac-tuples=true system property.

STREAMBASE_CRASH_HANDLER

When set to yes (the default), the StreamBase Server process can create a crash dump in the event of a segmentation fault.

STREAMBASE_CRASH_QUIET

When set to yes (the default), the StreamBase Server process can create the crash dump without having to launch a dialog box. The no setting may be appropriate in development, but should not be used in production, or when you are starting the StreamBase Server as a service.

STREAMBASE_CRASH_TRACE

Available on Linux only. If the STREAMBASE_CRASH_HANDLER value is yes (the default), STREAMBASE_CRASH_TRACE=yes causes the crash handler to print a stack trace.

STREAMBASE_DATA

Sets the directory to be used for persistent data in disk-based Query Tables (available only in StreamBase Enterprise Edition). The precedence order is:

  1. If present on the sbd command line (--datadir)

  2. STREAMBASE_DATA environment variable's value

  3. In the sbd.sbconf configuration file, the value of the datadir parameter in the server section

  4. If not specified or the special value +TEMP+ is used, a temporary directory is created on server startup and deleted on shutdown.

For more information, see Using the Query Table Data Construct to Share Data in the Authoring Guide.

STREAMBASE_HOME

Specifies the directory in which StreamBase was installed. On UNIX, set this variable before running StreamBase commands. For example:

export STREAMBASE_HOME=/opt/streambase

The recommended method to set StreamBase environment variables on UNIX, and an essential method if you use the tar.gz installation method, is to use sb-config --env, as shown in this example:

eval `/opt/streambase/bin/sb-config --env`

On Windows, before release 5.0, this and the PATH environment variable were set by the StreamBase installer. Beginning in release 5.0, StreamBase does not set these variables, because you can now install multiple versions of StreamBase on Windows. StreamBase instead provides the StreamBase Command Prompt in the Start menu. For StreamBase 5.0 and later, run StreamBase utilities and start the sbd server process from a StreamBase Command Prompt, not an ordinary Windows command prompt.

If you have a single StreamBase installation on a Windows machine, you may prefer to set STREAMBASE_HOME and PATH in the global environment with sb-config --setenv . If you have a mixed installation of StreamBase 3.x and 6.x, do not use --setenv, as explained in StreamBase Command Prompt.

The first command below sets the global environment for the currently logged-in Windows user. The second command does the same for all users.

"C:\Program Files\StreamBase Systems\StreamBase.n.m\bin\sb-config" --setenv
"C:\Program Files\StreamBase Systems\StreamBase.n.m\bin\sb-config" --setsysenv

STREAMBASE_HOME is referenced in the skeleton sbd.sbconf configuration file for the StreamBase Server. The following is an example of STREAMBASE_HOME used in sbd.sbconf:

<authentication>
     <param name="enabled" value="true"/>
     <param name="type" value="sb-password-file"/>
     <param name="filepath" value="${STREAMBASE_HOME}/etc/sbpasswd"/>
 </authentication>

STREAMBASE_LOG_LEVEL

Sets the type of messages that will be written by the StreamBase Server to the StreamBase Command Prompt window and (if enabled) a log file (Windows machines), or to syslog and stderr (UNIX machines). On Windows, the default location of the sbd.log file is:

C:\Program Files\StreamBase Systems\StreamBase.n.m\logs\sbd.log (Version 5.0 and later)

C:\Program Files\StreamBase Systems\StreamBase\logs\sbd.log (before Version 5.0)

For all platforms, the log levels are:

  • 0, the default, which shows NOTICE, WARN, ERROR and FATAL messages.

  • -1, to disable NOTICE messages and only show WARN, ERROR and FATAL messages.

  • 1, which adds INFO messages to the standard messages.

  • 2, which adds DEBUG messages.

StreamBase also provides a number of tokens that can be added to STREAMBASE_LOG_LEVEL 1 or 2 messages, to emit additional information on debug lines:

  • +time

  • +pid

  • +thread

For example, you can add the +time token to display the time when messages were produced; +pid to display the ID of the process that is displaying the message; and +thread to display the name of the thread that is displaying the message. The additional information might be useful to StreamBase Systems Technical Support.

For example, on Windows:

C:\> SET STREAMBASE_LOG_LEVEL=+time 2
   ...
(To demonstrate, we will enter a client command even though the sbd server
  has not been started yet)
   ...
C:\> sbc dequeue all
debug [2005-04-21 16:01:20.168] StreamBaseURI::getSecondaryHostPort: '' empty?
true length 0
   ...
  [all messages displayed with timestamps]
C:\> 

On UNIX, in Bash:

export STREAMBASE_LOG_LEVEL="+time 2"

Note that setting the STREAMBASE_LOG_LEVEL environment variable is useful in StreamBase Command Prompts or terminal windows. When you run sbd in background mode (-b flag), it automatically writes to the syslog instead of to stdout/stderr. In that case, you automatically get timestamps, because syslog always includes timestamps with its messages.

STREAMBASE_QUIESCENT_LIMIT

This environment variable controls how many milliseconds a C++ StreamBase dequeuing client will tolerate not receiving anything from the StreamBase Server to which it is connected. The default value is 120 seconds (120000). By default, StreamBase Servers emit client heartbeats every 10 seconds, so that StreamBase applications have no requirement to send data regularly.

StreamBase Servers can be configured to send heartbeats faster, slower, or not at all. The quiescent timer only starts after the first heartbeat is received; so if a server never sends a heartbeat, clients will not have quiescent protection.

STREAMBASE_RECONNECT_SLEEP

When designing a high availability StreamBase cluster, you can use this environment variable for clients, to set how often the client should try to reconnect to the primary or secondary machine when the connection to the server is dropped. The value is in milliseconds. The default is 5000 (5 seconds). This environment variable is useful with C++ clients. By contrast, Java clients can use the streambase.reconnect-sleep system property as described in Java Properties.

STREAMBASE_RETITLE_TERMINALS

If set to any value, StreamBase programs assign a terminal window title to match the name of the executable being run. By default, terminal titles are not affected. On UNIX, this can be helpful if you have many terminal windows open for sbd, sbfeedsim, sbc dequeue, sbmonitor, and so on.

STREAMBASE_SERVER

The URI for StreamBase Server. The default is sb://localhost:10000. You can set this environment variable if the Server is on another node or listening on another port. For example, if the Server is running on host server.example.com at port 20000, set the STREAMBASE_SERVER value as sb://server.example.com:20000. This environment variable can be read by C++ clients, adapters, and most StreamBase command-line utilities (such as sbc) to determine a non-default StreamBase Server location or port.

STREAMBASE_STUDIO_VMARGS

Specifies a list of arguments for the JVM that runs StreamBase Studio. This variable should only be necessary on rare occasions, usually under the direction of StreamBase Systems Technical Support.

Important

Using this variable overrides and replaces the default vmargs passed to Studio. If you use the variable for any purpose, you MUST include the following default values.

STREAMBASE_STUDIO_VMARGS=-Xms256M -Xmx512M -XX:MaxPermSize=256M

To use this environment variable correctly, set the default values, then add your setting at the end:

STREAMBASE_STUDIO_VMARGS=-Xms256M -Xmx512M -XX:MaxPermSize=256M -Dyour-setting

For example:

STREAMBASE_STUDIO_VMARGS=-Xms256M -Xmx512M -XX:MaxPermSize=256M \
    -Dstreambase.ide.sb-bin-directory=bin64

STREAMBASE_TCP_NODELAY

Set STREAMBASE_TCP_NODELAY to true to disable the Nagle algorithm on network connections. In addition, for Java clients, you can set the system property streambase.tcp.nodelay to true. While it is best to set STREAMBASE_TCP_NODELAY on both the client and server, setting it on the server is often more important than setting it on the client.

Note

Disabling the Nagle algorithm can improve latency characteristics, but it can also make network utilization less efficient. This may reduce the maximum throughput rates for a given network interface.

STREAMBASE_TUPLE_CONNECTION_QUIESCENT_LIMIT

When designing a high availability StreamBase cluster, you can use this environment variable in conjunction with client dequeue heartbeats to set the timeout for dequeues. The value is in milliseconds, and the default is 120000 (120 seconds). By default, StreamBase Servers emit client heartbeats every 10 seconds, so that StreamBase applications have no requirement to send data regularly. StreamBase Servers can be configured to send heartbeats faster, slower, or not at all. The quiescent timer only starts after the first heartbeat is received. Thus, if a server never sends a heartbeat, clients will not have quiescent protection.

This environment variable is useful with C++ clients. By contrast, Java clients can use the streambase.tuple-connection-quiescent-limit system property as described in Java Properties.

STREAMBASE_TUPLE_CONNECTION_TIMEOUT

When designing a high availability StreamBase cluster, you can use this environment variable for clients, to set a timeout value on reads and writes between the client and server. This timeout is used by the client to recognize failure of the server. Consider carefully when using this property. A timeout value that is too long may cause the client to hang for that period before it fails over to the other server. Too short of a value may cause the client to disconnect prematurely from the server if the server is busy. The value is in milliseconds, and the default is 15000 (15 seconds). A value of 0 disables the timeout (some operations will block forever). For further information, see Creating C++ Clients.

This environment variable is useful with C++ clients. By contrast, Java clients can use the streambase.tuple-connection-timeout system property as described in Java Properties.

STREAMBASE_USE_INTERNAL_JDK

If set to true (the default value), or if not set, StreamBase uses its internal JDK installed in streambase-install-dir/jre, and ignores any setting of the JAVA_HOME environment variable. This applies to both StreamBase Studio and StreamBase Server run independently of Studio with the sbd command.

If set to false, Studio and sbd use the external JDK defined in the JAVA_HOME environment variable. JAVA_HOME must be set to the full, absolute path to the top-level directory containing your JDK.

If set to false, but no JAVA_HOME is defined, StreamBase searches the system PATH for a JDK. If not found, StreamBase looks in standard installation locations for a JDK. If still not found, neither Studio nor sbd will start.