Skip to main content
Windward

Windward Multithreaded Performance Analysis Java Sample

Overview

This sample is a complete distribution of the Windward Reports Java Engine that will run reports in a multithreaded capacity.

Description

The purpose of this example is to give code that enables a user to run a multithreaded test in their native environment to get a true benchmark of how Windward will perform.  The general rule taken into account when determining the maximum number of threads to run simultaneously is to never exceed more than double the number of available CPU cores.  For example if the target system has 2 physical chips that are dual core then there are actually 4 cores available.  This would mean that a maximum of 8 threads should be utilized.  The number of threads used is calculated in RunBatchReport.java with the following code.  It queries the host operating system for the total number of cores and multiplies it by 2.

// how many threads to run (generally 2X the number of processors)

final int NUM_THREADS = rt.availableProcessors() * 2;

Sample Analysis

System​ 2 core system - 2 Gb RAM​ ​8 core system - 32 Gb RAM​
​Memory ​2 GB ​​32 GB
​Processor ​2 cores - 2.80 GHz ​8 cores - ​2.27 GHz
​Number of Threads ​4 ​16
​Output Type ​PDF ​PDF
​Number of Reports Generated ​10,000  ​10,000
​Total Number of Pages ​10,000 ​​10,000
​Total Time ​16 minutes 8.32 seconds ​6 minutes 53.31 seconds
Pages Per Second ​~ 10 pages/second ​~ 24 pages/second
​Memory Used ​13.57 MB ​2.38 GB

Running the code

  • Download and extract the ZIP file to a directory on your system.  Windward assumes that java is included in your path and is globally available to call from anywhere on the system.  If this is not the case please extract to a place where Java is available or add the java command to your local path.
  • Open a command prompt and navigate to the directory where you extract your files
  • Update the WindwardReports.properties file with a valid license key on the license= line in that file.
  • Run run.bat as follows for a simple test to ensure the engine is running.  This will run the sample template and data source to create PDF output consisting of one file starting with rpt.
    • PROMPT>run.bat PDF 1
  • Next open run_all.bat and adjust for the performance metrics you wish to test on the target system.  Adjusting the last 2 parameters defines the OUTPUT_TYPE and NUMBER_OF_REPORTS_TO_CREATE​
  • Run run_all.bat to start the test

 

This was run on a 2 core system producing 300 PDF reports.  Elapsed time was 1 minute 12.745 seconds

File List

JAR files native to the Windward Reports Java Engine - 17 total
  • bcmail-jdk14-138.jar
  • bcprov-jdk14-138.jar
  • bctsp-jdk14-138.jar
  • commons-codec.jar
  • commons-lang-2.5.jar
  • dom4j-1.6.1.jar
  • iText-2.1.7.jar
  • iTextAsian.jar
  • jaxen.jar
  • jcommon.jar
  • jfreechart.jar
  • log4j.jar
  • poi.jar
  • relaxngDatatype.jar
  • WindwardCustomFunctions.jar
  • WindwardReports.jar
  • xsdlib.jar
  •  
​Java code for calling the RunReport process via multiple threads
  • RunBatchReport.java
  • ThreadReport.java

 

CLASS files
  • RunBatchReport.class
  • ThreadReport.class

 

Samples template and data source
  • 2009 Manufacturing Report - Template.docx
  • 2009 Manufacturing Report - Data.xml

 

Batch files that run the entire process
  • run.bat - deletes all files starting with rpt* and call java RunBatchReport accepting the following paramters: TEMPLATE_NAME XML_FILENAME OUTPUT_TYPE NUMBER_OF_REPORTS_TO_CREATE
  • run_all.bat - calls run.bat and passes in the last 2 parameters OUTPUT_TYPE NUMBER_OF_REPORTS_TO_CREATE

Additional Information on Windward Multithreaded Code

(Tens of) Pages per Second, not Seconds per Page - Blog article expanding on the code sample about and detailing how performance is achieved.​
  • Was this article helpful?