User:Allen Kerensky/Environment Variables

= Environment Variables = Archived here from [Test Page] to prevent disappearance.

MONO_THREADS_PER_CPU
By default, OpenSimulator only recognizes one shell environment variable: MONO_THREADS_PER_CPU

If this variable is set in your shell before starting OpenSimulator, it will allow you to control the number of threads Mono will host per CPU.

The proper setting for this variable somewhat subject to religious interpretation.

Common recommendations including bumping it up to around 100 on many OpenSim installations.

Others have recommended numbers as high as 2048.

This article on Threadpool Deadlocks may help.

Using shell environment variables in OpenSim configuration
We will need to use two new things in our configurations: a section [Environment] to tell us what variables we need to look at in the shell and we will need to use the Nini key expansion. Nini, can have keys that look like ${SECTION|VARIABLE} and can expand those to the variables we assign.

In your shell you will export your values and check the ones you want to use that are predefined by your system ...

In the ini you will include an [Environment] section...

When OpenSim picks up the variables in your shell and processes all the configurations, the variable keys will be filled in with the variables picked up from the shell ...

This is a pretty good start. I think there will be a couple of places we might be able to use this to help us setup really flexible configuration systems for OpenSim.

Have Fun!