What kind of application is it?
Next time when you notice that the app is continuously showing loading, That time please collect a set of Thread Dumps (at least 5-6 thread dumps) each should be collected in an interval of around 10 seconds each. So for collecting 6 thread dumps you might need approximately 60 seconds. (please collect it only during the time of the issue).
Also please enable the GC logging on your Server to see if the JVM memory is properly configured?
Which operating system, jvm and wildfly versions are you using and how do you start your server (standalone, domain)?
Do you see any messages in the server.log when the problem shows up?