It is possible to have multiple threads on nodejs? I am using expressjs and multer for image upload. When an image have big size and webpage needs another request to be accomplished, it waits until image get uploaded. It's possible to make image upload use other thread?
Node.js focuses on asynchronous processing. It is capable of accepting an image upload and servicing other requests at the same time. If it is not doing that it is because your code is doing some kind of synchronous processing. There is a cluster
module for running the same node.js code across multiple processes (rather than threads); but it is not what you want. You may find it interesting to understand the difference between concurrency and parallelism. That article is focussed on the Go language so you don't get hung up on node.js specifics. You don't need another thread - you need to better understand the way node.js works. Perhaps you could post the relevant parts of your code in another question for more specific feedback.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With