Running the Workload Management sample

Before you run the sample, you must complete the sample setup instructions; for more information, see Setting up the Workload Management sample.

The Workload Management sample programs allow a pair of message flows (within an Integration Bus Application) to be driven as fast as they will go for a short time, using a large file. The back-end program gives an indication of the message rate being achieved by the flows. The main point of the sample is to allow you to observe how setting policies changes the rate at which the message flows invoke a back-end program. The instructions here describe how to use the sample flows in 3 ways:

  1. Without any policy in place - the backend application will indicate that the flow is going too fast.
  2. With the maximum rate set on the BAR file - the back-end application should indicate the flow is going at the rate you set.
  3. With the maximum rate set via a policy, without changing the BAR file - this should also show the flow going at the rate you set.

Try one of the following to demonstrate the sample:

Starting the back-end program

Before you run any work through the sample, you need to ensure the back-end program is running. When you import the sample, a project called Run_slow_tcpip_app is created in your Integration Toolkit workspace. This contains a batch file/shell script which will launch the back-end program from a command prompt.

To start the back-end application:

  1. Start a new command prompt.
  2. Run the mqsiprofile script from your Integration Bus runtime installation - this ensures that you have the required Java runtime environment.
  3. On Linux, ensure that you have the DISPLAY environment variable set - the backend program requires a graphical display environment.
  4. Navigate to your Integration Toolkit workspace directory where you imported the sample projects, and change into the Run_slow_tcpip_app subdirectory.
  5. On Windows, run
    slow_tcpip_app.bat 1445 10
    or on Linux run
    bash slow_tcpip_app.sh 1445 10
    to launch the back-end application. Make sure you add the parameters on the end, which are for the port (1445) and the maximum rate (10 messages per second).
  6. You should see a window appear with a counter in it.
The backend application should look like this:

A screen capture of the backend application window

Running the sample without any policy in force

The purpose of this step is to demonstrate that without a policy, the integration node will process data too fast for the back-end application. Remember that the back-end application will report warnings if it is driven at more than 10 messages per second.

A data file called WLMSample_QueryProductSalesByStores.xml is included in the same Run_slow_tcpip_app project that contains the back-end application. This contains 10000 records which should take around 1 minute to process on an average workstation. To drive the application, copy that file into the input directory you chose for your message flows in Setting up the sample. This is C:\WLMSample\fileinput on Windows, or /tmp/WLMSample/fileinput on Linux, if you have followed the suggested directory from the instructions.

You should see the counter on the backend application increase to a large number. This number indicates the message rate. The background of the window will turn red and the console window will show messages like "Going too fast" to show that the backend application is being overloaded.

As the file is processed, you will see records added to the output file which is in C:\WLMSample\fileoutput\WLMSample_OutputProductSalesByStores.xml on Windows or /tmp/WLMSample/fileoutput/WLMSample_OutputProductSalesByStores.xml on Linux. There should be 10000 lines added to that file once the data has been fully processed.

Running the sample with a hardcoded rate limit

This step shows how you can update your BAR before deployment to control workload. These instructions will show how a limit of 10 messages per second is imposed on the message flow which routes data from the file to the backend TCP/IP application.

When the sample is imported and deployed, the BAR file named WLMSample_ProductSales.bar is deployed. This BAR file does not include any overrides to the default settings, so there is no workload limit imposed.

You can override a property on the WLMSample_Producer message flow in the BAR editor to impose a Maximum Rate of 10 messages per second. To show this:

Once you have deployed your updated BAR file, run the same sample data file through the system as in the previous section:

  1. Ensure the back-end application is started.
  2. Take the sample data file and copy into your fileinput directory.
  3. Observe that the backend application counter starts to change, but stays at the specified maximum rate (10 messages per second) rather than exceeding it as before.
  4. Observe that the output file in the fileoutput folder starts to be written to. Check how long it takes to write the 10,000 output records to the file (it should take 1000 seconds or about 13 minutes).
You can experiment with setting different rate limits on the BAR file.

Running the sample with an administrator-defined workload policy

An administrator can create policies within the Integration Registry to change flow behaviour, including controlling the maximum rate of processing. These policies are then attached to one or more message flows. These can be created via the web user interface, or via commands. On the command line, a policy is defined via an XML file and loaded into the Integration Registry with a command, then attached to the flow you want to control. See Configuring a policy for more details.

To apply a workload management policy to the Workload Management sample via commands, do the following:

  1. Locate the sample Workload policy from the Integration Bus (runtime) component installation directory, under install_path/Sample/Policy/WorkloadManagement_Policy.xml. Copy the sample policy into a new file, for example WLMSamplePolicy.xml.
  2. Open WLMSamplePolicy.xml in an editor and locate the tag iwlm:maximumRateMsgsPerSec. Replace the default value (zero) with a new value, for example 20, and save your changes.
  3. Open an Integration command prompt and run mqsiprofile.
  4. Create a new policy from your new file by running the command:
    mqsicreatepolicy IB9NODE -t WorkloadManagement -l SampleWLMPolicy -f WLMSamplePolicy.xml
  5. Attach the new policy to the WLMSample__ProductSales_Producer flow to control the outbound rate to the Java application by running the command:
    mqsiattachpolicy IB9NODE -e WorkloadManagementExecutionGroup -k WLMSample_ProductSales -m WLMSample_ProductSales_Producer -t WorkloadManagement -l SampleWLMPolicy
  6. Follow the previous instructions to load the sample data file into the fileinput directory, and observe the rate at which records are sent to the Java application. This rate should match what you typed into the XML file in step 2.

You can experiment with viewing and using policies in the Web interface as well as commands. You can also attach different policies which specify a different rate, or change the policy which is already attached, and you should observe that the rate changes dynamically without the need to restart your broker. Note that values set in a policy override values which you specified in the BAR file.

If you encounter problems when you run the sample, see Resolving problems when running samples in the Integration Bus documentation.

Back to sample home