flow icon indicating copy to clipboard operation
flow copied to clipboard

Increased warm startup times in vLatest compared to v14

Open tarekoraby opened this issue 4 years ago • 15 comments

Description of the bug / feature

The average warm-startup times in latest versions of the framework (e.g. 21.0.1) are appreciably longer than in v14.x (approx. 50% longer).

Minimal reproducible example

Calculate warm-startup times for 14.6.9 and 21.0.1

  1. Download empty project starter (plain Java servlet) from vaadin.com starter service
  2. Update Vaadin version in pom.xml
  3. Remove package.json, package-lock.json, and pnpm-lock.yaml to simulate manually created empty project
  4. Run mvn jetty:run -nsu -Dvaadin.ignoreVersionChecks=true -DskipTests with the correct profile
  5. Wait bootstrap page being served; ignore if devServerIsNotLoaded: true is present (work around live reload)
  6. Download all scripts referenced in the bootstrap page
  7. Terminate maven process
  8. Start timer
  9. Repeat steps 4 to 7
  10. Stop Timer (to collect statistics for a warm run)

Expected behavior

There is no significant difference in the warm-startup performance between Flow versions.

Actual behavior

21.0.1 is significantly slower (approx. 16 sec) compared to 14.6.9 (approx. 10 sec.) to warm start.

Versions:

- Vaadin / Flow version: 21.0.1

tarekoraby avatar Sep 27 '21 10:09 tarekoraby

Test with 21.0.2 as it should be fixed with vaadin/flow#11853 as was for vaadin/flow#11910

caalador avatar Sep 27 '21 10:09 caalador

The same slow warm startup times are observed in 21.0.2 (see the results of the automated performance tests at the bottom of this report).

tarekoraby avatar Sep 28 '21 05:09 tarekoraby

I'm not sure what the Fusion label signifies, but I just want to emphasize that these relatively slow times are observed in pure Flow projects.

tarekoraby avatar Sep 28 '21 07:09 tarekoraby

Fusion has added quite a lot of steps to the webpack build slowing it down from what it was in v14 Also just having a look at the report the situation hasn't really changed from v20 and probably is close to the same with 17,18 and 19. A correct comparison to the times should be in the v15+ versions instead of against v14

caalador avatar Sep 28 '21 07:09 caalador

Also see work done for v19: vaadin/flow#10281

caalador avatar Sep 28 '21 08:09 caalador

A correct comparison to the times should be in the v15+ versions instead of against v14

Yep, that's true. The issue is indeed noticeable since v15+. And it would be great if we could improve it before the next LTS.

tarekoraby avatar Sep 28 '21 08:09 tarekoraby

And to clarify, the issue that I think that we should be mainly concerned with is the DX of someone migrating from V14 to the next LTS.

tarekoraby avatar Sep 28 '21 08:09 tarekoraby

The old issue was created by me.. I'm kinda used to it by now that V15+ needs twice the amount of time to "build".. but I would be happy to get the old speed back as well.

knoobie avatar Sep 28 '21 17:09 knoobie

Im having this issue too. Im trying to migrate a project with more than 4.3K java files from vaadin 8 to vaadin 21.0.2 and the webpack server just doesn't start. Im not able to see any frontend on the Browser after 12 min, when I decide to kill the process. It is an issue related to npm oder webpack? I also set the vaadin.whitelisted-packages prop for the package where the frontend logic will be. But my project is using java files for Flow and .ts files for Fusion.

I have this error

Exception in thread "File Watcher" java.lang.OutOfMemoryError: Java heap space
        at java.util.Arrays.copyOf(Arrays.java:3332)
        at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:124)
        at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:649)
        at java.lang.StringBuilder.append(StringBuilder.java:202)
        at java.io.UnixFileSystem.resolve(UnixFileSystem.java:108)
        at java.io.File.<init>(File.java:262)
        at java.io.File.listFiles(File.java:1212)
        at org.springframework.boot.devtools.filewatch.DirectorySnapshot.collectFiles(DirectorySnapshot.java:63)
        at org.springframework.boot.devtools.filewatch.DirectorySnapshot.collectFiles(DirectorySnapshot.java:67)
        at org.springframework.boot.devtools.filewatch.DirectorySnapshot.collectFiles(DirectorySnapshot.java:67)
        at org.springframework.boot.devtools.filewatch.DirectorySnapshot.collectFiles(DirectorySnapshot.java:67)
        at org.springframework.boot.devtools.filewatch.DirectorySnapshot.collectFiles(DirectorySnapshot.java:67)
        at org.springframework.boot.devtools.filewatch.DirectorySnapshot.collectFiles(DirectorySnapshot.java:67)
        at org.springframework.boot.devtools.filewatch.DirectorySnapshot.<init>(DirectorySnapshot.java:58)
        at org.springframework.boot.devtools.filewatch.FileSystemWatcher$Watcher.getCurrentSnapshots(FileSystemWatcher.java:304)
        at org.springframework.boot.devtools.filewatch.FileSystemWatcher$Watcher.scan(FileSystemWatcher.java:278)
        at org.springframework.boot.devtools.filewatch.FileSystemWatcher$Watcher.run(FileSystemWatcher.java:263)
        at java.lang.Thread.run(Thread.java:748)

HelmerBarcos avatar Oct 05 '21 10:10 HelmerBarcos

@hlbp That's not really related to this issue. Looks more like a problem on the spring (boot) devtool side of things. You probably want to create a issue there, not here.

knoobie avatar Oct 05 '21 13:10 knoobie

@knoobie I just increased the maximum memory value by setting the -Xms4G -Xmx8G args and the OutOfMemoryError did disappear. But the webpack-dev-server is still taking more than 3 mins to start the frontend compilation. In other words. the task on the vaadin/java side that starts the webpack-dev-server is taking a couple of minutes before starting the node process.

HelmerBarcos avatar Oct 05 '21 14:10 HelmerBarcos

@hlbp This sounds like a Spring(-boot) issue. Try starting with mvn spring-boot:run -Pproduction (or add the build-frontend goal to the vaadin plugin to get pseudo dev mode running) and see if the issue persists in the same way. If it does then open up a new ticket for flow with more details, else open a issue in the Spring project with more details or ask from the Spring team if they would have some insights.

caalador avatar Oct 06 '21 04:10 caalador

Now that we have some improvements for this coming with the Vite support, should we close this issue?

platosha avatar Mar 15 '22 12:03 platosha

Let's compare the startup times between vLatest and v14 before making a decision on closing the issue.

tarekoraby avatar Aug 10 '22 07:08 tarekoraby

Here is an updated report of the cold and warm startup times of the different versions: https://bender.vaadin.com/repository/download/DxTutorialStarter_BuildPerformanceTestsRunningInDevelopmentMode/326140:id/human-readable-report.html.

tarekoraby avatar Aug 10 '22 07:08 tarekoraby

@mshabarov, perhaps this issue can be closed after the startup improvements due to the pre-compiled bundle.

tarekoraby avatar Sep 27 '23 08:09 tarekoraby

@tarekoraby we need to reproduce and check.

mshabarov avatar Sep 27 '23 08:09 mshabarov