rwloadsim

The RWP*Load Simulator

The RWP*Load Simulator is a tool developed by the Real World Performance group at Oracle Corporation. While it on one side nicely fills the somewhat void space between the Oracle database, Linux scripting, and programming in e.g. C or Java, it also bridges a bit of the way into complex benchmarking tools.

If you ever had a need to do any of these:

and you found the standard sqlplus tool to be too limited and found that writing a full application in e.g. Java, C++ or Python to be too complex, you are likely to find rwloadsim to suit you well.

If you think of a bit of bash and SQL, a dose of PL/SQL, a nip of C or Java, a fragment of Oracle Call Interface, a dash of awk, a grain of sed plus a few drops of secret sauce and put it all into one tool, you will have an idea about what rwloadsim is. In its core, it is a programming language that takes a bit of each of these known tools and programming languages and integrates them into one.

A Users guide is available below and a Reference manual is available after installation using rwlman and online at refman/README.md.

Small examples

As a very small example, this code will display rows from the EMP table that you probably have used before. You need one file that has database credentials (that need to be correct), called rwltest.rwl:

# This is used for testing - it should point to a valid schema
database rwltest username "rwltest" password "{password}" 
  # connect "//host/service:dedicated" 
  default;

If the following then is in a file called emp.rwl

# Include the database
$include:"rwltest.rwl"

# and some variables
integer empno, deptno:=10, numemps:=0; $useroption:deptno
string ename;

# and a sql statement:
sql selemps
  select empno, ename from emp where deptno=:1;
  define 1 empno, 2 ename; # As it is a query, define the select list elements
  bind 1 deptno; # Bind the single placeholder to a variable
  array 10; # Set an array size
end;

for selemps loop # Execute a cursor loop
  printline empno, ename; # print something to stdout
  numemps := numemps + 1; # count the number of rows
end loop;

if numemps=0 then # If there were no rows, print a message
  printline "No employees in department", deptno;
end if;

You can execute rwloadsim --deptno=20 emp.rwl and you will get a list of employees in department 20.

Another example (with many details left out) of a simulation is:

# Database under test, use a session pool sized between 2 and 5
database testdb username ... ... sessionpool 2..5;
# And a similar one for awr generation
database testsystem username "system" ... ... sessionpool 1;

# Declare procedures that implement three simulated business functions:
# They would each contain sql statements and some procedural logic
procedure make_order() ... ... end;
procedure search_product() ... ... end;
procedure ship_order() ... ... end;
# Pick either procedure randomly with some percentage probability
random procedure array simulate_business
( make_order 25, seach_product 55, ship_order 20);

# Run an actual simulation for 300 seconds
run
  # Start 30 threads doing the business simulation
  threads 30 at testdb 
    for
      every erlang2(0.2) # simulate 5 per second arrival rate
      stop 300 # finish after 300 seconds
    loop
      simulate_business(); # Randomly execute some business function
    end loop;
  end threads;
  # Start 1 thread doing awr
  threads 1 at testsystem
    integer begsnap; # Variable to save initial snapshot id
    wait 5; begsnap := beginawr();
    wait 290; endawr(begsnap);
  end;
end;

If you run something like this using rwloadsim, the following will happen:

The RWP*Load Simulator comes complete with a users guide that you can read a bit further down, reference documentation that is available after install by typing rwlman or online at refman/README.md, a set of simple demos to get you started (including one like the example above), a few scripts to measure Oracle Net performance, and a complete oltp workload that is ready to put your Oracle database under test. The latter is vaguely similar to Swingbench.

It is important to understand that rwloadsim is not a general purpose application programming environment; it is a scripting and workload simulation tool. If you attempt using it beyond its design goals, you will quickly observe limitations. As just one example, there is a complete lack of a graphical interface, and the only reason you can get html pages with graphics out of it is that you can write code that generates html and code that calls gnuplot.

You should typically start with a binary distribution (found at Github releases), but you can also build it from sources or just look the sources to get under the hood. It is written in C with use of flex and bison. It is strongly recommended that you also have gnuplot and that you have a place to put html files such that you can view them from a browser.

Getting the RWP*Load Simulator

The tool is available at https://github.com/oracle/rwloadsim where you will find both sources and binary distributions.

RWP*Load Simulator users guide

Introduction

Basic concepts

Using the rwloadsim program

Samples, public utilities and files, workloads

Advanced features

RWP*Load Simulator reference manual

The reference manual is distributed as a large number of pages that are very similar to ordinary UNIX man-pages; the are available after installation of the tool and online at refman/README.md. There is a single shell script, rwlman, that is used rather than the ordinary man command, to display these. As a starting point, simply type

rwlman