Overview of the Load Generator Utility

The load generator is a simple utility provided by Oracle Complex Event Processing (or Oracle CEP for short ) to simulate a data feed. The utility is useful for testing the EPL rules in your application without needing to connect to a real-world data feed.

The load generator reads an ASCII file that contains the sample data feed information and sends each data item to the configured port. The load generator reads items from the sample data file in order and inserts them into the stream, looping around to the beginning of the data file when it reaches the end; this ensures that a continuous stream of data is available, regardless of the number of data items in the file. You can configure the rate of sent data, from the rate at which it starts, the final rate, and how long it takes the load generator to ramp up to the final rate.

In your application, you must use the Oracle CEP-provided csvgen adapter, rather than your own adapter, to read the incoming data; this is because the csvgen adapter is specifically coded to decipher the data packets generated by the load generator.

To use the load generator, follow these steps:

Optionally create a property file that contains configuration properties for particular run of the load generator; these properties specify the location of the file that contains simulated data, the port to which the generator feeds the data, and so on.

Oracle CEP provides a default property file you can use if the default property values are adequate.

Be sure that you configure a builder factory for creating your event types. Although specifying event type builder factories is typically an optional task, it is required when using the load generator.

Change to the ORACLE_CEP_HOME\ocep_10.3\utils\load-generator directory, where ORACLE_CEP_HOME refers to the main Oracle CEP installation directory, such as d:\oracle_cep.

Run the load generator specifying the properties file you created in step 1 to begin the simulated data feed. For example, if the name of your properties file is c:\loadgen\myDataFeed.prop, execute the following command:

prompt> runloadgen.cmd c:\loadgen\myDataFeed.prop

If you redploy your application, you must also restart the load generator.

Creating a Load Generator Property File

The load generator uses an ASCII properties file for its configuration purposes. Properties include the location of the file that contains the sample data feed values, the port to which the utility should send the data feed, and so on.

Oracle CEP provides a default properties file called csvgen.prop, located in the ORACLE_CEP_HOME\ocep_10.3\utils\load-generator directory, where ORACLE_CEP_HOME refers to the main Oracle CEP installation directory, such as d:\oracle_cep.

The format of the file is simple: each property-value pair is on its own line. The following example shows the default csvgen.prop file; Oracle recommends you use this file as template for your own property file:

If you create your own properties file, you must include the test.packetType, test.mode, test.senders, test.latencyStats, and test.statInterval properties exactly as shown above.

In the preceding sample properties file, the file that contains the sample data is called test.csv and is located in the same directory as the properties file. The load generator will send the data feed to port 9001.

The following table lists the additional properties you can set in your properties file.

Table 11-1 Load Generator Properties

Property

Description

Data Type

Required?

test.csvDataFile

Specifies the file that contains the data feed values.

String

Yes.

test.port

The port number to which the load generator should send the data feed.

Integer

Yes.

test.secs

Total duration of the load generator run, in seconds.

The default value is 30.

Integer

No.

test.rate

Final data rate, in messages per second.

The default value is 1.

Integer

No.

test.startRate

Initial data rate, in messages per second.

The default value is 1.

Integer

No.

test.rampUpSecs

Number of seconds to ramp up from test.startRate to test.rate.

The default value is 0.

Integer

No.

Creating a Data Feed File

The file that contains the sample data feed values correspond to the event type registered for your Oracle CEP application. The file follows a simple format:

Each item of a particular data feed is on its own line.

Separate the fields of a data feed item with commas.

Do not include extraneous spaces before or after the commas, unless the space is literally part of the field value.

Include only string and numerical (integer, long, double, float, etc) data in a data feed file.

The following example shows a sample data feed file where each item corresponds to a person with name, age, and birthplace fields:

Configuring the csvgen Adapter in Your Application

You must use the csvgen adapter in your application because this Oracle CEP-provided adapter is specifically coded to read the data packets generated by the load generator.

You register the csvgen adapter using the <wlevs:adapter> tag in the EPN assembly file of your application, as with all adapters. Use the provider="csvgen" attribute to specify that the provider is the csvgen adapter, rather than your own adapter. Additionally, you must specify the following child tags:

<wlevs:instance-property name="port" value=configured_port>, where configured_port corresponds to the value of the test.port property in the load generator property file. See Creating a Load Generator Property File.

<wlevs:instance-property name="eventTypeName" value=event_type_name>, where event_type_name corresponds to the name of the event type that represents an item from the load-generated feed.

<wlevs:instance-property name="eventPropertyNames" value=ordered_list_of_properties>, where ordered_list_of_properties lists the names of the properties in the order that the load generator sends them, and consequently the csvgen adapter receives them.

Before showing an example of how to configure the adapter, first assume that your application registers an event type called PersonType in the EPN assembly file using the <wlevs:metada> method as shown:

Note how the bolded values in the adapter configuration example correspond to the PersonType event type registration.

If you use <wlevs:class> to specify your own JavaBean when registering the event type, then the eventPropertyNames value corresponds to the JavaBean properties. For example, if your JavaBean has a getName() method, then one of the properties of your JavaBean is name.