Install and Setup Guide from Tarball

This document assumes some familiarity with setting up Ruby on Rails. If you have never set up rails before, you may need to do some web searching if you get stuck in any of the steps.


Olio is a macro-level toolkit consisting of the following components:

  1. The web application

  2. The main database

  3. Distributed storage servers (NFS)

  4. An optional caching server (memcached)

  5. Geocoder emulator

  6. Workload driver

If your primary interest is in setting up the application alone, you need items 1-3 above and they can all be setup on a single system. If on the other hand, you would like to drive load against the application, you will need at least 2 systems. At higher loads, you may need multiple systems. At a minimum, we need to separate the SUT (System Under Test) components and the non-SUT components to get valid results. The non-SUT components are the Geocoder emulator and the workload driver. It is best to connect the driver machine to the SUT machine on a local private network. This ensures that latencies measured do not include arbitrary delays.

For a horizontally scaled workload, or to measure the performance of the individual components, you can deploy the SUT components on separate physical or virtual machines. Keep in mind though that the bulk of the CPU is consumed in the web application tier (e.g. nginx/rails).

In the following sections, we will go over the steps needed to configure each component :

Extracting the Contents

The Olio/Rails kit is packaged as a gzipped tar file. The first task is to unzip the file and untar it to extract it's contents. Because of the long pathnames, please use GNU tar to extract. This is the default tar on Linux but on Solaris, use '/usr/sfw/bin/gtar'.This can be done as follows:

# tar -xvzf olio-rails-<version>.tar.gz                  (on Linux)
# gzcat apache-olio-rails-<version>.tar.gz | gtar xvf -  (on Solaris)

This will cause a directory named olio-rails-<version> to be created whose contents should look like:

# ls apache-olio-rails-0.2*

LICENSE OlioDriver.jar geocoder.war rails_setup_kit.html

NOTICE RELEASE-NOTES-rails-0.2.txt oliorails/ release

We will use $OLIO_HOME to designate the name of this directory. A description of the contents follows :

Setting up the Driver

Even if you don't plan to drive load against the application, this setup is required as the database and file loaders are part of the workload driver - feel free to install the driver on the same system as the web application.

  1. See http://faban.sunsource.net/docs/guide/harness/install.html for Faban installation instructions. Note that faban needs to be installed in the same location on all the machines used for the test. Please also read the Getting Started Guide to get a high-level understanding of Faban terminology and how it works. From now on, we will refer to the faban install directory as $FABAN_HOME.

  2. Install the required Faban services:

    You need the ApacheHttpdService if you plan to use apache to proxy your rails servers. The OlioDriver includes services for nginx and thin and these will automatically be deployed in the next step.
  3. Copy $OLIO_HOME/OlioDriver.jar to the $FABAN_HOME/benchmarks directory. Also copy the OlioDriver.jar file to the $FABAN_HOME/benchmarks directory on the system that will run the rails application.

  4. For the driver to work, you will need JDK 1.6. Set JAVA_HOME to the path of the JDK in the faban user's environment.

  5. Start the faban master on the master driver machine : $FABAN_HOME/master/bin/startup.sh

  6. Test that you can connect to the master by pointing your browser at http://<driver_machine>:9980.

  7. Download MySQL Connector/J (JDBC Driver for MySQL) and install the jar in the $FABAN/benchmarks/OlioDriver/lib directory.

Installing the Web Application

Required Software

The web application is a Rails application. It requires the following components:

  1. A web server such as Nginx, Lighttpd or Apache (the instructions below focus on nginx). This server will be used as a reverse proxy to the rails servers.

  2. Ruby 1.8.6 or higher with the following gems and their dependencies :

  1. FreeImage (which needs to be downloaded and built)

  2. MySQL 5 (5.1 recommended)

Additional Installation Steps

For Linux (debian or ubuntu), the following command can be used:

     aptitude install build-essential subversion ruby1.8 ruby1.8-dev nginx libmysqlclient-dev rubygems libgems-ruby1.8

For OpenSolaris:

CONFIG["LDSHARED"] = "/usr/sfw/bin/gcc -G"

     gem install mysql --with-mysql-lib=/usr/mysql/lib/mysql --with-mysql-include=/usr/mysql/include

     gem install rake rails thin rcov will_paginate image_science

Nginx Configuration

Once you have the application stack installed, follow the steps below to set up the application.

  1. Decide where you want to install the web application. For this example we will use /var/app:

    $ mkdir /var/app
    $ cd /var/app
  2. Copy the contents of $OLIO_HOME/oliorails to /var/app/olio. We will use $APP_DIR to refer to the location: /var/app/olio

  3. Now edit nginx.conf. There is an example in the $APP_DIR/etc directory. If you're using a single machine and you're using root as the user, you can copy the file to the nginx 'conf' directory. For OpenSolaris, comment out the error_log and pid entries. The default location for these files is in /var/nginx/logs.

    To change user to another user, modify the first line and change user root; to your preferred user. On OpenSolaris, the default user is usually webservd.

The nginx.conf has a section named upstream thin that contains a list of the server and port numbers of the rails application servers that will host the application. If you have more than one machine hosting your thins or if the applications are located on a different machine to Nginx, modify this section and add the addresses and port numbers of your application servers.

    Change the location of the application static content by editing the following entry :

     #### Replace with the full path to your rails app's public directory:
     root /var/www/virtual/example.com/rails/railsapp/public;

     root $APP_DIR/public;
# replace $APP_DIR with whatever value you used

    You may need to increase the number of open file descriptors allowed when running at larger scales. You can do this by using the command ulimit -n 10240.

    Do NOT start nginx yet.

Setting up the Database

  1. If you plan to run MySQL on a separate machine, install MySQL on that system. We will refer to the MySQL installation directory as MYSQL_HOME.

  2. Setup the mysql user/group and permissions for it's directories:

    # groupadd mysql
    # useradd -d $MYSQL_HOME -g mysql -s /usr/bin/bash mysql
    # chown -R mysql:mysql $MYSQL_HOME
  3. Create the database :

    # su - mysql
    $ cd bin
    $ ./mysql_install_db
  4. A sample my.cnf file is included in $APP_DIR/etc/my.cnf. This will work with both MySQL 5.0 and 5.1. Copy it to /etc/my.cnf and edit it to add the location of innodb_data_home_dir and innodb_log_group_home_dir. The default values for these parameters is the MySQL data directory. Start the mysql server.

    $ ./mysqld_safe –defaults-file=/etc/my.cnf &
  5. Set the root password. Substitute your own password for pwd (we typically use adminadmin)

    $ ./mysqladmin -u root password pwd
  6. Create the olio user and grant privileges:

     $ ./mysql -u root -p pwd
    mysql> create user 'olio'@'%' identified by 'olio';
    mysql> grant all privileges on *.* to 'olio'@'%' identified by 'olio';

    In some cases the wildcard '%' does not work reliably as a substitution for all hosts. You need to grant the privileges to 'olio'@'<hostname>' individually, where hostname is localhost, the name of the database system and any other names that are used to access the database system.

  7. Create database:

    mysql> create database olio;
  8. In the web application directory, go to the config directory. Copy database.yml.template to database.yml and edit it to set the hostname running the database.
  9. Create database schema from the rails application :
    cd $APP_DIR; rake db:migrate

Loading the Database

It is best to load the database manually the first time so that we can test the web application. However, while doing performance tests, the load driver can be configured to automatically re-load the database before the run.

  1. Login to the machine running the Faban master driver. Only this machine has the loader at this time.

  2. Go to the directory containing the loader script:

    # cd $FABAN_HOME/benchmarks/OlioDriver/bin
  3. Ensure the script has execute permissions. Faban takes care of this for the runs, but since we have not yet started the first run, we will need to change that ourselves:

    # chmod +x dbloader.sh
  4. Run the loader script:

    # ./dbloader.sh <dbserver> <load_scale>
    You can start small with a SCALE of 50 for initial testing.

Setting up the Filestore

Olio can be configured to use a local filesystem or network file systems such as NFS. You will need about 50GB of space for the data, as the data does grow over runs. Using a single spindle does work but may create performance bottlenecks. We recommend striping the filesystem across at least 3 spindles to avoid such bottlenecks. A local file system needs to be setup on the same machine as the web application. A network file system can reside on a separate server but needs to be exported and mounted on the web application.

  1. Create a directory (or mount a filesystem) designated for storing the image and binary files. This directory is referred to as $FILESTORE. Any valid name for the OS should be fine. Ensure that everyone has read and write access to it:

    # mkdir -p $FILESTORE
    # chmod a+rwx $FILESTORE
  2. Now load the filestore. You should have the $FABAN_HOME/benchmarks/OlioDriver.jar file on this system.

    # JAVA_HOME=<java_install_dir>; export $JAVA_HOME
  3.       # cd $FABAN_HOME/benchmarks; mkdir olio
    # cd olio; jar xvf ../OlioDriver.jar; chmod a+x bin/*

    # $FABAN_HOME/benchmarks/olio/bin/fileloader.sh <load_scale> $FILESTORE
    This loads files for use for up to load_scale number of concurrent users.
  4. In $APP_DIR/public/, create a symbolic link from uploaded_files to $FILESTORE.
    # ln -s $FILESTORE uploaded_files

Setting up the Geocoder Emulator

The Geocoder Emulator is a simple servlet deployed on Tomcat. It is typically run on a driver machine. The following steps describe how to install it :

  1. Donwload and install Tomcat (from http://tomcat.nginx.org) on the driver machine. The install directory doesn't matter - we will refer to it as $TOMCAT_HOME.

  1. Copy $OLIO_HOME/geocoder.war file to $TOMCAT_HOME/webapps.

  1. Start Tomcat using $TOMCAT_HOME/bin/startup.sh.

  1. Go to $APP_DIR/config. Edit the file environment.rb and change 'localhost' in Geolocation.url = '...' to the actual hostname where the geocoder emulator is running.

Setting up Caching

The application can run with no caching, rails caching or caching in memcached. These options are set in config/environment.rb as follows :

# Set CACHED = true to turn on caching (rails or memcached)
CACHED = false
# Set MEMCACHED to true if using memcached
# Set hostname of memcache server (only one server supported at this point)
CACHE_SERVER = 'localhost'

If using memcached, the server needs to be setup :
  1. Download and install memcached on the system you plan to use.

  2. Start memcached : “memcached -u mysql &”

Testing the Web Application

      $ cd $APP_DIR
$ chmod a+x bin/*thin
$ bin/start_thin 4

Starting a Performance Test

Now that we know that the web application is running and the faban harness is up, it is time to kick off a test.

  1. Point your browser at http://<driver_machine>:9980

  2. Click on the Schedule Run link.

  3. Under the JAVA tab, set the JAVA_HOME. You can accept the default value for JVM options. DO NOT click on the OK button yet!

  4. Select the Driver tab.

  1. Select the Web Server tab.

  2. Select the Data Servers tab.

  3. That's it. Click OK and the run should be scheduled. You can click on the View Results link on the left to monitor the run.