At line 1 changed 1 line. |
How to generate random test data for your database. |
!!How to generate random test data for your database. |
At line 3 changed 1 line. |
The same system that was designed to handle 100 users will sometimes not work for 1,000 or 10,000 users. |
[dbMonster|http://dbmonster.kernelpanic.pl/] is a tool which helps database application developers with tuning the structure of the database, tuning the usage of indexes, and testing the application performance under heavy database load. dbMonster generates as much random test data as you wish and puts it into SQL database. I used dbMonster to add several thousand users to appfuse to test how it will impact performance, especially displaytag peformance. |
At line 5 changed 1 line. |
dbMonster is a good program for adding data to your system so you can simulate how it will function in production. |
%%(color: blue)''What I really love about this system is that it allows me to fill my system with data to see how it would perform with 10,000 to 1 million users.''%% |
At line 7 added 2 lines. |
---- |
|
At line 11 added 2 lines. |
%%(color: blue)'' |
I found it easiest to run dbMonster with ant on my system. I'm using Windows XP and cygwin. dbmonster-core was extracted to f:\tools\dbmonster-core-1.0.3 and dbmonster-ant-1.0.1.jar was saved to f:\tools\monster\''%% |
At line 14 added 1 line. |
Create 2 new directories inside of dbmonster-core-1.0.3 called config and schema. |
At line 11 changed 2 lines. |
{{{ |
<project name="dbmonster task example" default="gendb" basedir="."> |
__mkdir config__\\ |
__mkdir schema__ |
At line 14 changed 31 lines. |
<property file="build.properties"/> |
|
<!-- setup classpath --> |
<path id="dbmonster.classpath"> |
<fileset dir="${dbmonster.ant}"> |
<include name="*.jar"/> |
</fileset> |
<fileset dir="${dbmonster.home}"> |
<include name="**/*.jar"/> |
</fileset> |
</path> |
|
<taskdef |
name="dbmonster" |
classname="pl.kernelpanic.dbmonster.ant.DBMonsterTask" |
classpathref="dbmonster.classpath"> |
</taskdef> |
|
<target name="gendb"> |
<dbmonster |
config="${dbmonster.config}/dbmonster.properties" verbose="true"> |
<fileset dir="${dbmonster.schemas}"> |
<include name="*.xml"/> |
</fileset> |
</dbmonster> |
</target> |
</project> |
|
}}} |
|
|
Create a file called dbmonster.properties inside of the config directory you just made. |
At line 46 removed 8 lines. |
dbmonster.home=/tools/dbmonster-core-1.0.3 |
dbmonster.ant=/tools/monster |
dbmonster.config=/tools/dbmonster-core-1.0.3/config |
dbmonster.schemas=/tools/dbmonster-core-1.0.3/schema |
}}} |
|
|
{{{ |
At line 33 added 2 lines. |
Next you want to map the schema of the tables that you want to generate data for. To do this, you will make a new file called appfuse-schema.xml. This example will allow you to generate 1500 new users at a time. If you want more you can run the application more than one or change ''rows="1500"'' in the file below. |
|
At line 121 added 64 lines. |
|
|
!!Configure Ant |
|
You should put your build.properties and build.xml in the same directory that dbmonster-ant-1.0.1.jar is at. |
|
Here are the contents of build.properties. |
|
{{{ |
dbmonster.home=/tools/dbmonster-core-1.0.3 |
dbmonster.ant=/tools/monster |
dbmonster.config=/tools/dbmonster-core-1.0.3/config |
dbmonster.schemas=/tools/dbmonster-core-1.0.3/schema |
}}} |
|
|
Here is the build.xml file. |
|
{{{ |
<project name="dbmonster task example" default="gendb" basedir="."> |
|
<property file="build.properties"/> |
|
<!-- setup classpath --> |
<path id="dbmonster.classpath"> |
<fileset dir="${dbmonster.ant}"> |
<include name="*.jar"/> |
</fileset> |
<fileset dir="${dbmonster.home}"> |
<include name="**/*.jar"/> |
</fileset> |
</path> |
|
<taskdef |
name="dbmonster" |
classname="pl.kernelpanic.dbmonster.ant.DBMonsterTask" |
classpathref="dbmonster.classpath"> |
</taskdef> |
|
<target name="gendb"> |
<dbmonster |
config="${dbmonster.config}/dbmonster.properties" verbose="true"> |
<fileset dir="${dbmonster.schemas}"> |
<include name="*.xml"/> |
</fileset> |
</dbmonster> |
</target> |
</project> |
|
}}} |
|
---- |
|
!!Run Ant |
|
After you have done the above, make sure your database is started and try running __ant__. If all goes well you should see the following. Try starting appfuse and looking at all the new data. |
|
__That was easy!:__ |
%%(color:green) |
|
BUILD SUCCESSFUL\\ |
Total time: 12 seconds%% |
|
---- |