8000 Performance degradation when using many routes in comparison to Nuxt 2 · Issue #25612 · nuxt/nuxt · GitHub
[go: up one dir, main page]

Skip to content
Performance degradation when using many routes in comparison to Nuxt 2 #25612
@BobbieGoede

Description

@BobbieGoede

Environment

n/a

Reproduction

I adapted and simplified reproduction from #25362 to generate ~1100 routes, all routes share the same component/page (index). I have kept the projects pretty much empty or unchanged other than that.

Nuxt 2
https://stackblitz.com/edit/github-4f1tg8?file=nuxt.config.js

Nuxt 3
https://stackblitz.com/edit/github-ibrygb?file=nuxt.config.ts

Build each project and test the performance of each project using ab or siege and compare the results. The projects can be built again while passing PATH_MULTIPLIER (default: 100), this way you can rebuild the projects with more or fewer routes to see how that changes the results.

Describe the bug

111 routes (PATH_MULTIPLIER=10)

  • Running siege -t 10s -c 100 "http://localhost:3000/"
  • Results here are comparable
Nuxt 2 Nuxt 3
Transactions 13634 hits 10573 hits
Availability 100.00 % 100.00 %
Elapsed time 9.82 secs 9.54 secs
Data transferred 246.55 MB 827.06 MB
Response time 0.07 secs 0.09 secs
Transaction rate 1388.39 trans/sec 1108.28 trans/sec
Throughput 25.11 MB/sec 86.69 MB/sec
Concurrency 99.51 99.27
Successful transactions 13634 10573
Failed transactions 0 0
Longest transaction 0.33 0.43
Shortest transaction 0.01 0

1101 routes (PATH_MULTIPLIER=100)

  • Running siege -t 10s -c 100 "http://localhost:3000/"
  • Nuxt 2 requests took ~2x longer than previous scenario
  • Nuxt 3 requests took >10x longer than previous scenario
Nuxt 2 Nuxt 3
Transactions 7047 hits 668 hits
Availability 100.00 % 100.00 %
Elapsed time 9.09 secs 9.27 secs
Data transferred 138.23 MB 85.60 MB
Response time 0.13 secs 1.28 secs
Transaction rate 775.25 trans/sec 72.06 trans/sec
Throughput 15.21 MB/sec 9.23 MB/sec
Concurrency 98.71 92.08
Successful transactions 7047 668
Failed transactions 0 0
Longest transaction 0.64 2.66
Shortest transaction 0.01 0.04

I also ran tests using ab with ab -n 1000 -c 50 http://localhost:3000/, leaving results out for legibility (and formatting is tedious).

Additional context

Users migrating from Nuxt 2 to Nuxt 3 while using the Nuxt I18n module experience memory and performance issues, due to the way routes are generated for i18n it results in the amount of routes in a project multiplied by the amount of configured languages.

Of course I will be looking into ways to improve this on the i18n module side, but as it is, the amount of routes in a project has a large impact on its performance, much more so in Nuxt 3 than in Nuxt 2.

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0