Developing Apama Applications > Developing Apama Applications in EPL > Implementing Parallel Processing > Samples for implementing contexts > Simple sample implementation of contexts
Simple sample implementation of contexts
In your Apama installation directory, in the samples\monitorscript\contexts directory, there are two versions of a simple application. One version implements serial processing and the other implements parallel processing. Open the analyse-parallel.mon and analyse-serial.mon files in Apama Studio to compare the implementations.
To run the applications, execute run-sample.bat on Windows or run_sample.sh on UNIX. The script runs the serial application and then the parallel version.
On a 2.4GHz Quad core Intel Q6600 machine, the serial implementation completes in about 63 seconds, while the parallel implementation completes in about 17 seconds. For an equivalent dual-core processor, you can expect the parallel implementation to complete in about 30 seconds.
Look at serial-results.evt and parallel-results.evt to compare the results. While the per-symbol output for each implementation is identical, the ordering of sent events for different symbols is different. Also, in the parallel implementation, there is more variation in the time taken to process all events for one symbol. The sample uses eight worker contexts — each context is doing much the same work, but on different segments of the data. While it is not required, an application that has eight contexts typically working most of the time benefits from running on an 8-core host. You can expect an 8-core processor to run the sample parallel implementation more than seven times faster than it runs the serial implementation.
Copyright © 2013-2015 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.