You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by le...@apache.org on 2009/09/24 02:05:05 UTC

svn commit: r818321 - in /ofbiz/trunk: build.xml startofbiz.bat startofbiz.sh startofbizNoLog.bat

Author: lektran
Date: Thu Sep 24 00:05:05 2009
New Revision: 818321

URL: http://svn.apache.org/viewvc?rev=818321&view=rev
Log:
Added the maxPermSize jvm arg the various startup methods since OFBiz now seems to require more than the default 64m.  Also removed startofbizNoLog.bat since it seems somewhat superfluous, instead made startofbiz.bat log to the console by default and added a comment about how to change it if desired.

Removed:
    ofbiz/trunk/startofbizNoLog.bat
Modified:
    ofbiz/trunk/build.xml
    ofbiz/trunk/startofbiz.bat
    ofbiz/trunk/startofbiz.sh

Modified: ofbiz/trunk/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/build.xml?rev=818321&r1=818320&r2=818321&view=diff
==============================================================================
--- ofbiz/trunk/build.xml (original)
+++ ofbiz/trunk/build.xml Thu Sep 24 00:05:05 2009
@@ -22,6 +22,7 @@
     <property name="site.dir" value="../site"/>
     <property name="memory.initial.param" value="-Xms128M"/>
     <property name="memory.max.param" value="-Xmx512M"/>
+	<property name="memory.maxpermsize.param" value="-XX:MaxPermSize=128m"/>
 
     <available file="applications/build.xml" property="applications.present"/>
     <available file="specialpurpose/build.xml" property="specialpurpose.present"/>
@@ -288,12 +289,14 @@
         <java jar="ofbiz.jar" fork="true">
             <jvmarg value="${memory.initial.param}"/>
             <jvmarg value="${memory.max.param}"/>
+        	<jvmarg value="${memory.maxpermsize.param}"/>
         </java>
     </target>
     <target name="run-pos" description="Start the POS (Point of sale) system">
         <java jar="ofbiz.jar" fork="true">
             <jvmarg value="${memory.initial.param}"/>
             <jvmarg value="${memory.max.param}"/>
+            <jvmarg value="${memory.maxpermsize.param}"/>
             <arg value="pos"/>
         </java>
     </target>
@@ -302,6 +305,7 @@
         <java jar="ofbiz.jar" fork="true">
             <jvmarg value="${memory.initial.param}"/>
             <jvmarg value="${memory.max.param}"/>
+            <jvmarg value="${memory.maxpermsize.param}"/>
             <arg value="install"/>
         </java>
     </target>
@@ -310,6 +314,7 @@
         <java jar="ofbiz.jar" fork="true">
             <jvmarg value="${memory.initial.param}"/>
             <jvmarg value="${memory.max.param}"/>
+            <jvmarg value="${memory.maxpermsize.param}"/>
             <arg value="install"/>
             <arg value="readers=seed"/>
         </java>
@@ -319,6 +324,7 @@
         <java jar="ofbiz.jar" fork="true">
             <jvmarg value="${memory.initial.param}"/>
             <jvmarg value="${memory.max.param}"/>
+            <jvmarg value="${memory.maxpermsize.param}"/>
             <arg value="install"/>
             <arg value="readers=seed,seed-initial,ext"/>
         </java>
@@ -328,6 +334,7 @@
         <java jar="ofbiz.jar" fork="true">
             <jvmarg value="${memory.initial.param}"/>
             <jvmarg value="${memory.max.param}"/>
+            <jvmarg value="${memory.maxpermsize.param}"/>
             <arg value="install"/>
             <arg value="readers=seed,seed-initial,ext,ext-test"/>
         </java>
@@ -337,6 +344,7 @@
         <java jar="ofbiz.jar" fork="true" >
             <jvmarg value="${memory.initial.param}"/>
             <jvmarg value="${memory.max.param}"/>
+            <jvmarg value="${memory.maxpermsize.param}"/>
             <arg value="install"/>
             <arg value="readers=${data-readers}"/>
         </java>
@@ -346,6 +354,7 @@
         <java jar="ofbiz.jar" fork="true">
             <jvmarg value="${memory.initial.param}"/>
             <jvmarg value="${memory.max.param}"/>
+            <jvmarg value="${memory.maxpermsize.param}"/>
             <arg value="install"/>
             <arg value="delegator=default"/>
             <arg value="file=${data-file}"/>
@@ -378,6 +387,7 @@
         <java jar="ofbiz.jar"  fork="true">
             <jvmarg value="${memory.initial.param}"/>
             <jvmarg value="${memory.max.param}"/>
+            <jvmarg value="${memory.maxpermsize.param}"/>
             <jvmarg value="-Xnoagent"/>
             <jvmarg value="-Djava.compiler=NONE"/>
             <jvmarg value="-Xdebug"/>
@@ -388,6 +398,7 @@
         <java jar="ofbiz.jar" fork="true">
             <jvmarg value="${memory.initial.param}"/>
             <jvmarg value="${memory.max.param}"/>
+            <jvmarg value="${memory.maxpermsize.param}"/>
             <arg value="test"/>
         </java>
     </target>
@@ -415,6 +426,7 @@
         <java jar="ofbiz.jar" fork="true">
             <jvmarg value="${memory.initial.param}"/>
             <jvmarg value="${memory.max.param}"/>
+            <jvmarg value="${memory.maxpermsize.param}"/>
             <arg value="testlist"/>
             <arg file="runtime/test-list-build.xml"/>
             <arg value="-ant"/>
@@ -425,6 +437,7 @@
         <java jar="ofbiz.jar" fork="true">
             <jvmarg value="${memory.initial.param}"/>
             <jvmarg value="${memory.max.param}"/>
+            <jvmarg value="${memory.maxpermsize.param}"/>
             <arg value="test"/>
             <arg value="-component=${test.component}"/>
             <arg value="-case=${test.case}"/>
@@ -440,6 +453,7 @@
         <java jar="ofbiz.jar" fork="true">
             <jvmarg value="${memory.initial.param}"/>
             <jvmarg value="${memory.max.param}"/>
+            <jvmarg value="${memory.maxpermsize.param}"/>
             <arg value="test"/>
             <arg value="-component=${test.component}"/>
             <arg value="-suitename=${test.suiteName}"/>

Modified: ofbiz/trunk/startofbiz.bat
URL: http://svn.apache.org/viewvc/ofbiz/trunk/startofbiz.bat?rev=818321&r1=818320&r2=818321&view=diff
==============================================================================
--- ofbiz/trunk/startofbiz.bat (original)
+++ ofbiz/trunk/startofbiz.bat Thu Sep 24 00:05:05 2009
@@ -25,7 +25,7 @@
 rem del %OFBIZ_LOG%
 
 rem ###VM args block ####################################################
-rem set MEMIF=-Xms128M -Xmx512M
+rem set MEMIF=-Xms128M -Xmx512M -XX:MaxPermSize=128m
 rem # RMI settings
 rem set DEBUG=-Dsun.rmi.server.exceptionTrace=true
 rem # Automatic IP address for Windows
@@ -47,9 +47,11 @@
 rem "%JAVA_HOME%\bin\java" %VMARGS% -jar ofbiz.jar > %OFBIZ_LOG%
 
 rem ### This one is for more of a debugging mode
-rem "%JAVA_HOME%\bin\java" -Xms128M -Xmx512M -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -jar ofbiz.jar > runtime\logs\console.log
+rem "%JAVA_HOME%\bin\java" -Xms128M -Xmx512M -XX:MaxPermSize=128m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -jar ofbiz.jar > runtime\logs\console.log
 
 rem ### Simple easy to read line
 echo on
-"%JAVA_HOME%\bin\java" -Xms128M -Xmx512M -jar ofbiz.jar > runtime\logs\console.log
-
+"%JAVA_HOME%\bin\java" -Xms128M -Xmx512M -XX:MaxPermSize=128m -jar ofbiz.jar
+rem ### If you would prefer the console output to be logged rather than displayed switch out the above line for this one
+rem "%JAVA_HOME%\bin\java" -Xms128M -Xmx512M -XX:MaxPermSize=128m -jar ofbiz.jar > runtime\logs\console.log
+ 

Modified: ofbiz/trunk/startofbiz.sh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/startofbiz.sh?rev=818321&r1=818320&r2=818321&view=diff
==============================================================================
--- ofbiz/trunk/startofbiz.sh (original)
+++ ofbiz/trunk/startofbiz.sh Thu Sep 24 00:05:05 2009
@@ -35,7 +35,7 @@
 #automatic IP address for linux
 #IPADDR=`/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`
 #RMIIF="-Djava.rmi.server.hostname=$IPADDR"
-MEMIF="-Xms128M -Xmx512M"
+MEMIF="-Xms128M -Xmx512M -XX:MaxPermSize=128m"
 #MISC="-Duser.language=en"
 VMARGS="$MEMIF $MISC $DEBUG $RMIIF $ADMIN"
 



Re: svn commit: r818321 - in /ofbiz/trunk: build.xml startofbiz.bat startofbiz.sh startofbizNoLog.bat

Posted by Adrian Crum <ad...@hlmksw.com>.
Adam Heath wrote:
> lektran@apache.org wrote:
>> Author: lektran
>> Date: Thu Sep 24 00:05:05 2009
>> New Revision: 818321
>>
>> URL: http://svn.apache.org/viewvc?rev=818321&view=rev
>> Log:
>> Added the maxPermSize jvm arg the various startup methods since OFBiz now seems to require more than the default 64m.  Also removed startofbizNoLog.bat since it seems somewhat superfluous, instead made startofbiz.bat log to the console by default and added a comment about how to change it if desired.
> 
> (nothing like delayed responses)
> 
> bother.  We had made a branch of ofbiz trunk Sep 5; we then used this
> branch up until earlier this week.  This internal branch was able to
> run fine with just a 64M permgen size.  However, once we jumped to the
> latest trunk, we discovered that ofbiz suddenly used more memory, and
> actually was throwing an OutOfMemory error.  This was due to not
> having this particular change in the debian ofbiz init script.
> 
> Increasing the maxPermSize number is just not acceptable; having to
> allocate so much more memory would increase the cost of hosting.
> 
> The discovery of this bug gave me a window of changes, to try and
> track down the cause.  Near as I can tell, this memory issue is due to
>  *all* service definitions having a custom, on-the-fly, class compiled
> for them.  Each class is inside it's very own unique classloader.  So,
> not only do you have all the internal memory for the class+classloader
> combo(which includes a Vector with a default internal size of 10, but
> only one element filled in the array), the class data itself is stored
> in the permgen area.
> 
> Based on simple searching, I see 1926 class files(this number may not
> be 100% accurate).  I then see 2595 service definitions.  Doing a jmap
> -dump immediately after ofbiz starts, then running jhat on the
> resulting dump file, shows tons and tons of classloaders loaded.
> 
> I'm working on a fix for this.  Since this bit of code is using
> webslinger-invoker.jar, what I am doing in improving my test
> coverage(I was at 80% initially, currently at 90%), then will import
> the code in full into ofbiz(this was always the long-term plan with
> the webslinger code anyways).  I'll then modify the invoker code to
> support specifying a shared classloader, which should reduce the
> memory usage.  I'll also be adding a way to turn off this compiled
> class globally, per file, or per service.

Did you look into the CachedClassLoader class? It keeps a Map that 
contains what are called "global" classes and separate Maps for each 
component that contain something called "local" classes. I don't 
understand why the separation is necessary and I wonder how many entries 
those Maps get.

-Adrian

Re: svn commit: r818321 - in /ofbiz/trunk: build.xml startofbiz.bat startofbiz.sh startofbizNoLog.bat

Posted by Jacques Le Roux <ja...@les7arts.com>.
From: "Adam Heath" <do...@brainfood.com>
> Jacques Le Roux wrote:
>> And as a second reminder
>> http://people.apache.org/~bimargulies/memory-efficient-java-tutorial.pdf
>> (I hope I will find enough time one day to read all this in every
>> details...)
> 
> Java Concurrency in Practice, http://www.javaconcurrencyinpractice.com/.
> 
> Non-blocking programming, memory debugging, the works.  I know all
> about memory optimization and complex programming techniques described
> in this book.  It's a most wonderful read.

I have already seen recommendation about it, another one in my list...

Thanks

Jacques


Re: svn commit: r818321 - in /ofbiz/trunk: build.xml startofbiz.bat startofbiz.sh startofbizNoLog.bat

Posted by Adam Heath <do...@brainfood.com>.
Jacques Le Roux wrote:
> And as a second reminder
> http://people.apache.org/~bimargulies/memory-efficient-java-tutorial.pdf
> (I hope I will find enough time one day to read all this in every
> details...)

Java Concurrency in Practice, http://www.javaconcurrencyinpractice.com/.

Non-blocking programming, memory debugging, the works.  I know all
about memory optimization and complex programming techniques described
in this book.  It's a most wonderful read.

Re: svn commit: r818321 - in /ofbiz/trunk: build.xml startofbiz.bat startofbiz.sh startofbizNoLog.bat

Posted by Jacques Le Roux <ja...@les7arts.com>.
And as a second reminder http://people.apache.org/~bimargulies/memory-efficient-java-tutorial.pdf (I hope I will find enough time 
one day to read all this in every details...)

Jacques

From: "Tim Ruppert" <ti...@hotwaxmedia.com>
This is great Adam - thanks.

Cheers,
Ruppert

On Jan 26, 2010, at 11:49 AM, Adam Heath wrote:

> lektran@apache.org wrote:
>> Author: lektran
>> Date: Thu Sep 24 00:05:05 2009
>> New Revision: 818321
>>
>> URL: http://svn.apache.org/viewvc?rev=818321&view=rev
>> Log:
>> Added the maxPermSize jvm arg the various startup methods since OFBiz now seems to require more than the default 64m.  Also 
>> removed startofbizNoLog.bat since it seems somewhat superfluous, instead made startofbiz.bat log to the console by default and 
>> added a comment about how to change it if desired.
>
> (nothing like delayed responses)
>
> bother.  We had made a branch of ofbiz trunk Sep 5; we then used this
> branch up until earlier this week.  This internal branch was able to
> run fine with just a 64M permgen size.  However, once we jumped to the
> latest trunk, we discovered that ofbiz suddenly used more memory, and
> actually was throwing an OutOfMemory error.  This was due to not
> having this particular change in the debian ofbiz init script.
>
> Increasing the maxPermSize number is just not acceptable; having to
> allocate so much more memory would increase the cost of hosting.
>
> The discovery of this bug gave me a window of changes, to try and
> track down the cause.  Near as I can tell, this memory issue is due to
> *all* service definitions having a custom, on-the-fly, class compiled
> for them.  Each class is inside it's very own unique classloader.  So,
> not only do you have all the internal memory for the class+classloader
> combo(which includes a Vector with a default internal size of 10, but
> only one element filled in the array), the class data itself is stored
> in the permgen area.
>
> Based on simple searching, I see 1926 class files(this number may not
> be 100% accurate).  I then see 2595 service definitions.  Doing a jmap
> -dump immediately after ofbiz starts, then running jhat on the
> resulting dump file, shows tons and tons of classloaders loaded.
>
> I'm working on a fix for this.  Since this bit of code is using
> webslinger-invoker.jar, what I am doing in improving my test
> coverage(I was at 80% initially, currently at 90%), then will import
> the code in full into ofbiz(this was always the long-term plan with
> the webslinger code anyways).  I'll then modify the invoker code to
> support specifying a shared classloader, which should reduce the
> memory usage.  I'll also be adding a way to turn off this compiled
> class globally, per file, or per service.




Re: svn commit: r818321 - in /ofbiz/trunk: build.xml startofbiz.bat startofbiz.sh startofbizNoLog.bat

Posted by Tim Ruppert <ti...@hotwaxmedia.com>.
This is great Adam - thanks.

Cheers,
Ruppert

On Jan 26, 2010, at 11:49 AM, Adam Heath wrote:

> lektran@apache.org wrote:
>> Author: lektran
>> Date: Thu Sep 24 00:05:05 2009
>> New Revision: 818321
>> 
>> URL: http://svn.apache.org/viewvc?rev=818321&view=rev
>> Log:
>> Added the maxPermSize jvm arg the various startup methods since OFBiz now seems to require more than the default 64m.  Also removed startofbizNoLog.bat since it seems somewhat superfluous, instead made startofbiz.bat log to the console by default and added a comment about how to change it if desired.
> 
> (nothing like delayed responses)
> 
> bother.  We had made a branch of ofbiz trunk Sep 5; we then used this
> branch up until earlier this week.  This internal branch was able to
> run fine with just a 64M permgen size.  However, once we jumped to the
> latest trunk, we discovered that ofbiz suddenly used more memory, and
> actually was throwing an OutOfMemory error.  This was due to not
> having this particular change in the debian ofbiz init script.
> 
> Increasing the maxPermSize number is just not acceptable; having to
> allocate so much more memory would increase the cost of hosting.
> 
> The discovery of this bug gave me a window of changes, to try and
> track down the cause.  Near as I can tell, this memory issue is due to
> *all* service definitions having a custom, on-the-fly, class compiled
> for them.  Each class is inside it's very own unique classloader.  So,
> not only do you have all the internal memory for the class+classloader
> combo(which includes a Vector with a default internal size of 10, but
> only one element filled in the array), the class data itself is stored
> in the permgen area.
> 
> Based on simple searching, I see 1926 class files(this number may not
> be 100% accurate).  I then see 2595 service definitions.  Doing a jmap
> -dump immediately after ofbiz starts, then running jhat on the
> resulting dump file, shows tons and tons of classloaders loaded.
> 
> I'm working on a fix for this.  Since this bit of code is using
> webslinger-invoker.jar, what I am doing in improving my test
> coverage(I was at 80% initially, currently at 90%), then will import
> the code in full into ofbiz(this was always the long-term plan with
> the webslinger code anyways).  I'll then modify the invoker code to
> support specifying a shared classloader, which should reduce the
> memory usage.  I'll also be adding a way to turn off this compiled
> class globally, per file, or per service.


Re: svn commit: r818321 - in /ofbiz/trunk: build.xml startofbiz.bat startofbiz.sh startofbizNoLog.bat

Posted by Adam Heath <do...@brainfood.com>.
lektran@apache.org wrote:
> Author: lektran
> Date: Thu Sep 24 00:05:05 2009
> New Revision: 818321
> 
> URL: http://svn.apache.org/viewvc?rev=818321&view=rev
> Log:
> Added the maxPermSize jvm arg the various startup methods since OFBiz now seems to require more than the default 64m.  Also removed startofbizNoLog.bat since it seems somewhat superfluous, instead made startofbiz.bat log to the console by default and added a comment about how to change it if desired.

(nothing like delayed responses)

bother.  We had made a branch of ofbiz trunk Sep 5; we then used this
branch up until earlier this week.  This internal branch was able to
run fine with just a 64M permgen size.  However, once we jumped to the
latest trunk, we discovered that ofbiz suddenly used more memory, and
actually was throwing an OutOfMemory error.  This was due to not
having this particular change in the debian ofbiz init script.

Increasing the maxPermSize number is just not acceptable; having to
allocate so much more memory would increase the cost of hosting.

The discovery of this bug gave me a window of changes, to try and
track down the cause.  Near as I can tell, this memory issue is due to
 *all* service definitions having a custom, on-the-fly, class compiled
for them.  Each class is inside it's very own unique classloader.  So,
not only do you have all the internal memory for the class+classloader
combo(which includes a Vector with a default internal size of 10, but
only one element filled in the array), the class data itself is stored
in the permgen area.

Based on simple searching, I see 1926 class files(this number may not
be 100% accurate).  I then see 2595 service definitions.  Doing a jmap
-dump immediately after ofbiz starts, then running jhat on the
resulting dump file, shows tons and tons of classloaders loaded.

I'm working on a fix for this.  Since this bit of code is using
webslinger-invoker.jar, what I am doing in improving my test
coverage(I was at 80% initially, currently at 90%), then will import
the code in full into ofbiz(this was always the long-term plan with
the webslinger code anyways).  I'll then modify the invoker code to
support specifying a shared classloader, which should reduce the
memory usage.  I'll also be adding a way to turn off this compiled
class globally, per file, or per service.