Bug 973168 - Perm gen usage after building KieBase is much higher when compared to drools 5
Perm gen usage after building KieBase is much higher when compared to drools 5
Status: CLOSED CURRENTRELEASE
Product: JBoss BRMS Platform 6
Classification: JBoss
Component: BRE (Show other bugs)
6.0.0
x86_64 Linux
unspecified Severity medium
: ---
: 6.0.0
Assigned To: Mario Fusco
Petr Široký
: Regression
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-11 08:13 EDT by Petr Široký
Modified: 2015-07-14 01:36 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-08-06 16:15:37 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Perm gen usage comparison - Drools 5 vs Drools 6 (96.48 KB, application/pdf)
2013-06-11 08:13 EDT, Petr Široký
no flags Details
Simple Maven based reproducer (332.28 KB, application/zip)
2013-06-11 08:18 EDT, Petr Široký
no flags Details

  None (edit)
Description Petr Široký 2013-06-11 08:13:18 EDT
Created attachment 759593 [details]
Perm gen usage comparison - Drools 5 vs Drools 6

Description of problem:
After creating KieBase, the permanent generation usage is about 50% higher with Drools 6 compared to Drools 5. The KieBase is just built so no KieSessions are being created and used. The number of loaded classes is almost identical in both versions (checked with visualvm).

See the attached simple Maven reproducer and the pdf that compares the perm gen usage for Drools 6 and Drools 5.


Version-Release number of selected component (if applicable):
Drools 6.0.0-Beta3 (and SNAPSHOT after that)
Drools 5.3.x (the exact version is BRMS-5.3.1-P02).


How reproducible:
Always


Steps to Reproduce:
1. Run the attached Maven projects (one is for Drools 5 and one for Drools 6) - just mvn test
2. See the perm gen usage messages that are being printed on stdout.


Actual results:
The perm gen usage in Drools 6 is much higher compared to Drools 5.


Expected results:
The perm gen usage is similar in both Drools 6 and Drools 5.
Comment 1 Petr Široký 2013-06-11 08:18:38 EDT
Created attachment 759602 [details]
Simple Maven based reproducer
Comment 2 Petr Široký 2013-06-11 08:20:26 EDT
Forgot to specify JDK version:
$ java -version
java version "1.7.0_19"
OpenJDK Runtime Environment (fedora-2.3.9.4.fc17-x86_64)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
Comment 3 Mario Fusco 2013-07-25 05:34:16 EDT
I cannot reproduce this issue. I am using the JDK

Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) Server VM (build 23.25-b01, mixed mode)

running it with the following memory settings:

-XX:MaxPermSize=512M -Xmx1536M

The output of the attached test case with Drools 5 follows:

Permgen usage: 3MiB
Running loop 1
Just to be sure the code is not eliminated: packages=1
KBase building took 56s.
Permgen usage: 68MiB
Running loop 2
Just to be sure the code is not eliminated: packages=1
KBase building took 34s.
Permgen usage: 123MiB
Running loop 3
Just to be sure the code is not eliminated: packages=1
KBase building took 34s.
Permgen usage: 123MiB
Running loop 4
Just to be sure the code is not eliminated: packages=1
KBase building took 32s.
Permgen usage: 123MiB
Running loop 5
Just to be sure the code is not eliminated: packages=1
KBase building took 32s.
Permgen usage: 123MiB
End of the test, after manually calling GC...
Permgen usage: 123MiB

while with Drools 6 (using the latest available snapshot) I got:

Permgen usage: 2MiB
Running loop 1
10:54:41.140 [main] INFO  o.d.c.k.b.impl.KieRepositoryImpl - KieModule was added:MemoryKieModule[ ReleaseId=org.default:artifact:1.0.0-SNAPSHOT]
Just to be sure the code is not eliminated: packages=3
KBase building took 67s.
Permgen usage: 108MiB
Running loop 2
10:55:29.392 [main] INFO  o.d.c.k.b.impl.KieRepositoryImpl - KieModule was added:MemoryKieModule[ ReleaseId=org.default:artifact:1.0.0-SNAPSHOT]
Just to be sure the code is not eliminated: packages=3
KBase building took 28s.
Permgen usage: 108MiB
Running loop 3
10:55:55.665 [main] INFO  o.d.c.k.b.impl.KieRepositoryImpl - KieModule was added:MemoryKieModule[ ReleaseId=org.default:artifact:1.0.0-SNAPSHOT]
Just to be sure the code is not eliminated: packages=3
KBase building took 24s.
Permgen usage: 108MiB
Running loop 4
10:56:20.417 [main] INFO  o.d.c.k.b.impl.KieRepositoryImpl - KieModule was added:MemoryKieModule[ ReleaseId=org.default:artifact:1.0.0-SNAPSHOT]
Just to be sure the code is not eliminated: packages=3
KBase building took 24s.
Permgen usage: 108MiB
Running loop 5
10:56:45.289 [main] INFO  o.d.c.k.b.impl.KieRepositoryImpl - KieModule was added:MemoryKieModule[ ReleaseId=org.default:artifact:1.0.0-SNAPSHOT]
Just to be sure the code is not eliminated: packages=3
KBase building took 23s.
Permgen usage: 108MiB
End of the test, after manually calling GC...
Permgen usage: 108MiB

This means that Drools 5 uses 123M while 6 only needs 108M.
Comment 4 Petr Široký 2013-07-25 06:22:35 EDT
I just reran the tests with current SNAPSHOT and the issue is indeed gone. As pointed by Mario, is has been probably fixed between beta3 and beta4 when new Classloader was introduced.

Closing as fixed.
Comment 8 Lukáš Petrovický 2014-02-07 11:15:08 EST
This BZ has been part of the 6.0.0 stream.
Comment 9 Vivek Hingorani 2015-07-14 01:36:50 EDT
I am getting the same problem in my current project and I am using drools 6.1.0.Final version. I am assuming the above problem will be fixed in Drools 6.1.0.Final version but I am getting the same problem :( 

Any help would be much appreciated.

Note You need to log in before you can comment on or make changes to this bug.