#useFetch() struggles to handle heavy concurrent requests

28 messages · Page 1 of 1 (latest)

long copper
#

I have an App written in Nuxt3 and recently I noticed that my app can't handle heavy concurrent requests. I tested my app with K6 Load Tester and I realized that useFetch is the problem.

I removed data fetching code from Script and the performance was way way higher than before.

Afterwards, I run my API on my local machine and tested again; the results were the same.
(My API responses under 100ms)

My question is: How apps should optimize to handle large number of users?

#

useFetch() struggles to handle heavy concurrent requests

rigid hinge
long copper
rigid hinge
long copper
#

Thank you for your response, I will take your advice to account.

Quick Update: I have change the JS runtime to Deno.js and the results were significantly better.

Can you please send me a reference to follow SWR? How can I implement it with Nuxt?

rigid hinge
rigid hinge
night girder
#

@long copper how are you deploying?

long copper
long copper
night girder
#

a single instance? or clustered?

long copper
night girder
#

have you tried bun? 🙂 it's very fast

long copper
#

Yes I did 🙂
Don't know why, but the performance was not good, It was close to Node.js

night girder
#

interesting, how were you running it?

long copper
#

I installed packages with bun package manager and built it with 'NITRO_PRESET=bun' present. Finally, It runs with
'bun run ./.output/server/index.mjs'

long copper
#

Test results with Deno

night girder
#

well yeah if deno is clustering itself

#

bun is much faster if you look at the numbers outside of the duration/waiting, which is where clustering would have an effect

long copper
night girder
#

how much load are you throwing at how many instances?

long copper
night girder
#

so around 8 requests per second per instance (~45 requests per second)

#

what are the host machine specs?

long copper