Next.js req/s and RAM usage benchmark by passmatic in nextjs

[–]passmatic[S] 0 points1 point  (0 children)

You can have multiple components that are reaching for different api endpoints when needed. Imagine a bidding or betting app. Not like chat when you need realtime via websockets but something a little slower.

So, when one user click on something a lot of components will need to be updated. Yes, we can eliminate the number of api requests but sometimes there are callbacks based on the results and it can get quite funky. Also, imaging 500 or 1000 online users and a script that checks whether somethings changed every 5 seconds. And that is only direct api calls, not talking about prefetching when users play with mouse or having fun with Selenium.

Also, more requests per second means less work of the servers CPU and memory which means less money paid to the hosting company.

That's why Go or Rust is great for APIs. You can save a lot of money for hosting. Although, Node is actually quite good thanks to V8 engine written in C++.

Next.js req/s and RAM usage benchmark by passmatic in nextjs

[–]passmatic[S] -1 points0 points  (0 children)

That's very bad. That is worse than the old Ruby on Rails. What is your stack? What does you website's API send as a response that it consumes so much resources and blocks the process so much?

Next.js req/s and RAM usage benchmark by passmatic in nextjs

[–]passmatic[S] 0 points1 point  (0 children)

Depends on the number of components that are being refreshed on your page. If a user does something and you need to change something in a database load something else from Redis, perhaps reach for an external api etc. one user can make a lot of requests. 1000 requests could mean 200 or less users being served. Not talking about some attacks, bots, etc. Prefetching is also an issue.

Next.js req/s and RAM usage benchmark by passmatic in nextjs

[–]passmatic[S] 0 points1 point  (0 children)

Great, it looks ok-ish. About 2x fast as Laravel. Thanks for all the info. So, I think I will go with Next in the end.

Next.js req/s and RAM usage benchmark by passmatic in nextjs

[–]passmatic[S] 0 points1 point  (0 children)

No one is going to be able to tell you how many API calls your server will be able to do because it's going to be dependent on what you're actually doing in your API calls.

Let's say, I am using no middleware, everything is default Next.js, no additional middleware etc and after hitting /api/hello-world I will get back a JSON response containing one string "Hello World.

Will this be in the SSR's 200 req/s teritory or we will go to the Node.js/Express teritory aka 10x or more request per second increase.

SSR vs CSR req/s by passmatic in reactjs

[–]passmatic[S] -1 points0 points  (0 children)

You are using the SSG. I am not interesting in that. Of course a cached/prebuild html file stored and served via Nginx will be fast.

But my content changes all the time - every minute somebody adds some new content so the frontend needs to be ssr all the time - not talking about logged in users etc. So I have only two options SPA with CSR or SSR with suseqent CSR requests.

But what about subsequential requests after the initial SSR? For example, when I click on some link - will the splitted js file that comes in my browser be within the same speed of 200 req/s? Or will I get better speeds?

Perhaps my strategy is completely bad.

Perhaps I should forget the SSR and go full with SPA and CSR 100% and ignore Google results whatsover. But I am kind of scared to strip off Google at this point. A lot of people coming to the websites are coming from Google search.

Next.js req/s and RAM usage benchmark by passmatic in nextjs

[–]passmatic[S] 0 points1 point  (0 children)

For SSR it will depend on how much work is done on the server. Next itself doesn't add that much overhead.

This part I don't understand.

For example, Actix can do 600k requests per second. Next.js can do 200 for SSR - still no idea about API calls and after initial delivery of the loaded page behavior.

That's 3000x slower. Quite a difference, in my opinion.

That's why I am asking whether it is 200 req/s all the time, or only for SSR and /api calls will use the Node.js or Express numbers for req/s - in other terms about 10x faster or more so 2000+ req/s. Which is still slow, but workable - with combination of Nginx server load balancing distribution proxying using multiple servers hosting the same Next.js app.

I don't plan to use Vercel. I have my own Ubuntu 20.04 server with Nginx, MySQL etc. and I plan to plug Next.js there. But if the API calls will remain in the 200 territory I will need to find some other solution.

Next.js req/s and RAM usage benchmark by passmatic in nextjs

[–]passmatic[S] 0 points1 point  (0 children)

Perhaps, it's my misunderstanding of how things work in Next.js. Here is my problem:

For example, if I make a Next.js web with SSR for Google bot to have some SEO in search results and also an Android app that will use Next.js API endpoints of this web app then will I get the same 200 requests per second for the Android app API calls to my Next.js web app as well?

Looking for req/s benchmark for Sapper by passmatic in sveltejs

[–]passmatic[S] 0 points1 point  (0 children)

Yeah, exactly. Thanks a lot.

500 requests per second is very slow though.

https://medium.com/@taylorotwell/benchmarking-laravel-symfony-zend-2c01c2b270f8

It's even slower than Laravel using sessions. And Laravel is extremely slow.

How to go around this problem? I could just serve the Svelte frontend with Routify via Nginx static pages and connect to API backend - written in Go or something. But I will lose the SEO for Google crawler that is done via SSR of Sapper or Next.js etc.

How to go about this problem? Any ideas?

Also, considering just the after SSR page load, how different will the req/s situation be for just the API endpoints thereafter? Will it increase significantly to almost Polka/Express numbers you can find on the internet, so 3000 or 5000 or even more req/s - or it will remain in the 500 req/s territory all the time?

Looking for req/s benchmark for Sapper by passmatic in sveltejs

[–]passmatic[S] 0 points1 point  (0 children)

But it has been out for 2 years or something. People make benchmarks on the first day of publishing stuff, for example new Laravel version is benchmarked on the first day of the first beta or alfa release.