Next.js Discord

Discord Forum

Low SSR Performance

Unanswered
Asari posted this in #help-forum
Open in Discord
AsariOP
Hello. Today we faced DDoS attacks, and this forced us to look for reasons why the site went down so quickly. It turned out that it can't handle more than 500 RPS if we fetch data on the server and pass it to a client component (for example, fetching the list of AI models in the server-side Navbar and passing it to the client-side Search component). As soon as we started fetching data on the Search component's side via Server Actions, the RPS increased to about 2500.

Why does this happen? We're using NextJS 16, pre-rendering, and caching via "use cache". I thought that fetching data in a server component and passing it to a client component one was a normal practice.

Can you help with this?

8 Replies

this is interesting. are the "fetching list of AI models in server-side" cached?
@alfonsüs ardani this is interesting. are the "fetching list of AI models in server-side" cached?
AsariOP
Yes. The method for fetching the list was cached using the Next.js 16 "use cache" directive, and inside it made a fetch request to our API. I added logging - the message only appeared once.

The most interesting part: if I just called the method to get the list of models, everything was OK (with an unused variable RPS ~2500). But as soon as I passed it into <ModelSearch models={models} />, the RPS dropped to 500
Even if ModelSearch is almost empty and we simply pass this data into it without using it, the RPS still drops to around 500
:pikachu_shocked:
AsariOP
@alfonsüs ardani :meow_peek:
@Asari <@194128415954173952> <:meow_peek:763826915991224381>
I have no clue about this lol. Might want to elevate to github discussion or github issue
Maybe ure passing too big of a props from server to client?
React needs to serialize the items first when it is being transported from server to client props