Should we remove the MaxPermSize attribute?
Should we add "-XX:MetaspaceSize" attribute?
Reference link: http://karunsubramanian.com/websphere/one-important-change-in-memory-management-in-java-8/
|
114 KB
|
137 KB
|
104 KB
|
313 KB
|
124 KB
In Java 8, classes metadata is now stored in the native heap and this space is called Metaspace. I think the "-XX:MaxMetaspaceSize" flag controls the maximum amount of space to be allocated for class metadata (not "-XX:MetaspaceSize" as mentioned in the referenced article).
Note: I also think the referenced article is not accurate with regards to PermGen holding ‘interned’ Strings - as of Java 7, memory used for 'interned' Strings have been moved to the heap (http://java-performance.info/string-intern-in-java-6-7-8/)
In theory, I don't think a Java application needs to set any Metaspace flags as long as the OS is not memory bound. However, for ADS, I think we should gain some insight on the estimated maximum amount of Metaspace it needs and set the "-XX:MaxMetaspaceSize" to a safe value. Java 8 should throw OutOfMemoryException if ADS needs more than that setting - this way we could potentially prevent ADS from crashing the entire machine.
I would recommend using jmap -permstat <PID> (mentioned in the referenced article) to obtain the high watermark of Metaspace. For example, we could use jmap to obtain the reading after using ADS to cover a wide range of its functionality to ensure as many classes are loaded as possible. Based on these readings, we could then pick a value (with comfortable safety margin) for "-XX:MaxMetaspaceSize".
We have taken reading through jmap as recommended by king-hong. Recommend max meta space size for ADS is 256M.
We have performed the task for two days without closing the application. ADS application is running on Default memory '-Xmx756M' . We have removed ' -XX:MaxPermSize=192m' under datatstudio-bundled.sh file and start application and perform continuously testing in two days. We have attached screenshots for final result after closing application.
Observations:
We have taken reading through jmap as recommended by king-hong. Recommend max meta space size for ADS is 256M.
We have performed the task for two days without closing the application. ADS application is running on Default memory '-Xmx756M' . We have removed ' -XX:MaxPermSize=192m' under datatstudio-bundled.sh file and start application and perform continuously testing in two days. We have attached screenshots for final result after closing application.
Observations:
@ranarohitp - could you please explain the reason(s) for recommending 256M for MaxMetaspaceSize?
As far as I can tell, the high watermark after two days of ADS usage is around 145M. I would think that 192M (same size as previous MaxPermSize for Java 7 and below) would provide plenty of margin.
In addition, I would also recommend a starting metaspace size (using the -XX:MetaspaceSize flag) of 128M. This is because the default JVM starting metaspace size of 21M is far too low and would likely cause multiple full metaspace garbage collection, adding to ADS start up time.
@ranarohitp - could you please explain the reason(s) for recommending 256M for MaxMetaspaceSize?
As far as I can tell, the high watermark after two days of ADS usage is around 145M. I would think that 192M (same size as previous MaxPermSize for Java 7 and below) would provide plenty of margin.
In addition, I would also recommend a starting metaspace size (using the -XX:MetaspaceSize flag) of 128M. This is because the default JVM starting metaspace size of 21M is far too low and would likely cause multiple full metaspace garbage collection, adding to ADS start up time.
Kin-Hong,
We have performed the task for two days without closing the application.During these two days we were running Aquascripts (Insert Data), export and VA in parallel, during these two days ADS usage of meta space size varies. Sometimes it was 145 and some time it was around 180. So we have rounded off the values and recommended 256M for MaxMetaspaceSize.
Kin-Hong,
We have performed the task for two days without closing the application.During these two days we were running Aquascripts (Insert Data), export and VA in parallel, during these two days ADS usage of meta space size varies. Sometimes it was 145 and some time it was around 180. So we have rounded off the values and recommended 256M for MaxMetaspaceSize.
The following JVM flag:
-XX:MaxPermSize=192m
is replaced with:
-XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=256m
/dist/apps/datastudio/32bit/datastudio.ini
/dist/apps/datastudio/64bit/datastudio.ini
/dist/apps/datastudio/adstudio-osx/Aqua Data Studio.app/Contents/Info.plist
/dist/apps/datastudio/datastudio-bundled.bat
/dist/apps/datastudio/datastudio-bundled.sh
/dist/apps/datastudio/datastudio-osx.sh
/dist/apps/datastudio/datastudio.bat
/dist/apps/datastudio/datastudio.ini
/dist/apps/datastudio/datastudio.sh
/dist/apps/datastudio/runfluidscript-bundled.bat
/dist/apps/datastudio/runfluidscript-bundled.sh
/dist/apps/datastudio/runfluidscript-osx-app.sh
/dist/apps/datastudio/runfluidscript-osx.sh
/dist/apps/datastudio/runfluidscript.bat
/dist/apps/datastudio/runfluidscript.sh
/dist/apps/datastudio/runscript-bundled.bat
/dist/apps/datastudio/runscript-bundled.sh
/dist/apps/datastudio/runscript-osx-app.sh
/dist/apps/datastudio/runscript-osx.sh
/dist/apps/datastudio/runscript.bat
/dist/apps/datastudio/runscript.sh
The following JVM flag:
-XX:MaxPermSize=192m
is replaced with:
-XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=256m
/dist/apps/datastudio/32bit/datastudio.ini
/dist/apps/datastudio/64bit/datastudio.ini
/dist/apps/datastudio/adstudio-osx/Aqua Data Studio.app/Contents/Info.plist
/dist/apps/datastudio/datastudio-bundled.bat
/dist/apps/datastudio/datastudio-bundled.sh
/dist/apps/datastudio/datastudio-osx.sh
/dist/apps/datastudio/datastudio.bat
/dist/apps/datastudio/datastudio.ini
/dist/apps/datastudio/datastudio.sh
/dist/apps/datastudio/runfluidscript-bundled.bat
/dist/apps/datastudio/runfluidscript-bundled.sh
/dist/apps/datastudio/runfluidscript-osx-app.sh
/dist/apps/datastudio/runfluidscript-osx.sh
/dist/apps/datastudio/runfluidscript.bat
/dist/apps/datastudio/runfluidscript.sh
/dist/apps/datastudio/runscript-bundled.bat
/dist/apps/datastudio/runscript-bundled.sh
/dist/apps/datastudio/runscript-osx-app.sh
/dist/apps/datastudio/runscript-osx.sh
/dist/apps/datastudio/runscript.bat
/dist/apps/datastudio/runscript.sh
Marking resolved so QA can test the scripts to ensure that ADS launches properly.
Marking resolved so QA can test the scripts to ensure that ADS launches properly.
From Kin-Hong:
From the latest data, I am still seeing the high watermark of around 150M. The -XX:MaxMetaspaceSize=256m was based on the claimed observation of 180M. Therefore, I don't know what to make of this as I'd like the recommendation to be based on observed data - I think 256m is too high a margin based off 150M.
From Kin-Hong:
From the latest data, I am still seeing the high watermark of around 150M. The -XX:MaxMetaspaceSize=256m was based on the claimed observation of 180M. Therefore, I don't know what to make of this as I'd like the recommendation to be based on observed data - I think 256m is too high a margin based off 150M.
To help reduce support costs, it would be ideal if we could include both the PermSize parameter and the Metaspace paramters in our scripts.
@rohit: pls test the following scenario w/ a script that includes both PermSize & Metaspace:
-- Does the app run on Java 1.7?
-- Does the app run on Java 1.8?
-- Does the app run on Java 1.6?
To help reduce support costs, it would be ideal if we could include both the PermSize parameter and the Metaspace paramters in our scripts.
@rohit: pls test the following scenario w/ a script that includes both PermSize & Metaspace:
-- Does the app run on Java 1.7?
-- Does the app run on Java 1.8?
-- Does the app run on Java 1.6?
Thanks for the analysis, lets do the following:
Change the .bat file so that both the :MetaspaceSize parameter and the :MaxMetaspaceSize parameters are removed. Include the :MaxPermSize parameter. You should be able to run v17 successfully but will see a warning in a command line window stating "ignoring option MaxPermSize=192m; support was removed in 8.0"
Once you've confirmed the above, then run the following tests to see if there is any noticeable performance degradation to ADS startup time by not including the MetaspaceSize parameter:
1) Using an unmodified v17 .bat file, measure the startup time, the time it takes after you launch the .bat file and before the app is ready to accept user input.
2) After ADS startup is finished, also record the time it takes to execute your first SQL query.
Repeat steps 1 & 2, but w/ a modified .bat file which includes the MaxPermSize parameter from v16 but does not include the MetaspaceSize and the MaxMetaspaceSize parameters.
If there is no appreciable time difference, we'll go w/ remove the Metaspace parameters & adding the MaxPermSize parameter to help reduce support costs.
Thanks for the analysis, lets do the following:
Change the .bat file so that both the :MetaspaceSize parameter and the :MaxMetaspaceSize parameters are removed. Include the :MaxPermSize parameter. You should be able to run v17 successfully but will see a warning in a command line window stating "ignoring option MaxPermSize=192m; support was removed in 8.0"
Once you've confirmed the above, then run the following tests to see if there is any noticeable performance degradation to ADS startup time by not including the MetaspaceSize parameter:
1) Using an unmodified v17 .bat file, measure the startup time, the time it takes after you launch the .bat file and before the app is ready to accept user input.
2) After ADS startup is finished, also record the time it takes to execute your first SQL query.
Repeat steps 1 & 2, but w/ a modified .bat file which includes the MaxPermSize parameter from v16 but does not include the MetaspaceSize and the MaxMetaspaceSize parameters.
If there is no appreciable time difference, we'll go w/ remove the Metaspace parameters & adding the MaxPermSize parameter to help reduce support costs.
ADS Build - ads-windows-x64-17.0.0-rc-39 OS -Windows 10 64-bit |
Scenario | Java version "1.7.0_80" | java version "1.6.0_45" | java version "1.8.0_51" |
Using an unmodified v17 .bat file
|
Measure the startup time, the time it takes after you launch the .bat file and before the app is ready to accept user input | ADS does not started and displayed error message on command prompt. | ADS does not started and displayed error message on command prompt. | approximately 6 to 7 seconds |
After ADS startup is finished, also record the time it takes to execute your first SQL query | ADS does not started and displayed error message on command prompt. | ADS does not started and displayed error message on command prompt. | approximately 4 to 5 seconds | |
Using an modified v17 .bat file | measure the startup time, the time it takes after you launch the .bat file and before the app is ready to accept user input | approximately 6 to 8 seconds | approximately 6 to 8 seconds | approximately 6 to 7 seconds |
Using an modified v17 .bat file ADS Memory - default 756M First executed SQL query - SELECT * FROM bistudio_example.bistudio_example GO (10000 records in table) |
After ADS startup is finished, also record the time it takes to execute your first SQL query | approximately 6 to 7 seconds | approximately 5 to 6 seconds | approximately 4 to 5 seconds |
ADS Build - ads-windows-x64-17.0.0-rc-39 OS -Windows 10 64-bit |
Scenario | Java version "1.7.0_80" | java version "1.6.0_45" | java version "1.8.0_51" |
Using an unmodified v17 .bat file
|
Measure the startup time, the time it takes after you launch the .bat file and before the app is ready to accept user input | ADS does not started and displayed error message on command prompt. | ADS does not started and displayed error message on command prompt. | approximately 6 to 7 seconds |
After ADS startup is finished, also record the time it takes to execute your first SQL query | ADS does not started and displayed error message on command prompt. | ADS does not started and displayed error message on command prompt. | approximately 4 to 5 seconds | |
Using an modified v17 .bat file | measure the startup time, the time it takes after you launch the .bat file and before the app is ready to accept user input | approximately 6 to 8 seconds | approximately 6 to 8 seconds | approximately 6 to 7 seconds |
Using an modified v17 .bat file ADS Memory - default 756M First executed SQL query - SELECT * FROM bistudio_example.bistudio_example GO (10000 records in table) |
After ADS startup is finished, also record the time it takes to execute your first SQL query | approximately 6 to 7 seconds | approximately 5 to 6 seconds | approximately 4 to 5 seconds |
@nisha: thanks for the analysis.
@kin-hong: this means that we should remove the MetaSpace parameters and add back the MaxPermSize parameter: for v17 _only_
For v18, we'll keep the Metaspace parameters.
V17 will be our last release which allows customers to run on java 1.7 or java 1.6 if needed (though w/ the potential of some features not fully functioning). This will help lower support costs for v17.
@nisha: thanks for the analysis.
@kin-hong: this means that we should remove the MetaSpace parameters and add back the MaxPermSize parameter: for v17 _only_
For v18, we'll keep the Metaspace parameters.
V17 will be our last release which allows customers to run on java 1.7 or java 1.6 if needed (though w/ the potential of some features not fully functioning). This will help lower support costs for v17.
I have reverted the MetaspaceSize and MaxMetaspaceSize changes made to the 21 files.
I have reverted the MetaspaceSize and MaxMetaspaceSize changes made to the 21 files.
@qa: you should test as follows:
-- execute each of the 21 files successfully using java 1.8
-- modify each of the 21 files to point to java 1.7 & ensure each file is executed successfully.
@qa: you should test as follows:
-- execute each of the 21 files successfully using java 1.8
-- modify each of the 21 files to point to java 1.7 & ensure each file is executed successfully.
Sachin, we are not aware that which 21 files you are talking about.
Are you talking about the .bat, .sh and osx.sh files across all OS ? Can you please let us know.
Sachin, we are not aware that which 21 files you are talking about.
Are you talking about the .bat, .sh and osx.sh files across all OS ? Can you please let us know.
@SachinPrakash : I have executed all the 21 files using java 1.8 and java 1.7 .All the files executed successfully without any error .I have written result of the resp file in this sheet .Kindly review this sheet so that I can mark this issue as verified.
@SachinPrakash : I have executed all the 21 files using java 1.8 and java 1.7 .All the files executed successfully without any error .I have written result of the resp file in this sheet .Kindly review this sheet so that I can mark this issue as verified.
@nisha: I reviewed your results. Do any one of the columns in the xls represent you running all .bat / .sh files _unmodified_ -- just as a user would run them? If so, which column represents this? I ask b/c your java 1.8 columns are labeled w/ "1.8.0_51" and this not the version we bundle. We bundle "1.8.0_40"
@nisha: I reviewed your results. Do any one of the columns in the xls represent you running all .bat / .sh files _unmodified_ -- just as a user would run them? If so, which column represents this? I ask b/c your java 1.8 columns are labeled w/ "1.8.0_51" and this not the version we bundle. We bundle "1.8.0_40"
@nisha: thanks for the detailed results. You may mark as verified.
@nisha: thanks for the detailed results. You may mark as verified.
Verified in Aqua Data Studio 17.0.0-rc-44
Verified in Aqua Data Studio 17.0.0-rc-44
Lets look into the default memory allocation as well if we don't specify Xmx
http://docs.oracle.com/javase/8/docs/technotes/guides/vm/gc-ergonomics.html
Lets look into the default memory allocation as well if we don't specify Xmx
http://docs.oracle.com/javase/8/docs/technotes/guides/vm/gc-ergonomics.html
Issue #13217 |
Closed |
Fixed |
Resolved |
Completion |
No due date |
Fixed Build 17.0.0-rc-43 |
No time estimate |
1 issue link |
relates to #14288
Issue #14288Investigate if we can remove the maximum heap size (-Xmx) JVM startup parameter for ADS |
In Java 8, classes metadata is now stored in the native heap and this space is called Metaspace. I think the "-XX:MaxMetaspaceSize" flag controls the maximum amount of space to be allocated for class metadata (not "-XX:MetaspaceSize" as mentioned in the referenced article).
Note: I also think the referenced article is not accurate with regards to PermGen holding ‘interned’ Strings - as of Java 7, memory used for 'interned' Strings have been moved to the heap (http://java-performance.info/string-intern-in-java-6-7-8/)
In theory, I don't think a Java application needs to set any Metaspace flags as long as the OS is not memory bound. However, for ADS, I think we should gain some insight on the estimated maximum amount of Metaspace it needs and set the "-XX:MaxMetaspaceSize" to a safe value. Java 8 should throw OutOfMemoryException if ADS needs more than that setting - this way we could potentially prevent ADS from crashing the entire machine.
I would recommend using jmap -permstat <PID> (mentioned in the referenced article) to obtain the high watermark of Metaspace. For example, we could use jmap to obtain the reading after using ADS to cover a wide range of its functionality to ensure as many classes are loaded as possible. Based on these readings, we could then pick a value (with comfortable safety margin) for "-XX:MaxMetaspaceSize".