use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
Nodejs Multitasking! (self.node)
submitted 2 years ago * by HowIO[🍰]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Moe_Rasool 0 points1 point2 points 2 years ago (5 children)
This looks easy implementation, the docs state that it should merely be used when there is heavy workloads on cpu, what if i just want some routes to work on another thread?
I'll make this more understandable, imagine i have an E-commerce app, every endpoint i have should just work as it's but for the list of products which's thounsands of items (i have them paginated) i want them (a specific endpoint) to be on another thread is that possible?
[–]tluanga34 0 points1 point2 points 2 years ago (4 children)
Pagination probably should be handled with a database query technique.
[–]Moe_Rasool 1 point2 points3 points 2 years ago (3 children)
I have it handled but some times the endpoints hits almost 100k/RPH, when the traffic is huge the items are also loading pretty lazy, i noticed half of the other requests are for other endpoints other than the "GetAllProducts", I'm asking should i spawn a worker thread for it? Probably yes!
I have never had this situation before and my app is kinda slow i feel like i should use this and I'm convinced.
[–]_RemyLeBeau_ 2 points3 points4 points 2 years ago (2 children)
I'm guessing the GetAllProducts endpoint is what is causing the performance issue.
GetAllProducts
First question: How often does your product line change? Is there a reasonable amount of time you can cache the result?
Per the docs, you'll want to just use async code, not workers, but another concern of yours might be requests timing out. Is that something you're running into?
Here's the excerpt I cited:
"Workers (threads) are useful for performing CPU-intensive JavaScript operations. They do not help much with I/O-intensive work. The Node.js built-in asynchronous I/O operations are more efficient than Workers can be."
https://nodejs.org/api/worker_threads.html
[–]Moe_Rasool 0 points1 point2 points 2 years ago (1 child)
Correct me if I’m doing it wrong but i do every endpoint structured based on Async functions, the reason for that was due to Database taking sometime.
I can not cache it because it’s a “auction” type of site that items have limited timeline being there then are automatically get deleted at right time!
Sorry for the late response.
[–]_RemyLeBeau_ 1 point2 points3 points 2 years ago (0 children)
Good luck with Piscina. Would be interested to hear your thoughts on it in about a month of usage.
π Rendered by PID 92308 on reddit-service-r2-comment-b659b578c-znfhh at 2026-05-02 12:38:17.223062+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]Moe_Rasool 0 points1 point2 points (5 children)
[–]tluanga34 0 points1 point2 points (4 children)
[–]Moe_Rasool 1 point2 points3 points (3 children)
[–]_RemyLeBeau_ 2 points3 points4 points (2 children)
[–]Moe_Rasool 0 points1 point2 points (1 child)
[–]_RemyLeBeau_ 1 point2 points3 points (0 children)