首页 \ 问答 \ 在Tomcat上部署Grails应用程序很慢(Deploying Grails applications on Tomcat is slow)

在Tomcat上部署Grails应用程序很慢(Deploying Grails applications on Tomcat is slow)

我使用Grails框架 (版本2.3.7)开发了许多不同的Web服务。 每个Web服务都做不同的事情,有些简单,有些更复杂。 有些只有少数依赖项(插件等),其他有很多。

为了生产,我在Tomcat 7上部署每个服务/应用程序,每个服务/应用程序位于不同的VM上。 为此,我首先构建一个WAR:

> grails war

然后我在Tomcat上部署WAR作为ROOT应用程序( /var/lib/tomcat7/webapps/ROOT.war )。 这很好用。

但是,当(重新)启动Tomcat时,部署应用程序通常需要2-7分钟,有时甚至更多。 我没有注意到应用程序的复杂性和部署时间之间存在真正的相关性。

这个漫长的部署时间有什么原因? 我应该怎么看才能加速Tomcat 7上的Grails应用程序部署?

或者这正是我应该期待的,我应该学会忍受它?


I have a number of different web services developed using the Grails framework (version 2.3.7). Each web service does different things, some simple, some more complex. Some have only a few dependencies (plugins etc.), others many.

For production, I deploy each service/application on Tomcat 7, each on a different VM. To do this, I first build a WAR:

> grails war

and then I deploy the WAR on Tomcat as the ROOT application (/var/lib/tomcat7/webapps/ROOT.war). This works just fine.

But, when (re-)starting Tomcat, it often takes between 2-7 minutes to deploy the application, sometimes more. I haven't noticed a real correlation between the complexity of the application and the deployment time.

What could the reason be for this lengthy deployment time? What should I look at to try to speed up Grails application deployments on Tomcat 7?

Or is this just what I should expect and I should learn to live with it?


原文:https://stackoverflow.com/questions/29045002
更新时间:2023-08-05 15:08

最满意答案

你没有“必须”。 没有它,它会正常工作。 但是,TRACE级别的日志记录往往会非常冗长,并且占用大部分CPU时间,即使它最终没有实际记录到文件中。 通过在日志记录语句周围进行if检查,可以避免这种开销。

我已经看到其他优质代码库对DEBUG和INFO级别日志记录也是如此,所以它不仅限于TRACE。

请参阅有关性能的log4j手册部分。


You don't "have to". It will work just fine without it. However, TRACE-level logging tends to to be massively verbose, and can take up a significant proportion of CPU time, even if it's ultimately not actually logged to the file. By putting the if check around the logging statement, you avoid that overhead.

I've seen other good quality codebases do the same for DEBUG and INFO level logging also, so it's not limited to TRACE.

See the section of the log4j manual relating to peformance.

相关问答

更多
  • 正如@BalusC所提到的,您将无法从EAR中打包的任何其他模块(EJB或其他模块)中读取嵌入在Web模块中的属性文件。 这在JBoss 4.x中运行的事实是它为即使早期版本的JBoss提供向后兼容性的结果。 JBoss 4.x中需要其他配置才能使用符合规范的类加载。 默认情况下,JBoss 7.x和更新的使用规范兼容类加载。 如果属性文件包含可在部署后访问的外部配置,则可以考虑如何将外部文件放入类路径中所述的方法 。 但是,如果它是有效的静态数据,那么您应该将属性文件打包在jar模块中,并将其放在EAR的 ...
  • 这是没有意义的。 JBoss是一个Java应用服务器。 Mono是.NET。 它们是不同的选择。 你不会在另一个“下”运行其中一个。 所以...你的问题的答案是否定的。 That makes no sense. JBoss is a Java app server. Mono is .NET. They are distinct alternatives. You don't run one of them "under" another. So... The answer to your question ...
  • 从6年前开始, 这里有一篇关于配置JBoss“只是正确的东西” 的博客文章 。 我几年没有使用JBoss,但在4.0版本中,您只需将所需的jar文件放入部署目录,JBoss就会只加载那些jar文件。 From 6 years ago, here's a blog entry about configuring JBoss with "just the right stuff." I haven't used JBoss in a few years, but in v4.0, you could just ...
  • 你没有“必须”。 没有它,它会正常工作。 但是,TRACE级别的日志记录往往会非常冗长,并且占用大部分CPU时间,即使它最终没有实际记录到文件中。 通过在日志记录语句周围进行if检查,可以避免这种开销。 我已经看到其他优质代码库对DEBUG和INFO级别日志记录也是如此,所以它不仅限于TRACE。 请参阅有关性能的log4j手册部分。 You don't "have to". It will work just fine without it. However, TRACE-level logging te ...
  • 由于您使用的是Maven,因此可以使用Maven JBoss Deployment插件。 这将使整个过程自动化。 有时Eclipse集成不像您期望的那样工作。 另外,你应该在JBoss命令行控制台上看到你从哪里开始JBoss,旧的战争被取消部署和部署。 Since you are using Maven, you could use the Maven JBoss Deployment plugin. This would make the entire process automated. Sometim ...
  • 这取决于"param"实际上是什么。 如果它是一个复杂的表达式,最好使用isTraceEnabled 。 如果它只是对象的引用,则可以直接使用它。 只有在启用跟踪时才会调用其toString方法。 如果isTraceEnabled有多个跟踪语句,则使用isTraceEnabled也很有用。 if那么你可以把它们放进去。 That depends what "param" actually is. If it is a complex expression it is better to use isTrac ...
  • 最后,我得到一个解决方案,即EntityListener类必须扩展DescriptorEventAdapter 。 甚至EntityListener需要注入spring组件,只需尝试如下。 确保使用spring component / bean的static属性和setter property 。 @Component public class IDInterceptor extends DescriptorEventAdapter { private static SomeSpringBean s ...
  • 是的,它确实, 。 见http://www.jboss.org/jbossweb/modules/php/index.html 。 基本上,你需要更多的东西: 1)JBoss Native - 下载并安装特定于您的操作系统的 2)PHP模块 - 按照上面的链接下载和配置。 3)您必须将您的PHP应用程序打包在WAR文件中。 PHP模块下载附带一个演示PHP WAR文件,将其用作模板。 Yes, it does, . See http://www.jboss.org/jbossweb/modules/php/ ...
  • 我没有看到你的pom中的hard-deploy和start目标(后者显然在某处,如果你得到这个输出,只是你的帖子中遗漏了)。 此外,我使用自己的服务器配置而不是all - 但这不应该在理论上产生很大的不同。 并且插件不使用fileName属性,您不需要它。 如果正确部署JBoss,JBoss会自动找到你的war文件(这就是你需要hard-deploy目标的原因)。 我的配置如下所示: org.codehaus.mojo
  • 问题是来自Eclipse的模拟器缓存,内部存储已满,并且有一个错误。 它工作好几次,然后它有一个bug并返回null。 The problem was the emulator cache from Eclipse for the internal storage was full and has a bug. It works a few times fine and after this it has a bug and returns null.

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)