If you run Pentaho Data Integration (PDI / Kettle) jobs via kitchen.sh or pan.sh, you may notice that startup latency has steadily increased across modern releases. A basic CLI invocation can take over 10 seconds just to initialize the JVM and load dependencies before processing a single row. By eliminating network reverse-DNS stalls and pruning unused heavy-weight plugins, you can cut CLI startup time down to ~1.2 seconds.
Benchmark: Startup Degradation Over Time
Measuring cold startup latency using a minimal test job (time ./kitchen.sh -file=test.kjb):
| PDI Release Phase | Real Time (Wall Clock) | User Time (CPU) |
|---|---|---|
| Legacy Lightweight Releases | 0.49s – 1.10s | 0.78s – 2.14s |
| Early Modular Releases | 5.97s – 34.11s | 3.86s – 18.86s |
| Modern Default Installations | 11.25s – 12.43s | 26.17s – 28.83s |
| Pruned & Optimized Build | 1.25s | 3.23s |
Step 1: Eliminate Hostname & Reverse DNS Lookups
When user CPU time is significantly lower than real clock time, Kettle is idling on network I/O timeouts trying to resolve the local machine's hostname.
- Explicitly define the hostname: Add
KETTLE_SYSTEM_HOSTNAME=localhostto your~/.kettle/kettle.propertiesfile. - Map the local hostname in
/etc/hosts: Ensure your current machine hostname points directly to127.0.0.1to prevent remote DNS lookups. - Force IPv4 Resolution: Pass
-Djava.net.preferIPv4Stack=trueinto your Java options insidekitchen.shorspoon.shto bypass IPv6 reverse-lookup timeouts:PENTAHO_DI_JAVA_OPTIONS="-Djava.net.preferIPv4Stack=true -Xms512m -Xmx2048m"
Step 2: Prune Unused Heavyweight Plugins & OSGi/Karaf Runtimes
Kettle scans and initializes OSGi bundles, Karaf runtimes, Mondrian models, and Big Data shims on every CLI run. If your workflow only uses standard database, text, or transform steps, you can safely remove these subsystems.
Files and Folders to Move Out
Move the following directories, descriptors, and unused engine/driver JARs into a backup location outside your PDI installation directory:
# Move OSGi, Karaf, and Mondrian system runtimes
mv system/karaf /path/to/pdi-backup/
mv system/mondrian /path/to/pdi-backup/
mv system/osgi /path/to/pdi-backup/
# Move heavy plugins
mv plugins/pentaho-big-data-plugin /path/to/pdi-backup/
mv plugins/kettle*-log4j-plugin /path/to/pdi-backup/
mv plugins/pdi-xml-plugin /path/to/pdi-backup/
# Move lifecycle descriptors
mv classes/kettle-lifecycle-listeners.xml /path/to/pdi-backup/
mv classes/kettle-registry-extensions.xml /path/to/pdi-backup/
# Move unused engine, spark, and platform JARs from lib/
mv lib/mondrian-*.jar /path/to/pdi-backup/
mv lib/org.apache.karaf.*.jar /path/to/pdi-backup/
mv lib/pdi-engine-api-*.jar /path/to/pdi-backup/
mv lib/pdi-engine-spark-*.jar /path/to/pdi-backup/
mv lib/pdi-osgi-bridge-core-*.jar /path/to/pdi-backup/
mv lib/pdi-spark-driver-*.jar /path/to/pdi-backup/
mv lib/pentaho-capability-manager-*.jar /path/to/pdi-backup/
mv lib/pentaho-connections-*.jar /path/to/pdi-backup/
mv lib/pentaho-cwm-*.jar /path/to/pdi-backup/
mv lib/pentaho-database-model-*.jar /path/to/pdi-backup/
mv lib/pentaho-hadoop-shims-api-*.jar /path/to/pdi-backup/
mv lib/pentaho-metaverse-api-*.jar /path/to/pdi-backup/
mv lib/pentaho-osgi-utils-api-*.jar /path/to/pdi-backup/
mv lib/pentaho-platform-*.jar /path/to/pdi-backup/
mv lib/pentaho-registry-*.jar /path/to/pdi-backup/
mv lib/pentaho-service-coordinator-*.jar /path/to/pdi-backup/
Long-Term Architecture Tip
If you execute hundreds of transformations in rapid batches, repeated JVM cold starts will always introduce cumulative latency. For high-frequency workloads, run transformations via the Carte slave server daemon or integrate directly with the Kettle Java API to keep the JVM warmed up continuously.
No comments:
Post a Comment