Memory settings and tuning for Grails1.1 and Groovy1.6 Java virtual machines

Source: Internet
Author: User
Tags grails

In this article, I would like to answer the following questions:

. Where are the memory settings and adjustments for Grails1.1 and Groovy1.6 Java virtual machines and how do we change them?

What is the difference between the latest version and the old version?

. Do these settings and adjustments differ between Windows and Linux need to be mastered?

Memory settings for Grails1.1 and Grails1.0.2 Java virtual machines

If you run the GRAILS command on the Linux/unix platform, it is executing the "$GRAILS _home/bin/startgrails" command while on the Windows platform, is executing "$GRAILS _home/bin/ Startgrails.bat "batch process. These scripts behave differently between Linux and Windows, and the settings vary between versions on the Windows platform.

. grails 1.1 of the Linux platform: even if you set the "$JAVA _opts" to different values, the "server" JVM has only the largest heap space of "MB".

. The Linux platform grails 1.02: the same as above.

. Windows platform Grails 1.1: If you do not set the $JAVA _opts parameter, use a heap space of up to MB and automatically select the JAVA virtual machine engine.

. Windows platform Grails 1.02: If you do not set the $JAVA _opts parameter, use the maximum "128 Mb" heap space and automatically select the JAVA virtual machine engine.

From my point of view, the Windows platform Grails 1.1 has the best experience and should be adopted by the Linux/unix platform. If I have good reason to set the "$JAVA _opts" argument, then I don't want it to be modified. I don't know what the JVM would do if you set the "-xmx512m" and "-xmx256m" parameters. But if you can use the previous arguments, then using the following arguments can cause an error?

So I changed the "startgrails" command in my Linux system, as follows:

# comment the old setting

# JAVA_OPTS="-server -Xmx512M $JAVA_OPTS"

# check for $JAVA_OPTS instead:

if [ "$JAVA_OPTS" == "" ]; then

JAVA_OPTS="-server -Xmx512m"

fi

But be aware that if you use the War pack to publish your grails to an application server, the memory settings are no longer valid; Instead, you must set the application server's memory settings for your application.

Groovy1.6 memory settings for Java virtual machines

If you run the GROOVY command, "$GROOVY _home/bin/startgroovy" will be executed on the Linux/unix platform, and "$GROOVY _home/bin/startgroovy.bat" will be executed on the Windows platform. These scripts are different in Linux and Windows, but on their respective platforms, groovy version 1.6 and version 1.5.7 are the same. Here are the differences:

. Linux platform Groovy1.6: If the "$JAVA _opts" is set, it works, and the JVM's default settings work only if "$JAVA _opts" is empty or not set.

. Windows platform Groovy1.6: "$JAVA _opts" must work, if "$JAVA _opts" is empty or not set, then the maximum heap space is 128Mb.

You can change the memory settings for all groovy applications by setting the "$JAVA _opts" in the "$HOME/.groovy/startup" file, which is not affected by other JAVA applications, and this file will be read by the Startgroovy script, if it exists, will be run as a shell script.

Set JVM memory in an open source Java application Server

In his blog "", Paul gu not only lists a lot of traps and bugs when setting the heap size, but also gives a lot of tips on how to find the heap size and the "$JAVA _opts" settings for different Java applications, including many open source Java application servers. Many tips can help you publish your grails apps on different systems and adjust your JVM memory settings.

Original website: Http://www.groovygrails.de/blog/groovygrails/entry/grails_1_1_and_groovy

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.