如何减少Wildfly部署所需的时间? [英] How to reduce the time taken for Wildfly to deploy?

查看:158
本文介绍了如何减少Wildfly部署所需的时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在部署我的Web应用程序期间,有超过2分钟的延迟/暂停,导致部署失败(由于超时)

During deployment of my Web application, there is delay/pause of more than 2 minutes due to which the deployment is failing (because of timeout)

下一行是最后打印的行,在此之后花费大量时间才能打印下一个日志.

The below line is the last line that is printed after which it takes considerable time for the next log to print.

WFLYSRV0049: WildFly FUll 9.0.2.Final (WildFly Core 1.0.2.Final) starting

我知道通过增加超时可以避免超时异常,但是,有没有办法减少应用程序部署的时间?

I understand that by increasing the timeout I can avoid the timeout exception but, is there a way I can reduce the time taken by the application to get deployed?

还有,造成这种延迟的原因是什么?

Also, what could be the cause of such a delay?

推荐答案

首先,我建议将超时值更改为更高的值.如果我们谈论的应用程序即使在SSD光盘上也只有几百MB,则2分钟的时间并不多(这也很大程度上取决于计算机硬件).您可以在服务器元素中的standalone.xml(或domain.xml)中添加以下代码:

At first, I recommend to change timeout to higher value. 2 minutes is not much if we talking about app with has few hundred MB even on SSD disc(it also strongly depends on computer hardware). You can add in standalone.xml(or domain.xml) in server element following code:

<system-properties>
    <property name="jboss.as.management.blocking.timeout" value="900"/>
</system-properties>

它将超时设置为15分钟.

It will set timeout to 15 minutes.

日志中的巨大漏洞也表明日志记录无法正常工作(除非您设置错误级别或类似级别).

Also huge hole in logs suggests that logging is not working correctly(unless you set ERROR level or something like that).

要加快部署时间,可以执行以下操作:

To speed up deployment time, you can do following:

  • 在C分区上安装wildfly.因此,在磁盘上,您可以获得较大的性能提升(最快的磁盘扇区首先分配给分区).在我的计算机上,C分区上的IO操作比上一个分区快约2倍.我不知道您是否在SSD光盘上获得了性能提升.我建议为IO操作运行基准测试.

  • Install wildfly on C partition. On magnetic disks you can get large performance improvements due to this(fastest sectors of disc are assigned first to partitions). On my computer IO operations on C partition are about 2 times faster than on last partition. I don't know if you get performance improvements on SSD disc. I recommend to run a benchmark for IO operations.

将安装有wildfly的文件夹添加到防病毒软件的排除项中.

Add folder with wildfly installation to exclusions in antivirus software.

在standalone.xml(或domain.xml)中禁用不需要的子系统.默认情况下,Wildfly启用了许多子系统.您可能不需要全部.您可以在以下网站中了解有关子系统的信息: https://docs.jboss.org/author/display/WFLY9/Subsystem + configuration

Disable not needed subsystems in standalone.xml(or domain.xml). Wildfly by default have a lot of subsystems enabled. You probably don't need them all. You can read about subsystems in: https://docs.jboss.org/author/display/WFLY9/Subsystem+configuration

减小安装大小.您可以通过减少第三方库的数量来轻松实现此目的.如果部署您的应用程序,然后转到standalone \ tmp \ vfs \ deployment,则可以看到已部署了每个库实例.如果您在应用程序中有5个guava 18.0库(因为您有许多独立的模块),它们将被部署5次.您可以将一些第三方库放入module \ system \ layers \ base并使用jboss-deployment-structure或global模块将该库附加到战争中.如果您将战争包装在耳边,那么您也可以将一些库从战争摆放到耳边.另外,wildfly在模块中提供了一些标准库.我建议查看此库.可能其中一些已被您使用,您可以从野蝇那里获得它们.

Decrease size of installation. You can achieve this easily by lowering number of third party libraries. If you deploy your app, and go to standalone\tmp\vfs\deployment, you can see that every instance of library is deployed. If you have 5 guava 18.0 libraries in app(because you have many independent modules), they will be deployed 5 times. You can put some of third party libraries to modules\system\layers\base and use jboss-deployment-structure or global modules to attach this libraries to wars and ears. If you package wars in ear, you can also put some libraries from wars to ear. Also wildfly provides some standard libraries in modules. I recommend to review this libraries. Probably some of them are used by you and you can get them from wildfly.

获得更好的硬件,在SSD光盘上,wildfly的部署速度将提高几倍.还要注意RAM的使用情况,如果没有足够的RAM,则OS会在RAM和磁盘之间交换内存,从而大大降低部署速度.

Get better hardware, on SSD disc wildfly will deploy a few times faster. Watch also RAM usage, if you have not enough RAM, OS will swap memory between RAM and disc, with slow down deploying dramatically.

这篇关于如何减少Wildfly部署所需的时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆