The report engine can be started as a daemon to which 4GL applications can connect to
process reports. One ore more engines can be started on the same machine or on a different machine,
hence distributed mode.
Distributed mode offers two advantages:
- Vastly faster processing for short documents: The startup time of the JVM that is incurred for
every report in regular mode can exceed the processing time of the report causing the overall
performance to be poor. In “distributed” mode the JVM is started up and initialized only once. For
report batches the improvement in performance is dramatic (A test has shown an increase by factor 24
so that a 500 file PDF batch completed in 17 seconds rather then in 7 minutes).
- Improved scalability: Formatting graphical reports is CPU intensive. However CPU is usually
expensive on the server optimized for IO that is running the DVM and/or the database. The
distributed mode allows offloading the report processing entirely to another, very much cheaper,
machine such as a standard PC. Such a dedicated report formatting PC could be installed with Windows™ which has the additional advantage of handling fonts
and printers in a user friendlier way.
Start the Genero Report Engine daemon
The daemon is invoked by calling the script $GREDIR/bin/greportwriter with the
“–l” option:
C:\Program Files\FourJs\Genero Studio\fgl>envcomp
C:\Program Files\FourJs\Genero Studio\fgl>cd ..\gre\bin
C:\Program Files\FourJs\Genero Studio\gre\bin>greportwriter –l 6500
Connect to a daemon using the reporting API
The API function
fgl_report_configureDistributedProcessing is used to select and
configure distributed processing. It takes two parameters, hostname and port, that denote the server
to use. This code shows an example for a GRE daemon running on the local machine (host
“localhost”):
IF NOT fgl_report_loadCurrentSettings("OrderReport.4rp") THEN
...
END IF
...
CALL fgl_report_configureDistributedProcessing("localhost",6500)
RETURN fgl_report_commitCurrentSettings()
This example connects to a daemon running on the server
“PrintServer”:
IF NOT fgl_report_loadCurrentSettings("OrderReport.4rp") THEN
...
END IF
...
CALL fgl_report_configureDistributedProcessing("PrintServer",6500)
RETURN fgl_report_commitCurrentSettings()
Logging in Distributed Mode
If the GREDEBUG environment variable is set, the daemon logs messages of the
specified level to the file gre.log in the home directory of the user invoking
the daemon.