Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
3.0.0
-
None
Description
Spark's use of lz4-java ends up calling LZ4Factory.fastestInstance, which attempts to load JNI libraries and falls back on Java implementations in case the JNI library cannot be loaded or initialized.
Unfortunately, the LZ4 library does not cache the fact that the JNI library failed to load, so every call to LZ4Factory.fastestInstance ends up repeating this failed load. These initialization attempts are performed in a static synchronized method, so exceptions from failures are thrown while holding a global lock and this causes lock-contention performance issues.
To avoid this problem, we can cache the LZ4Factory ourselves (since it's thread-safe), thereby caching the outcome of the failed load and avoiding performance problems.
Attachments
Issue Links
- links to