简体   繁体   中英

Grails Application while for run it taking to much to UP on localhost time 7 min to 10 min

I have laptop 8 GB ram and I5 processor, Grails 2.4.4 and Java 7. while running application it taking to much time 7 to 8 min. is need to set JAVA_OPTS or GRAILS_OPTS. Using intellji 14 IDE.

Sometimes people write a question without actually considering that the people it is presented to have no idea what it is the end user has going on at their end.

The problem with a question like above is the lack of actual information as to the real information of what it is you are trying to achieve.

You should always consider when you say a grails application from a basic grails create-app to where you are is your concept no one out there has any ideas of what it is you are asking it to do. They will in their minds compare it to a basic app.

When hitting an issue in an application these are the things to consider

  1. Enabling logging for the database - Look into enabling your database to generate logs. You can also enable logs within mysql or what ever database you are using to get more of an idea of what is being crunched through.

  2. Enable logging on your application look into adding this to build.gradle :

    console "org.grails:grails-console"

Then in

logback.groovy

at the very end of the file add something like this:

 logger("com.mypackage", DEBUG, ["CONSOLE"])
 logger("com.mypackage", INFO, ["CONSOLE"])
 logger("com.mypackage", WARN, ["CONSOLE"])
 logger("com.mypackage", ERROR, ["CONSOLE"])

Then hopefully your own code should output the debug error statements - Enable logging for your schedule tasks as the app start - measure the start end time - compare them -

this will give you an idea as to how long those things are taking.

In regards to grails and JVM it all depends on what version of JVM you are running JDK 8 is slightly different to JDK7.

export GRAILS_OPTS="-Xmx1G -Xms1024m -XX:MaxPermSize=1024m"
export MAVEN_OPTS="-XX:MaxPermSize=1024m -Xms1024m -Xmx1024m"
export JAVA_OPTS='-server -Xms1024m -Xmx1024m -XX:PermSize=1024m -XX:MaxPermSize=1024m'

That is for Linux you can find out how to export out the variables for windows and increase decrease them.

So far as I am running 8 gig and 16 processor. Again it is all based on JVM configuration. If I have the same but then have it configured to run as 256k JVM. Well all the rest is sitting there not doing much for the actual JVM.

Hope it is making a little more sense and hope if anything you understand that when raising a question you need to think of the audience that will read it and their conception of what you mean for example of I am running an app. You need to elaborate you should really be asking a more specific question after you have done some of above and worked out a more specific issue that someone could better answer. At the moment it is a needle in a haystack

In regards to plugins, always take a read at their documentation for example spring security can have logging enabled. Have you looked into that as yet ? to see what this is doing or how about disabling spring security as a test ?

grails.plugin.springsecurity.active = false      

You see there is a lot you could have already been doing to help yourself be in a better poisition of understanding the fault. When my toe hurts it only hurts me not the person sitting next to me :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM