-
Any Pointers on How Can I Speed Up my Node.js Application?
over 8 years ago
-
over 8 years ago
I suppose with speedup you mean serving too many clients without slowing down your server. One response will always take the time it needs, the question is for a response not to wait until another finishes. You cannot speed up nodejs more than it is capable (assuming you have written the most performant code possible), but you can scale your application. Some steps i can suggest: 1.put nginx in front of node for load balancing 2.run node app in different ports as many times as processor cores you have (if in the same machine with nginx, leave smth for it) 3.setup some speedy mechanisms for shared states of your app 4. setup your backend db the same way as node load balancing
this way you can multiply the number of clients served in a certain time and (the most important) be able to rescale horizontally without much pain. br Armando
-
over 8 years ago
I'd start by profiling the app to work out which parts take the most time and so are worth optimizing. Node has a profiler built in that's pretty easy to use...
https://nodejs.org/en/docs/guides/simple-profiling/
-
2 Answer(s)