I am witnessing a duration of around 90 to 120 seconds for application startup i.e. time between typing
run in SBT prompt and Akka HTTP server startup. Compilation has been done prior to this. This thing has been pretty slow for a long time but I am pretty sure that it has gotten slower during the couple of last years we’ve been developing our app.
I take that the run command loads the app in dev mode and that consists of wiring everything together (I guess this includes things such as configuration and dependency injection). My main problem is that I don’t know how to debug what’s going on. Even if turning Play and SBT debug levels to “DEBUG” there’s nothing printed during this phase.
-Dsbt.task.timings=true does not help in analysis either as this seems to be Play’s internal business.
Some background info: Our app has around 35K LOC (Java & Scala) and consists of a single module. The SBT plugins we have enabled are PlayJava and PlayEbean. Play version: 2.7.3, Scala version: 2.12.9 and SBT version: 1.2.7, Java 11 (OpenJ9), Guice used for DI. Compilation is reasonably fast and so is running functional tests with FakeApplication - the fake app starts up in an instant. I also checked with play-starter scaffold project that it had no such issues so this looks to be specific to our app.
So basically I have two questions:
- What’s specifically going on inside Play during the
runcommand and what performance bottlenecks should I be aware of?
- Any idea how/where to analyse and debug what’s taking time during application startup?