opensim: isolating virtual world data and code

for our application testing we are most of our internal grids in stand-alone mode. until last week i had been using sqlite as the underlying databases for our grids. as we gathered more and more prims on some of our regions, i noticed that loading from the sqlite databases would take more and more time — but, also and more worryingly, that overall memory usage was going up through the roof and really causing pain, resulting in daily restart :-(

so, when we managed to royally screw up our main demo grid, i decided to start from scratch and utilize MySQL as the underlying storage system — and also try to separate our configuration data from the binary and source tree.

running OpenSim on MySQL

first, we need to create an opensim database:

mysql -u root -p
myslq> create database opensim;
mysql> grant all on opensim.* to 'opensim'@'localhost' identified by 'SECRET';

next, while OpenSim.ini.example contained some hints on how to set up a mysql power OpenSim instance, it was a bit misleading in that it claimed that asset source, inventory source, and user source would only work with sqlite and nhibernate — it turns out that those also work with mysql :-)

so, here are the OpenSim settings. first in section [Startup] make sure to comment the “null” and “sqlite” storage plugin lines:

;storage_plugin = "OpenSim.Data.Null.dll"

; --- To use sqlite as region storage:
;storage_plugin = "OpenSim.Data.SQLite.dll"
;storage_connection_string="URI=file:OpenSim.db,version=3";

then — still in section [Startup] add the following lines for MySQL:1

storage_plugin="OpenSim.Data.MySQL.dll"
storage_connection_string="Data Source=localhost;Database=opensim;User ID=opensim;Password=SECRET;";

and, for the user, asset, and inventory databases in the [Standalone] section of OpenSim.ini:

asset_plugin = "OpenSim.Data.MySQL.dll" ; for mysql
asset_source = "Data Source=localhost;Database=opensim;User ID=opensim;Password=Op3nS1m;"

inventory_plugin = "OpenSim.Data.MySQL.dll"
inventory_source = "Data Source=localhost;Database=opensim;User ID=opensim;Password=Op3nS1m;"

userDatabase_plugin = "OpenSim.Data.MySQL.dll"
user_source = "Data Source=localhost;Database=opensim;User ID=opensim;Password=Op3nS1m;"

this configuration will drive OpenSim from MySQL now. next we need to take care of our region files, they should not live in OpenSim’s bin directory anymore.

moving Regions

if you take a closer look at the example configuration file OpenSim.ini.example you’ll find the config variable regionload_regionsdir — setting this to point to the directory where are going to keep our region XML files will cause OpenSim to use that directory instead of bin/Regions!2

starting OpenSim

all you need to do now is to write a shell script that invokes OpenSim and provides the location of the OpenSim.ini file via the -inifile=/path/to/OpenSim.ini command line parameter.

done.


  1. obviously, you are going to change “SECRET” to a password of your choice… 

  2. yes, you might have tried that and found that stuff like the create-region console command or the admin_create_region XmlRpc call did not really know about that configuration variable, resulting in a nice little OpenSim crash — well, fear not, we’ve fixed that now :-)