Dear community/drools team,
In my current project, compiled Collection<KiePackages> are stored as byte arrays and deserialized at runtime to convert them into KieBase objects. These KieBase instances are cached in-memory, and stateless KieSessions are created dynamically from them.
However, I’ve observed that the first execution of rules is significantly slow due to class loading overhead, specifically caused by a lock on PackageClassLoader. This has become a major bottleneck, especially since I’m dealing with thousands of unique rules that utilize similar fact objects. Each execution triggers class loading for the same set of classes, which is inefficient.
Approaches Tried So Far:Is there a recommended approach to avoid or minimize class loading during runtime in this scenario? Any strategies or best practices to preload or reuse class definitions efficiently would be greatly appreciated.