When and when not to use Node.js - Node.js Basics [06] - Java Brains

  Рет қаралды 365,260

Java Brains

Java Brains

Күн бұрын

Пікірлер
@femaledeer
@femaledeer 4 жыл бұрын
Having an explanation of the technology before diving into the code is extremely useful. A lot of youtube channels don't explain anything.
@raymrash
@raymrash 4 жыл бұрын
absolutely
@SirajAhmed-zn8eh
@SirajAhmed-zn8eh 4 жыл бұрын
Get "Learn and understand NodeJS" by Anthony Alicea on Udemy. It's a gem. Takes apart NodeJS and explains its basic behaviors.
@YouilAushana
@YouilAushana Жыл бұрын
Others can be, Unapologetically greedy.
@brunobernard86
@brunobernard86 4 жыл бұрын
Hey, you need to do a series on "When and when not to use". Very interesting :)
@hichamo-sfh177
@hichamo-sfh177 4 жыл бұрын
Yes that's a good suggest
@ayanSaha13291
@ayanSaha13291 4 жыл бұрын
Dear Koushik, You are outstanding as always. I could not find a single person who speaks technology as simply as you do. I have been following you for more than 7 years now. I truly appreciate your efforts. Thank you.
@carlosbarbier2401
@carlosbarbier2401 4 жыл бұрын
I have been working with node js for a while but this tutorial is one of the best tutorials out there. Thanks for sharing your knowledge
@liamsmith-yp3xh
@liamsmith-yp3xh 4 жыл бұрын
when to use: "do this then this, then this, then this" when not to use: "generate every prime number up to 100000000000000000000000000000000000000000000000"
@hattrickster33
@hattrickster33 4 жыл бұрын
At that point, you would be using C lol
@raushonmunni2633
@raushonmunni2633 3 жыл бұрын
I tried to do that once.
@mykola5669
@mykola5669 4 жыл бұрын
That's the best "how, why and when" video about programming languages I saw by this day. Well done!
@MrSidMan
@MrSidMan 4 жыл бұрын
When NOT to use Node.JS: When your client insists you use PHP.
@ask4funs_solution
@ask4funs_solution 4 жыл бұрын
hahahaha
@tdias25
@tdias25 4 жыл бұрын
i bet you "work" with wordpress
@dayvie9517
@dayvie9517 4 жыл бұрын
When your client insists that you should "destroy an already existing wordpress solution"
@leimococ
@leimococ 4 жыл бұрын
so true
@nexovec
@nexovec 4 жыл бұрын
LOL
@SachinKumarSahu
@SachinKumarSahu 2 жыл бұрын
Having experience of working in Node for last couple of years, but some info in this tutorials are complete GOLD
@ibrahim47
@ibrahim47 4 жыл бұрын
Great video, one thing to add is it's commonly used in distributed systems. thanks to its non-blocking ability and asynchronous behavior. this is why is it called node after all. because a nodeJs server is just a node among other nodes.
@karthik-ex4dm
@karthik-ex4dm 4 жыл бұрын
One of best explanations of event driven model of Node.js Eagerly waiting for the next video
@sumathisreebaskarrao1547
@sumathisreebaskarrao1547 3 жыл бұрын
You are a life saviour Mr.Koushik !
@simomed5002
@simomed5002 4 жыл бұрын
wow being more than 10 years in web development... I like how simply you explain the details! keep moving bro, I'm definitely following your tutorials and moving to node js from the programming language I'm using right now, also I subscribed to your channel :)
@estessaouira1900
@estessaouira1900 4 жыл бұрын
compute intensive is no more problem for nodeJs due to Worker Threads on node 10.5.0 .
@manikanth2166
@manikanth2166 4 жыл бұрын
Still it carries the javascript overhead which is quite negated with io bound concurrency. And 70% of the real world business require that io bound concurrency.
@johndoe-gt4rx
@johndoe-gt4rx 3 жыл бұрын
@@manikanth2166 yeah it really depends on the size of the project/business as well. Node is so quick and painless to develop for that it's worth using for almost any app that will have a small userbase. I've even just gone and created microservices with GO that sit on the same box and communicate with the main node web server through a REST api.
@tsunekakou1275
@tsunekakou1275 4 жыл бұрын
you got one mistake there, asynchronous doesn't have anything to do with multi-threading. it is possible to do asynchronous calls in a thread pool. you can have threads execute mutiple event loops, process non-blocking i/o calls, and no thread have to wait for IO (unless you call synchronous/blocking operation). asynchronous i/o operations are offered by the operation system, there is no rule dictate you need to use single thread model or muti-thread model to use these async API.
@piotrgoabek6166
@piotrgoabek6166 4 жыл бұрын
But, I guess, it's often put like this - if you have a multhithreaded framework, go ahead and use the luxury of a blocking model. The resulting code is more clean and decoupled.
@tsunekakou1275
@tsunekakou1275 4 жыл бұрын
​@@piotrgoabek6166 .net support non-blocking i/o api out of the box with async/await (sort of like coroutine). the benefits of coroutine is that you have a nice synchronous-like control flow, look really clean, easy to reason about even in multithreaded environment. other example is boost::asio in C++ support coroutine, callbacks, proactor model, blocking and non-blocking operations and possible to decouple with template. it's often like this, if you have a multhithreaded framework, go ahead and use the luxury support of non-blocking api, the resulting code might be efficient, might be clean if you know what are you doing. the point here is multithreading with asynchronous is possible, there are framework support these thing. to be honest, i think people that write multithreaded program will use non-blocking i/o if they can, their concern is performance. you can write clean, decoupled asynchronous code in multithreaded, because again these things aren't really relate.
@gravy1770
@gravy1770 4 жыл бұрын
He did not conflate the two though. He used examples of typical situations where synchronous calls are used with multi threading and asynchronous calls are used with single threading. His diagram of a thread pool even shows an asynchronous call being made
@omg_look_behind_you
@omg_look_behind_you 4 жыл бұрын
when exactly did he claim this?
@tsunekakou1275
@tsunekakou1275 4 жыл бұрын
@@omg_look_behind_you 6:50 , 7:17 "it has to wait". he did mention at 7:26 "thread pool with `synchronous` execution has that kind of behavior". he tried too hard on selling nodejs's singlethread model by compare it with a very inefficient multithread model and failed mention about multithread with asynchronous. yes, he didn't claim mutlthread models can't do asynchronous. I won't discuss this anymore, he didn't even bother to comment, so it's a negetive-sum game.
@asifmahmood9358
@asifmahmood9358 4 жыл бұрын
This channel should be renamed as tea with java brain... Ur doing awesome work love from Pakistan
@alexandertarasenko3038
@alexandertarasenko3038 4 жыл бұрын
It is pleasant to find Java devleoper who doesn't just blame javascript) Thank you for this movie!
@sytranvn
@sytranvn 4 жыл бұрын
In fact node can use multiple cores if needed. But it is hidden from the developer's view and taken care of by libuv.
@seanb9949
@seanb9949 5 ай бұрын
Very clear explanation sir. I loved every minute of this video and walked away feeling like an expert.
@XiaZ
@XiaZ 4 жыл бұрын
In a multithreaded environment: Many waiters take orders from the customer and wait at the kitchen for the food to be prepare before delivering it to the table, order by order. In Node.js environment: One single waiter takes the order and then tell the cook what to prepare, and only when the food is done, come back and take it to the table. PS. Node.js can also have more than one waiter, the waiter is just smarter by not waiting at the kitchen ;)
@hariwarshan931
@hariwarshan931 4 жыл бұрын
Ok then what is the one who is actually preparing the food. for example am asking 5 different data which is in mongodb through 5 requests and so who is actually getting the data from mongodb ( who prepares food ). Is that a separate process ?
@XiaZ
@XiaZ 4 жыл бұрын
@@hariwarshan931 It depends on number of workers handing the stove you have. In case of MongoDB, this number will be equal to core count on your DB server. waiter can submit the order to kitchen and then go back to his work, and depend on number of cook you have, they'll start preparing the food by order, when done, waiter go back to get the food to the table.
@shaileshsingh5664
@shaileshsingh5664 4 жыл бұрын
NICE lets make this lockdown a little educational and knowledgeable
@codeblueocean3520
@codeblueocean3520 3 жыл бұрын
I learnt mern from online courses but understood the core architecture/logic from this video.thankyou very much
@aakashggujju
@aakashggujju 4 жыл бұрын
Man you are the best and let me tell you that listening to you is always blissful and let me tell you that you are an awesome teacher and always make things simple and cool for listener's. Thanks. 🙏
@sneak9407
@sneak9407 2 жыл бұрын
You deserve more likes and views for the great analysis on node in this video.
@MultiMtech
@MultiMtech 2 жыл бұрын
I was also Java Programmer and loved to write java programs... But since I started learning NodeJS, I really get in love with Node.Js specially with Nest.JS Framework...
@devdylan6152
@devdylan6152 4 жыл бұрын
you covered this SO WELL... like you hit all the proper keys and put it all in a easy to digest manner, I will be using this to explain this to people D:
@mechenzyhammah3001
@mechenzyhammah3001 4 жыл бұрын
You are the best teacher online. Like 👍
@gokulraja2006
@gokulraja2006 4 жыл бұрын
This is the best tutorial I have ever seen.
@philheathslegalteam
@philheathslegalteam 4 жыл бұрын
This has to be the best explanation of NodeJS yet.
@flyingleaves5480
@flyingleaves5480 3 жыл бұрын
Most informative I've seen so far... Thank you
@MrJonathandsouza
@MrJonathandsouza 2 жыл бұрын
You can always use process manager like pm2 to spawn multiple instances of your node app and then act like a load balancer.
@Dev-Siri
@Dev-Siri Жыл бұрын
this is a good enough approach, although processes are heavier than real multi-threading. Worker threads solve this well but they have a funny api.
@subhadas7502
@subhadas7502 4 жыл бұрын
5:37 'javascript is asynchronous' is quite misleading, But well-covered use cases of node js.
@hailahong3021
@hailahong3021 4 жыл бұрын
Abdelmalek BELAÏD Js is synchronous all the way. It’s the chrome engine that handles the asynchronous parts.
@behzadghorbanny7657
@behzadghorbanny7657 4 жыл бұрын
@@hailahong3021 well we're talking about node.js as a whole here.
@hailahong3021
@hailahong3021 4 жыл бұрын
Behzad Ghorbanny and nodejs use chrome engine to handle the async parts. What are you trying to say? It’s a framework, it doesn’t change how the language works.
@behzadghorbanny7657
@behzadghorbanny7657 4 жыл бұрын
@@hailahong3021 err.. I thought you were saying node.js is synchronous because js is synchronous. My bad.
@techyintelo9556
@techyintelo9556 4 жыл бұрын
@@hailahong3021 Node js isn't a framework
@aki1840
@aki1840 Жыл бұрын
Great explanation! Unbiased opinion on Node. I’m tired of all these haters 😂
@ragingpahadi
@ragingpahadi 4 жыл бұрын
i like this series when and when not ! :D "Just because you can do it doesn't mean you should do it"
@jenishvadodaria2888
@jenishvadodaria2888 3 жыл бұрын
You are a gem for Providing us with this example. Thank you!!
@ernestmolner18
@ernestmolner18 3 жыл бұрын
You can make node multi thread if you want to. It is not usually that way but there are modules that make it as multi thread as you want it to be.
@jeronimoolivavelez1299
@jeronimoolivavelez1299 4 жыл бұрын
Great Explanation. It is important, not only to know the code language but also learn which code is better to put in use depending the context of the app you are going to develop.
@headlights-go-up
@headlights-go-up 3 жыл бұрын
As someone new, you explained this so well. Thank you!
@hyperborean72
@hyperborean72 4 жыл бұрын
Why we can not process that math calculation 4:25 asynchronously the same way as io calls? Is it because this type of work is not delegated to some external service?
@keshavrastogi5005
@keshavrastogi5005 4 жыл бұрын
that was really great. I was confused whether to use node.js or not, but now I am clear :) Thanks! :)
@abdelmalek8045
@abdelmalek8045 4 жыл бұрын
What i retain is that Node is well designed for I/O intensive systems, certainly the reason of its success in widely used microservices architecures. Gonna learn it. Thanks!
@sarahchohan6583
@sarahchohan6583 3 жыл бұрын
Very well explained. After watching this video had subscribed to that channel for upcoming videos.
@ViralKiller
@ViralKiller Жыл бұрын
I guess you could use WASM for the processor intensive stuff
@hyperborean72
@hyperborean72 4 жыл бұрын
How nice that the color of your jacket is the same as the color of the font and the frame in your presentation
@erinmcgowan7980
@erinmcgowan7980 4 жыл бұрын
The ammount of info in here is amazing =)
@alexisaddicted
@alexisaddicted 4 жыл бұрын
I think that for this video is great at explaining basic concepts in a simple way. Good job!
@kaleemullahnizamani7436
@kaleemullahnizamani7436 4 жыл бұрын
Loving you since your first video of servlets. You shine 😎
@KennedyEcheverry
@KennedyEcheverry 10 ай бұрын
very good explanation! Thanks.
@KuroManX
@KuroManX Жыл бұрын
You can use the client side with some react/vue/svelt to handle complex calculation, it's not ideal, but can help
@sivakumarg98
@sivakumarg98 3 жыл бұрын
hey nice explanation dude, specifically when not to use, lovely :)
@sumitdas-kr6fe
@sumitdas-kr6fe 4 жыл бұрын
Very good explanation.
@ankitkalavagunta8951
@ankitkalavagunta8951 Жыл бұрын
Very well explained!
@anamolacharya882
@anamolacharya882 4 жыл бұрын
A simple question, Did you use Node.js to create javabrains.io ? If not which language was used to develop the site? That would be a great help for me if you share about it.
@Manana7016
@Manana7016 2 жыл бұрын
I really appreciate your explanation! I’d love to hear your take on comparing node.js to other options like python, php, etc. But thank you again for this video.
@nicktheritter
@nicktheritter 2 жыл бұрын
Really well done video. Easy to follow. You're interesting to watch. Useful information. Thank you.
@mujkocka
@mujkocka Жыл бұрын
very nice videos. with a lot of design decision info. Devil is in the detail. so important.
@LunarcomplexMain
@LunarcomplexMain 4 жыл бұрын
So for an MMO, Node isn't / wouldn't be such a bad idea as long as keeping track of requests, responses, and other such actions (loops through any relevant entity like players, enemies, etc) are only done with small calculations?
@alexaneals8194
@alexaneals8194 Жыл бұрын
I would add one misnomer about NodeJS is that it is single-threaded. You cannot have callback functions in a single-threaded app. If you look at the video where the original designer of NodeJS describes how NodeJS can mimic a single-threaded app, but have the ability to use call back functionality like multi-threaded apps. He explains that NodeJS hides it's multithreading by having the Message (or what is now called Event) loop running on a single thread. So, when you use async functions the event loop will hand them off to a separate thread to execute. This effectively hides the complexities of multi-threading from the users so that it appears as a single-threaded app. However, NodeJS is multithreaded under the hood.
@ramshankarkumar4222
@ramshankarkumar4222 2 жыл бұрын
this content is awesome!!🎉 Thank you so much 😀 Just one question -- In multi threaded programming language, how number of thread pool is defined? Is it predefined by language or is configured by developer only? In any case, what could be the maximum number of thread pool can be created? Is there any parameters for it? Please answer if possible. Thanks
@delavago5379
@delavago5379 4 жыл бұрын
No offense but as a person from the Caribbean that normally needs a clear English accent to understand these videos your video was really clear and informative. Thank you 💕
@utkarshgupta2943
@utkarshgupta2943 3 жыл бұрын
This content is really good
@RAVIKUMAR-hl3ik
@RAVIKUMAR-hl3ik 3 жыл бұрын
Thank you very much it really gave me clarity
@anasalhariri5474
@anasalhariri5474 2 жыл бұрын
Would Nodejs still blocking if you used an asynchronous function to calculate the lengthy operation using nodeJS?
@HadiAriakia
@HadiAriakia 4 жыл бұрын
Multi threading, multiprocessing, asynchronous are independent. Each processor can handle multi-threads which each thread could be asynchronous or synchronous
@linqcodmax8965
@linqcodmax8965 4 жыл бұрын
Good work! Can u make this kind of video about Django framework?
@user-to9gg1wm7v
@user-to9gg1wm7v 3 жыл бұрын
Thanks and I really like you work...keep it up .
@thanasisathanasi4965
@thanasisathanasi4965 4 жыл бұрын
You have a very cool personality and style that I like !!!
@bryanescobar2251
@bryanescobar2251 2 жыл бұрын
You are the best man!
@yassine_klilich
@yassine_klilich 3 жыл бұрын
i really enjoyed this explanation, love it
@jfpinero
@jfpinero 4 жыл бұрын
Just curious on your thoughts of using node.js these days over netcore 3+?
@TP_Raks
@TP_Raks 4 жыл бұрын
The Hero we need but don't deserve. 😢Thank you so much good Sir. Great explanation
@iliyasmohammed6192
@iliyasmohammed6192 3 жыл бұрын
Thanks a lot for the explanation. Its really needed when diving into it.
@sarathchandran2815
@sarathchandran2815 3 жыл бұрын
Amazing presentation sir❤
@deepikagoyal1544
@deepikagoyal1544 11 ай бұрын
Do u think it is a good idea to make a service which interacts with database in node js , and other services that need data can just interact with node js service .
@truth-12345.
@truth-12345. 4 жыл бұрын
Single threaded? Will it be perfect for arm archeticture?
@sreerup_dhrino
@sreerup_dhrino 4 жыл бұрын
Simple loved it... Clear explanations with proper examples
@BenWeigt
@BenWeigt 4 жыл бұрын
Holdup, node is not strictly single threaded. You can initiate your own threads via workers and there are many legitimately multithreaded optimisations under the hood (eg I/O).
@cruzortiz5233
@cruzortiz5233 4 жыл бұрын
Hi excellent resource, i have a question. When talking about node and that computing intesive task, are things that node isn´t good for, i was wondering, about promises ?. If we wrap that computing intesive process into a promise, we wont block the main thread and we can still be able to build those types of app ?
@Samuel-ql7tq
@Samuel-ql7tq 4 жыл бұрын
Cruz Ortiz No, promises are nothing but a syntactic sugar on top of callbacks so it basically means whatever computation heavy task you wrapped inside promises still have to be executed by node’s main thread only
@kumailn7662
@kumailn7662 3 жыл бұрын
When you saying cpu intensive work can't be done in nodejs, why not mentioned we could make use of worker threads?
@Martin958
@Martin958 3 жыл бұрын
Asynchronous JavaScript can be thought of like a rugby player handing off the ball to a team mate (the event loop), then running forwards without it, then receiving the ball back again. (That's the runtime if you like). Multi-threaded is more like a player tucking the ball under their arm and barreling forwards alone which takes more energy to do. But then there are many players running forwards with the ball in multi-threading so the analogy with rugby breaks down here. So multi-threading still works well.
@milindpatel9947
@milindpatel9947 4 жыл бұрын
Hi, I'm node js developer, I have a question. Can we use async await or promises or callbacks for data calculations, processor intensive and blocking operations in node js?
@TheGaridi2
@TheGaridi2 4 жыл бұрын
I think it shouldn't be used in cpu intensive tasks
@MoolshankarTyagi
@MoolshankarTyagi 4 жыл бұрын
Yes, you can. Thats why Node.js is still in market.
@DC-tq6nd
@DC-tq6nd 4 жыл бұрын
No. To do this you should use the recently introduced worker threads, to prevent the processing from blocking your main thread.
@chigozie_jesse
@chigozie_jesse 4 жыл бұрын
What if you wrap the calculation intensive operation in async function? What about languages that can multi-threads with async functionalities?
@deepak3303
@deepak3303 4 жыл бұрын
It queues up async functions. The best thing you can do it offload the work to host OS with worker threads.
@sathieshmkumar6563
@sathieshmkumar6563 4 жыл бұрын
Is node.js good to build an app that invokes Elastic search. Our app often fails when there are huge number of search queries sent to ES server, it uses web sockets and easily runs out of the few thousand sockets
@syedkounainabbasmashaddy9936
@syedkounainabbasmashaddy9936 3 жыл бұрын
I need to build an health care application where n number of people will be hitting our server like patient, doctor, nurse, frontoffice and more roles added. Is it good to go with nodejs or php. Where my application will also have calculation of all the patient history, employees pay roles and more.
@abhay3545
@abhay3545 Жыл бұрын
Can u explain the performance difference between node with workers if I utilise all the cores and true multi threaded languages like Java...btw it was a great video🙂
@minch25
@minch25 3 жыл бұрын
Are there any platforms that are multithreaded and each thread uses an event loop? Wouldn't that be the best of both worlds?
@RamKumar-rg3gr
@RamKumar-rg3gr 4 жыл бұрын
Sir then Os internally allocates threads to multiple callbacks.
@mib3429
@mib3429 4 жыл бұрын
Awesome explanation. A comparison with Spring Boot would be even more meaningful specially for the peoples' following you from Java background. That way, people can relate more about which framework* excels on what. * just saying nodejs a framework to generalize things. I'm aware its a run-time and not a framework per se.
@spandiar
@spandiar 4 жыл бұрын
my thoughts too exactly
@gibranmohammadkhan6216
@gibranmohammadkhan6216 4 жыл бұрын
Please do a series on Design Patterns, if possible. Thanks
@FedJimSmith
@FedJimSmith 4 жыл бұрын
very nice explanation
@FG-qs8uj
@FG-qs8uj 4 жыл бұрын
I don't understand the for loop example. Wouldn't that be single threaded on any language? When you say a thread is that the same thread that CPUs mention in their specs?
@wontonfuton
@wontonfuton 4 жыл бұрын
Would I be correct in saying that NodeJS handles jobs equivalently as using SelectionKey and Selector in java?
@mkhalidumer
@mkhalidumer 4 жыл бұрын
can you please suggest, what should be used Where nodejs is not a good option ?
@aniruddhabasak7441
@aniruddhabasak7441 3 жыл бұрын
Great explanation. But one thing I have in my mind that, I think multi threaded can also be asynchronous. Then what's the point of using node js if we already know a multi threaded programing language? My question is, is there anything that node js can do but a multi threaded program with asynchronous can't?
@theyliketo
@theyliketo 4 жыл бұрын
You can make long computations non-blocking, too, if you use async generators. It's a bit more involved and it's probably not something you'd get into in a "basics" video, but it wouldn't be fair to convey that Node.js is decidedly helpless against these kind of workloads.
@eny1103
@eny1103 4 жыл бұрын
Thank you for this video! It was very informative!
@m1dway
@m1dway 4 жыл бұрын
What if you wrap intensive processing in a promise? Will it still blocks?
@FG-qs8uj
@FG-qs8uj 4 жыл бұрын
You could use node js for blocking operations if you create copies of the node process, is that right?
@lifedatatech6917
@lifedatatech6917 4 жыл бұрын
Great explanation!
@keshavkumar8385
@keshavkumar8385 3 жыл бұрын
explained really well ❤️
@David-kg5nn
@David-kg5nn 4 жыл бұрын
Thanks for this. I really enjoy the long form, in-depth discussion on one topic.
Their Boat Engine Fell Off
0:13
Newsflare
Рет қаралды 15 МЛН
Почему Катар богатый? #shorts
0:45
Послезавтра
Рет қаралды 2 МЛН
Ful Video ☝🏻☝🏻☝🏻
1:01
Arkeolog
Рет қаралды 14 МЛН
Node.js Ultimate Beginner’s Guide in 7 Easy Steps
16:20
Fireship
Рет қаралды 1,7 МЛН
How can a Java engineer catch up on AI?
7:26
Java Brains
Рет қаралды 24 М.
The Dome Paradox: A Loophole in Newton's Laws
22:59
Up and Atom
Рет қаралды 1,2 МЛН
What’s Up with Laravel? It’s Everywhere, and Here’s Why!
6:22
Why software development has become stressful
19:02
Java Brains
Рет қаралды 27 М.
Harsh Truth of Java in 2024! Ft. Ultimate Java Developer @Telusko
28:46
Node.js Tutorial for Beginners: Learn Node in 1 Hour
1:18:16
Programming with Mosh
Рет қаралды 6 МЛН
I posted a Java poll and I didn't expect this!
9:33
Java Brains
Рет қаралды 13 М.
You need to do this!
8:59
Java Brains
Рет қаралды 9 М.