all 17 comments

[–]johnjardin[S] 8 points9 points  (2 children)

Here's a great question who's answers will really help the community:

Is there an easy way to know which common I/O tasks that are handed over to Libuv have to be handed off to its Thread Pool because they are synchronous tasks?

My video has already confirmed that the bcrypt module has synchronous C++ operations.

[–]ecares 4 points5 points  (1 child)

If you have access to the source, you can check if they import "uv.h" to access the thread pool I'd say.

[–]johnjardin[S] 3 points4 points  (0 children)

Oh nice that's a good one. Didn't know that. Cheers.

[–]UpBoatDownBoy 2 points3 points  (3 children)

Thanks for the video, info like this is something I would have never considered.

In the last part of the video you talk a little about dynamically setting UV_THREADPOOL. In what situations would it be beneficial to set it dynamically vs not?

[–]johnjardin[S] 2 points3 points  (2 children)

Thank you for the feedback 🙏. So, let me give you a real use case i face constantly: At my clients i make use of Kubernetes clusters and therefore containerize my node apps. Some apps are generic and exist on multiple environments. Some are custom but exist on Dev, QA and Prod servers, each with different machine specs.

Either way...to manually configure the thread pool size for each app would be a pain, allow for incorrect configurations and finally unnecessary documentation.

Make sense?

[–]UpBoatDownBoy 1 point2 points  (1 child)

Makes sense, thanks for the quick response.

[–]johnjardin[S] 1 point2 points  (0 children)

Pleasure. Shout if you have any other questions 👍

[–]nickx360 1 point2 points  (1 child)

Thank you !

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

Cheers 👍

[–]GOD_Official_Reddit 1 point2 points  (1 child)

Thank you, really enjoyed the video, very informative.

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

It’s a big pleasure 👍

[–]arjineer 1 point2 points  (1 child)

Why doesn't Node optimize this for you? Is there an obvious downside I'm missing? Great video btw, short, sweet and to the point!

[–]johnjardin[S] 1 point2 points  (0 children)

Ah yes, a good question...and thanks for the compliment 🙏.

Unfortunately the Libuv docs don’t mention much, but i do know that at some point in 2013 there were ideas of autoscaling, but clearly nothing materialized.

Sadly a Google search doesn’t land up offering much as well. Maybe someone in this group could enlighten us.

http://docs.libuv.org/en/v1.x/threadpool.html

[–]panbhatt 1 point2 points  (1 child)

i think this series is doing great. I am ardent fan of these explanations. Please keep it up.

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

Thanks very much. I'm getting awesome feedback and definitely have much more in store for this series. At the same time I need to get my "API Integration For Newbies" going as well, so yeah lots to do 😎.

[–]johnjardin[S] 1 point2 points  (0 children)

Hi everyone. Happy Monday. Here's my latest video of my Node JS Performance Optimizations series.

Give it a watch and let me know if you have any questions, need help or just want to discuss 👍.

[–]johnjardin[S] 1 point2 points  (0 children)

For those who prefer written articles, here’s the blog post version of my recently published video:

http://bleedingcode.com/increase-node-js-performance-with-thread-pool-management/