问题
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?
回答1:
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>
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:
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.
Add folder with wildfly installation to exclusions in antivirus software.
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
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.
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.
来源:https://stackoverflow.com/questions/47406360/how-to-reduce-the-time-taken-for-wildfly-to-deploy