Need feedback about JS usage for App development and backend

Dear All,

I’m planning to develop native mobile app with React Native and backend with node.js.

Can you please let me know if microservices can be written with node.js and is it scalable similar to Java/Scala/Go etc ? I’m expecting 500 - 1000 requests per second.

My intention is to use JavaScript both in FE and BE, so that with smaller team can manage the project.

In case you’ve any writeup, it will be really helpful. Thanks in advance.

Regards,
Vikram

1000 requests/sec is quite a lot, and will require some architecture built out to support it no matter what your backend is written in. At the very least you’ll need some load balancing in front of it, probably a cache layer as well, maybe even a CDN. Once you have your architecture built to scale, it almost doesn’t matter what the backend is written in; wikipedia manages that kind of load with a monolithic PHP app after all. I wouldn’t expect node.js to have the same raw throughput as Go or a well-tuned Java service, but if you keep it to stateless microservices, it should be able to handle significant load.

One of the bigger challenges you’re likely to face at high volume will be keeping GC pressure down: typical javascript tends to create vast amounts of garbage, which isn’t necessarily a problem on its own per se, but a long-running service can turn that into a nightmare if you don’t watch out for it. You’ll want to make use of the CPU and heap profiling tools that v8 has to find any hot spots your services have, preferably before you start throwing 1000 requests/sec at it in production.

1 Like

Yes, a microservice is just a small service, language isn’t of any relevance (you are asking “can an application be written in Node”: the answer is yes). By building it in that fashion you’re dialling up the deployment/operational complexity to 11, but if you want do that :person_shrugging::man_shrugging:

Yes. It is called Node, the name was not picked at random. Multiple nodes are common, ie multiple instances of Node processes.

Regarding requests, yes of course it can do that for (insert possible thing that will work), but it depends entirely on (insert thing you actually need). Pick any language, they all have servers that can handle that many requests if some specific set of conditions are met. Node will handle several thousand requests/second out of the box, no problem (though you will likely get weird system level errors, eg file limits, which can all be fixed by adjusting system settings). But that is with no DB access, no computation etc. What is the use case? That’s a huge number of requests if it’s individual users (ie puts you amongst the largest sites in the world), not as many if it’s something automatic (like a bunch of iot devices).

1 Like

Thanks for your inputs, sorry my initial estimation was quite high & totally wrong.

After revisiting business requirements I came to conclusion, it should be one zero less and should be range of 40 - 60 requests / second.

Yes, a microservice is just a small service, language isn’t of any relevance (you are asking “can an application be written in Node”: the answer is yes). By building it in that fashion you’re dialling up the deployment/operational complexity to 11, but if you want do that :person_shrugging::man_shrugging:

Please share your suggestion/s to keep complexity lower

What is the use case? That’s a huge number of requests

I was wrong with number of requests, it should be range of 40 - 60 requests / second. The app is a e-commerce platform to cater max 10K users/ month.

As a rule, splitting functionality down into lots of small applications makes things much, much harder to manage. Doing so means you’ve just distributed all the different bits of your system across a network. By far the easiest way to make it easier to manage is to not split it down in the first place. Don’t preemptively make everything complicated. You have an application that sits on a server, and you have a client (the React Native app).

Thanks for the inputs.