Example Application Overview

The example application demonstrates how to use the asynchronous method calls feature. The scenario the application simulates is based on the use of Web services. In addition, the application allows you to view the effects of changing runtime parameters such as the number of workers and callers.

The above image depicts a number of worker and caller processes. The worker processes offer different services to work on for the caller processes. The caller processes are waiting for a number of external requests. Every caller process periodically receives an updated list of requests.

If a caller receives a request, the caller process sends this request to a queue. One of the worker processes takes the request from the queue and processes it.

The example application allows you to change the number of caller and worker processes, the number of different tasks per external request, the approximate time difference between every external request, the kind of tasks, and finally, an operation parameter, which enables the application to specify the type of work the worker processes perform.

The application offers four different kinds of task, as follows.

  1. Sleep

    This option enables you to enter the operation parameter in milliseconds as the duration for a process to sleep. None of the activity for the other task types occurs for this task.

  2. Calculate primes

    The worker processes utilize an inefficient algorithm to count prime numbers lower than a specified number. For this task, the operation parameter is the specified number. This is intended to be a CPU‑intensive task.

  3. Create and delete objects

    The workers create the specified number of objects in the database and then delete them all again. The operation parameter for this task is the number of objects. Each object create or delete is in its own transaction. This is intended to be an IO‑intensive task.

  4. Create and delete objects and calculate primes

    This combines the work done in task types 2 and 3, above. The operation parameter in this scenario represents the number of objects to create and delete, along with the start number to begin the descending prime number search.

The application writes a Comma‑Separated Values (CSV) file on completion, with the run times for each worker process, caller process, and for each single request.