hilla icon indicating copy to clipboard operation
hilla copied to clipboard

Start the application is ridiculously slow

Open haijian-vaadin opened this issue 4 years ago • 17 comments
trafficstars

In the DX Testing session today, we found that starting the application is ridiculously to start, well over 1 minute. Below the environment the tester had.

MacOS Node.js v12.16.3. npm 6.14.4 pnpm not found jdk-11.0.4

The testing application can be downloaded from here

haijian-vaadin avatar Dec 15 '20 12:12 haijian-vaadin

The delay was experienced during devmode initialization ("The frontend development build has not yet finished. Please wait.") and it was observed that Webpack reported over 60 seconds to complete bundling the frontend assets. In the normal case, this step is expected to take no longer than 10 - 20 seconds with pre-populated node_modules. In the problematic envinronment, the slow startup problem occurred during each server start.

joheriks avatar Dec 15 '20 13:12 joheriks

Incidentally, 60 seconds is the timeout devmode handler waits for : Compiled. or : Failed to compile. pattern.

fluorumlabs avatar Dec 15 '20 20:12 fluorumlabs

This case seems to be related to Google Meet taking too much resource at the same. I think we can close this now, in case more slowness case is found, we can reopen this one or create a new one.

haijian-vaadin avatar Dec 16 '20 10:12 haijian-vaadin

Agree that the underlying is unsolved, and may require more investigation. At the same time, in lieu of having a consistent way of reproducing the issue the ticket cannot progess (analogously, might as well say that "it only fails on your computer"). So I think it should be re-opened only when he have a recipe for reproduction.

joheriks avatar Dec 16 '20 14:12 joheriks

Can it be some issue with connection? In case that Google Meet takes not only CPU but also network connection resources.

tdq avatar Dec 16 '20 14:12 tdq

Can it be some issue with connection? In case that Google Meet takes not only CPU but also network connection resources.

Network connection should AFAIK not affect Webpack bundling times, and probably not impact node_modules resolution either with hot pnpm cache (though the latter was not an issue here).

joheriks avatar Dec 16 '20 14:12 joheriks

To isolate the problem, let's try the following:

  • Start Google Meet with screen sharing (to reproduce initial environment)
  • Start development mode and check time it took to spin up (from the logs)
  • Stop the application
  • Run webpack manually through command line and measure the time

If times are similar in both cases - the problem is not under our control and most likely lies within webpack or node.js. Otherwise, something is not right in our code.

fluorumlabs avatar Dec 16 '20 14:12 fluorumlabs

Tested following scenario:

  1. Google Meet in Chrome presenting single IDEA window, one participant viewing
  2. Started above app in IDEA, Webpack reported Time: 12006ms and DevModeHandler Started webpack-dev-server. Time: 14700ms
  3. Stopped application and ran Webpack dev-server manually. Reported Time: 12014ms.

So there's a couple of seconds before DevModeHandler reacts but nothing conclusive to indicate a dramatic slowdown. Of course given that DevModeHandler runs in a separate thread nothing can be ruled out either, may be due to unlucky nondeterminism.

joheriks avatar Dec 16 '20 14:12 joheriks

What about times without Google Meet running?

fluorumlabs avatar Dec 16 '20 14:12 fluorumlabs

let's reopen the ticket then

haijian-vaadin avatar Dec 16 '20 14:12 haijian-vaadin

Without Meet running: Somewhat faster, not a dramatic difference, but we may be on to something:

  • In app: Time: 8506ms, Started webpack-dev-server. Time: 10817ms
  • Webpack stand-alone: Time:8168ms

On my system (2019 MBP 32 GB 2667 MHz DDR4 6 core) this difference is reproducible, also when the Meet is running with no participant. Chrome was consuming about 30% according to top during the Meet.

joheriks avatar Dec 16 '20 14:12 joheriks

Well, it looks like the conclusion is that DevModeHandler is not the culprit, so not sure what we can do about it.

joheriks avatar Dec 16 '20 14:12 joheriks

Looks like the problem is not on our side. Still would be nice to hear results from @tdq, who originally experienced that problem, just to confirm that the problem is not with devmode-webpack combo, but in webpack/nodejs itself. I'd like to rule out possibility that there is some environment-specific thing that affects performance of our setup.

fluorumlabs avatar Dec 16 '20 15:12 fluorumlabs

Any solution to the slowness issue?

I downloaded sample project and it takes a lot, more than a minute for a HelloWorld.

jonasrotilli avatar Jan 19 '22 17:01 jonasrotilli

The linked sample project does not exist so I do not think this issue is actionable without some additional information and an example project

Artur- avatar Jan 19 '22 17:01 Artur-

O projeto de exemplo vinculado não existe, portanto, não acho que esse problema seja acionável sem algumas informações adicionais e um projeto de exemplo

The example project is the one provided by the official vaadin website. https://start.vaadin.com/app/

I don't think you need to add it, since it's public and it's the first start that any user will do.

jonasrotilli avatar Jan 19 '22 18:01 jonasrotilli

O projeto de exemplo vinculado não existe, portanto, não acho que esse problema seja acionável sem algumas informações adicionais e um projeto de exemplo

The example project is the one provided by the official vaadin website. https://start.vaadin.com/app/

I don't think you need to add it, since it's public and it's the first start that any user will do.

No documentation, for example, this delay in compilation is very unproductive. Has anyone managed to overcome this problem? I use Intellij, is there any secret to not having to re-compile the Frontend of the Starter SpringBoot project? What takes the longest is this part, "Starting Frontend compilation".

jonasrotilli avatar Jan 20 '22 13:01 jonasrotilli