本文介绍了为grails run-app增加Xmx和Xms的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前遇到了grails的性能问题。加载我们的主页之一需要大约10秒钟的时间。我检查了一下,看到我们的grails应用程序启动时有512个内存。我们目前可以使用价值高达3.5 gm的ram。

We currently are having performance issues with grails. It is taking about 10 seconds to load one of our main pages. I checked and saw that our grails app was starting up with 512 memory. We currently can use up to 3.5 gigs worth of ram.

我尝试导出以下内容:

I tried exporting the following:

在检查启动后,似乎它仍然以512米的设置开始。在哪里设置?

After checking how it started up it seems as if it still started with the 512m setting. Where is this set?

推荐答案

Csaba 的答案不准确。

您无需调整startGrails脚本。这是危险的,因为下次你升级Grails时,你将失去你的配置。我甚至没有提及在多个开发人员中应该是相同的环境!

You don't need to tweak the startGrails script. This is something dangerous since the next time you will upgrade Grails, you will lose your configuration. I am not even talking about an environment that should be the same among multiple developers!

解决方案非常简单:

The solution is quite simple :


  1. 定义 GRAILS_OPTS = - XX:MaxPermSize = 1024m -Xmx1024M -server

  2. 未定义 JAVA_OPTS

  1. Define GRAILS_OPTS="-XX:MaxPermSize=1024m -Xmx1024M -server"
  2. Do not define JAVA_OPTS

这篇关于为grails run-app增加Xmx和Xms的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 00:12