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

问题描述

我们目前在使用 grails 时遇到了性能问题.加载我们的一个主页大约需要 10 秒钟.我检查并看到我们的 grails 应用程序以 512 内存启动.我们目前最多可以使用 3.5 gigs 的内存.

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.

我尝试导出以下内容:

导出 JAVA_OPTS="-XX:MaxPermSize=1024m -Xmx1024M -server"

在检查它是如何启动后,它似乎仍然以 512m 设置启动.这个套装在哪里?

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!

解决方案很简单:

  1. 定义GRAILS_OPTS="-XX:MaxPermSize=1024m -Xmx1024M -server"
  2. 不要定义JAVA_OPTS

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

09-06 00:12