Description

The ScenarioThreadEngine is specifically designed to decrease the time it takes to execute a ScenarioChain or ScenarioChainSet by simultaneously executing multiple Scenarios within a ScenarioChain or ScenarioChainSet across multiple threads.


Please note: The ScenarioThreadEngine runs its threads in any order it chooses. Thus, only use the ScenarioThreadEngine on ScenarioChains or ScenarioChainSets, where the order in which Scenarios are executed is insignificant.  


When To Use

It would be good to thread Scenarios that contain the SegmentDataCreatorReceiver because it is used on two or more segment files (often hundreds of segment files) that are then merged into a single heavily nested document.  Here, the order in which the segment files are created is insignificant.  The ScenarioThreadEngine also checks for MergeReceivers and knows to execute a MergeReceiver only after all segment threads have been executed.


When Not To Use

It would not be a good idea to thread Scenarios that contain any SQLInsertReceiver.  Here, the order in which Scenarios are executed is significant due to the referential integrity of the data being validated on each row insertion.  


Command-Line Example Threading a ScenarioChain

   Syntax: genrocket -r ScenarioChain.grs -threaded <# of threads> 

Example: genrocket -r JSONScenarioChain.grs -threaded 10


Command-Line Example Threading a ScenarioChainSet

   Syntax: genrocket -r ScenarioChainSet.grs -threaded <# of threads> 

Example: genrocket -r EDI87PSceanrioChainSet.grs -threaded 15


How Much Faster is the ScenarioThreadEngine?

  • The following tests were run on an EDI837ScenarioChainsSet
  • The time stats also include the merge time after the segment threads have been completed
  • The merging of the segments is not currently threaded
  • The hardware specs on which the test was run are the following
    • Processor - 4 GHz Quad-Core Intel Core i7
    • Memory - 16 GB 1867 MHz DDR3
    • Storage - 1 TB SSD 


Test Run 1000

The following tests generated 1,000 EDI837I documents using 1, 10, 15, and 20 threads.

  • genrocket -r EDI87ISceanrioChainSet.grs -tdc EDI837ILoadCases.gtdc:Load.load1000 -threaded 15


Number Of ThreadsExecution Time
14 Minutes 12 Seconds
101 Minute 45 Seconds
151 Minute 34 Seconds
201 Minute 31 Seconds


Test Run 10000

The following tests generated 10,000 EDI837I documents using 1 and 20 threads.

  • genrocket -r EDI87ISceanrioChainSet.grs -tdc EDI837ILoadCases.gtdc:Load.load10000 -threaded 20


Number Of ThreadsExecution Time
153 Minutes 20 Seconds
2023 Minute 50 Seconds