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

  Рет қаралды 363,633

Java Brains

Java Brains

Күн бұрын

Have you seen the new Java Brains? Check out www.javabrains.io now for awesome courses and content!
Understand the core problems that Node.js was meant to solve and why it is a good choice for certain applications and not for some others! Learn the strengths and weaknesses of the Node.js platform.
Java Brains website: javabrains.io
Access the full course playlist here:
• NodeJS Basics
#JavaBrains #Node.js #JavaScript #Tutorial

Пікірлер: 422
@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
@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
@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.
@ujjalkar3243
@ujjalkar3243 4 жыл бұрын
java guys always hate node .. ha ha
@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.
@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.
@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.
@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.
@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
@karthik-ex4dm
@karthik-ex4dm 4 жыл бұрын
One of best explanations of event driven model of Node.js Eagerly waiting for the next video
@SelimAbidin
@SelimAbidin 4 жыл бұрын
Video is misleading. You should not do those things in any web server. İf you do, you have the consequences. İn Nodejs, you should be a bit more careful about blocking IO. There are some be benefits and lose.
@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.
@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.
@salmanamin3387
@salmanamin3387 3 жыл бұрын
This is not true - NodeJS runs with a single thread, not only nodejs all programs run with a single thread, that thread name is parent/master/main thread, but after nodejs-v12 has all accesses in processor cores, threads and pid(process id) and nodejs can use all these resource as its need and, this require depends on software or app needs. Nodejs also can create many threads without any limit as the app need.
@shaileshsingh5664
@shaileshsingh5664 4 жыл бұрын
NICE lets make this lockdown a little educational and knowledgeable
@linqcodmax8965
@linqcodmax8965 4 жыл бұрын
Good work! Can u make this kind of video about Django framework?
@ViralKiller
@ViralKiller Жыл бұрын
I guess you could use WASM for the processor intensive stuff
@somcho
@somcho 4 жыл бұрын
this video is not at all accurate. you can use threads in nodejs just fine here is the official documentation on that nodejs.org/api/worker_threads.html I know you did make mention of worker threads in this video. But you did so in a very hand wavy way. If you are going to explain this topic you have to treat workers in some depth!
@-Jakob-
@-Jakob- 4 жыл бұрын
@Branko Miric Why is that? Threads are offered by the CPU (via OS), it's not exactly a language feature. A worker thread is just a (reasonable) use case for that (imlementable in many languages, including C++, Java, Node.js).
@samegemba1741
@samegemba1741 4 жыл бұрын
13:46 He alludes to this for the second time in this video here.
@somcho
@somcho 4 жыл бұрын
@@samegemba1741 yes but his "allusion" is false or at best misleading. Don't get me wrong, there's a time and a place for using node.js, and valid reasons not to use it (for certain problems) .. but "lack of threading" is just not one of them.
@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 :)
@mykola5669
@mykola5669 4 жыл бұрын
That's the best "how, why and when" video about programming languages I saw by this day. Well done!
@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.
@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
@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.
@kaleemullahnizamani7436
@kaleemullahnizamani7436 4 жыл бұрын
Loving you since your first video of servlets. You shine 😎
@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
@ashishkhanchandani8976
@ashishkhanchandani8976 4 жыл бұрын
Waiting for the next video like it's a netflix eposide xD when are you releasing the next one? :l
@hinkhall5291
@hinkhall5291 Жыл бұрын
I like NodeJS. I hate npm.
@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
@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).
@jacobkjose
@jacobkjose 4 жыл бұрын
Unnecessarily long video. I clicked looking at the caption. The video is not crisp enough to meet the expectation.
@keshavrastogi5005
@keshavrastogi5005 4 жыл бұрын
that was really great. I was confused whether to use node.js or not, but now I am clear :) Thanks! :)
@suryasurya475
@suryasurya475 3 жыл бұрын
Full info about Common JavaScript Node : www.dotnet.idn-kxchange.com/blogs/post/75/Common-JavaScript-Node Visit : idn-kxchange.com/ for more info.
@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.
@DacrosMadafaka
@DacrosMadafaka 4 жыл бұрын
Bullshit... i made from scratch neural networks and i can run it with like 2000 neurons ( that depends and do the processing based on math functions and matrixes ( arrays of arrays ) ) in a 16gb ram server without no problem... And belive me thats a lot of calculations going on, math functions with matrixes wich are like a box with a lot of dimensions wich are composed by numbers... and each one of that numbers are beeing operated... AND OF COURSE THE EXAMPLE OF INTENSIVE CALCULATIONS YOU PUT ON THE VIDEO ( fribonachi, etc... ) ARE IMPOSIBLE BY ANY COMPUTER OR TAKE RIDICOULOUS AMOUNT OF TIME. But nice video by the technic part very usefull, anyway i would not recomend nodejs for sample website or common... if its web based page, api, anything else will do the job.
@Volitionary
@Volitionary 4 жыл бұрын
Wait a minute, I recognize that purple hoodie...
@saxtant
@saxtant 7 ай бұрын
You do realise you have Linux underneath node.js, if you want more parallelism than non blocking, it isn't difficult, run more than one process to achieve your goal, don't try to substitute os level parallelism. Maybe you prefer java, I prefer succinct code
@alexaneals8194
@alexaneals8194 10 ай бұрын
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.
@GhanshyamDobariya90
@GhanshyamDobariya90 3 жыл бұрын
just thinking about the people who disliked this video.... 🤦‍♂️ Thank you very very much sir for this video.
@eny1103
@eny1103 4 жыл бұрын
Thank you for this video! It was very informative!
@gibranmohammadkhan6216
@gibranmohammadkhan6216 4 жыл бұрын
Please do a series on Design Patterns, if possible. Thanks
@alejandrotorres-py4wz
@alejandrotorres-py4wz 4 жыл бұрын
Only with the advent of Promises and async await can you write complex maintainable code in nodejs. Otherwise, it was just a PITA. You beat me to making this video. There's nodejs code writing and then there's everyone else. nodejs does contextswitching on i/o functions while everyone else just interrupts your active thread when it wants to. When does IO happen? When you read/write from a pipe, port, file, db , msq. When does it NOT happen? when you read/write memory. And by the next event he means ONLY in a Nodejs microservice implementation. Why? Because in that model you actually have requests serviced as different events and ONLY in that scenario. Otherwise, when you writing a commandline nodeJS this is not the case.
@GH-bz2nw
@GH-bz2nw 2 жыл бұрын
Didn't Node.js introduce in 2018 the "worker threads" module that allowed developers to execute multiple threads simultaneously?
@denisedrey921
@denisedrey921 4 жыл бұрын
Guess people doesn't like node and js itself is because it's declarative driven way to build stuff, like array.dothis().thenthat().onevent((next)=>thenthat())
@Tony-dp1rl
@Tony-dp1rl Жыл бұрын
This is a little misleading, nodeJS does worker threads just fine, and V8's memory management is often better than Java's, making it perform just as well in many cases. It also ignores that most cpu-intensive applications scale their CPU load horizontally, not vertically on a single instance.
@shareefhiasat9746
@shareefhiasat9746 3 жыл бұрын
Request/Response Delima! Node.js is Asynchronous 5:30
@Gorky25
@Gorky25 2 жыл бұрын
Spring boot vs Node.js? Can they be compared? Do you have any advantage to learn Nodejs if you already somehow know Spring boot?
@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
@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?
@I_mhimdi
@I_mhimdi 2 ай бұрын
it is true that Node.js was initially single-threaded, but the introduction of worker threads allows for multi-threading.
@wedding_photography
@wedding_photography 4 жыл бұрын
Node.js is not single threaded. Learn about worker threads. nodejs.org/api/worker_threads.html
@yoapps137
@yoapps137 4 жыл бұрын
Your basic presumption is text book correct... But there were too many in inaccuracies in your video. I like your stuff, but this video could have been 5mins of basics... you landed up contradicting a lot of real world development and yourself by the end of the video.
@___GM___
@___GM___ 4 жыл бұрын
Those who hate nodejs are the one who still believe java is still a current thing. With nodejs, go and rust. You can say big bye to java. Its a big problem when oracle sued google android - the biggest user of java- for using java..... Now that kotlin and flutter is there for android . java has lost.
@user-uh3zr7mo4i
@user-uh3zr7mo4i Жыл бұрын
I disagree on the data-intensive point. working with nodejs for 4 years and I have always encountered challenges when handling substantial amounts of data.
@kamurashev
@kamurashev 3 жыл бұрын
I am totally agree with all being said but I think this asyncnes is often overestimated. One good example, say we have web service and it's written say in java and yes essentially it is 'thread based' but! It is the step forward of the thread idea, actually each request is handled by its own thread so there is no such an issue as one slowly processing request is blocking other requests. Number of threads that can be run at the same time depends just on amount of resources hardware has. Requests can only block itself so basically for final user service behavior just looks the same as for async approach.
@alexandertarasenko3038
@alexandertarasenko3038 4 жыл бұрын
It is pleasant to find Java devleoper who doesn't just blame javascript) Thank you for this movie!
@VirtualBiz
@VirtualBiz 4 жыл бұрын
I'm sorry but you only tell when not to use without a solution. With Node.js you can do computing intensive work done by a separate thread, in the meantime Node.js can continue and the worker thread notifies back the result when finished. So there are ways to deal with such circumstances.
@mujkocka
@mujkocka Жыл бұрын
very nice videos. with a lot of design decision info. Devil is in the detail. so important.
@seanb9949
@seanb9949 2 ай бұрын
Very clear explanation sir. I loved every minute of this video and walked away feeling like an expert.
@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.
@anasalhariri5474
@anasalhariri5474 2 жыл бұрын
Would Nodejs still blocking if you used an asynchronous function to calculate the lengthy operation using nodeJS?
@dsinghr
@dsinghr 2 жыл бұрын
Doesn’t orc frameworks like Fargate/Kubernetes take care of multithreading ?
@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
@alexisaddicted
@alexisaddicted 4 жыл бұрын
I think that for this video is great at explaining basic concepts in a simple way. Good job!
@armaandhanji2112
@armaandhanji2112 4 жыл бұрын
Thank you for talking about Node.js. I would love if you get into some of the advanced capabilities of Node.js! Thank you.
@sujaydutta
@sujaydutta 2 жыл бұрын
Would you use Java over NestJS/NodeJS for microservices development in 2022?
@jayak3768
@jayak3768 3 жыл бұрын
I don't follow ur concurrent connection model. TCP http is inherently stateless. Client Either wait for the response or make another call to get the result of previous call. If node JS has call back, then there has to be another thread to keep the connection open, when 200 ok is received than the call back is executed by this another thread. Or somehow node js enables and exposes client port to the server such that server can post the response to that client port. In that case also, client need another thread to monitor the port.
@alphabasic1759
@alphabasic1759 3 жыл бұрын
The node.us runtime is obviously multi-threaded or node.is could not support asynchronous calls or have an event-driven model.
@RishiRaj-lz5wk
@RishiRaj-lz5wk 3 жыл бұрын
I watched a 17min video without skipping a thing..Wow🤯
@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:
@ritasallai152
@ritasallai152 3 жыл бұрын
At 00:29 when he says "serverside", the subtititles read: "suicide". Is youtube being sarcastic?
@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.
@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?
@watherby29
@watherby29 2 жыл бұрын
Unless it's C# with async/await. It's multithreaded and asynchronous
@cheako91155
@cheako91155 4 жыл бұрын
Watched the whole video and looked at the top 20 or so comments. Rust eclipses Node for these use cases. Fearless threads now with async/await, with choice of event loop.
@agesnipes
@agesnipes 4 жыл бұрын
But isn’t the problem that Rust takes a while to pick up? Since business agility is a significant factor in establishing cost Rust for a lot of applications won’t be the primary choice
@cheako91155
@cheako91155 4 жыл бұрын
@@agesnipes I don't believe that was the scenario. Normally learning is done on your own time. If we are doing OTJT then wouldn't learning Rust be overall more productive? Learning Node to use for one situation and then learning Python for others is worse than using Rust in both cases.
@r-gart
@r-gart 4 жыл бұрын
Assembly eclipses both Technologies, yet businesses keep picking JS for writing web servers. I wonder why...
@13odman
@13odman 4 жыл бұрын
You’re not taking into account development time, hiring rust developers, etc. More developers know Javascript , period.
@cheako91155
@cheako91155 4 жыл бұрын
Charles Bodman The video is about cases where Node JS is not suitable... So knowing JS is not applicable. What good is short development time if the result is full of bugs, the extra dev time spent on Rust is the programmer fixing bugs that Rust identified. Again there is no point in interviewing ppl who don't know Rust because only their work has the qualifications needed. It used to be you were justified hiring just anybody, but now Rust positions eclips these legacy positions.
@thanasisathanasi4965
@thanasisathanasi4965 4 жыл бұрын
You have a very cool personality and style that I like !!!
@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. 🙏
@ManiKandan-wv6sx
@ManiKandan-wv6sx 4 жыл бұрын
Can yu do a video on springboot multitenancy with oracle or mysql db..
@mohammadtorabipour5843
@mohammadtorabipour5843 4 жыл бұрын
What an actual heavy load of bullshit you said about node js sir. Remove npm immediately.
@adarshpandya
@adarshpandya 4 жыл бұрын
Love from India
@sneak9407
@sneak9407 2 жыл бұрын
You deserve more likes and views for the great analysis on node in this video.
@GodofStories
@GodofStories Жыл бұрын
Except you have clustering that you can do now, to use all your cpu cores , node js cluster module.
@aki1840
@aki1840 Жыл бұрын
Great explanation! Unbiased opinion on Node. I’m tired of all these haters 😂
@wontonfuton
@wontonfuton 4 жыл бұрын
Would I be correct in saying that NodeJS handles jobs equivalently as using SelectionKey and Selector in java?
@sivakumarg98
@sivakumarg98 2 жыл бұрын
hey nice explanation dude, specifically when not to use, lovely :)
@deepikagoyal1544
@deepikagoyal1544 8 ай бұрын
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 .
@RamKumar-rg3gr
@RamKumar-rg3gr 4 жыл бұрын
Sir then Os internally allocates threads to multiple callbacks.
@ro3nov
@ro3nov 3 жыл бұрын
javascript is synchronous by default
@TheMr82k
@TheMr82k 4 жыл бұрын
Actually the thing that Node Js can't do expensive calculations is very wrong the real con is the event in Node JS shouldn't be very time consuming. Because all your events are essentially getting queued in the callstack and that Callstack has a limited space and it can only a lot limited number of events. Non blocking is actually useful when you have an event that can be completed asynchronous but in a set time period, so Node js can release the resources of that event. Now assume you have a Callstack that can handle 3 events max. You get 1 event it's asynchronously doing some task and get 2 more events. Generally people assume that 1st event would have been executed by now. But what if it hasn't it's making a network call and latency is very high the next event that comes will be dropped. And now you have the same problem as Multithreaded apps. The only difference Non blocking makes is the scale at which you will reach that mark but when you hit that mark you can't scale efficiently from that point. Because Node Js is single threaded and with other languages like Go you can you can upgrade your system and utilize more threads. Which ultimately makes the old school more reliable and scalable.
@TheMr82k
@TheMr82k 4 жыл бұрын
Also async and non blocking isn't something new it's really just bombed and a bunch of developers hoped onto the Is train to learn less
@AdaptedBass
@AdaptedBass 3 жыл бұрын
For me? All the time because javascript is all I know :D
@warrenarnold
@warrenarnold 2 жыл бұрын
nice video, but damnit this man is tired, oh lord that sweater. haha full nerd mode.
@KennedyEcheverry
@KennedyEcheverry 7 ай бұрын
very good explanation! Thanks.
@watherby29
@watherby29 2 жыл бұрын
You have violet hoodie matching the window border, nice ;)
@AK-ok2jh
@AK-ok2jh 4 жыл бұрын
Your single thread theory with "queue" is really blurred what i have learned till now about node js Node js will not block anything it will query less expensive statements first while it is running some more expensive statement.
@nayeemnayeem354
@nayeemnayeem354 4 жыл бұрын
That's what he said... U do have promises for every call whether it's less expensive or more. And obviously for less expensive calls the promise is returned earlier as expected which is more in the case of more expensive calls
@tejusp3992
@tejusp3992 4 жыл бұрын
Just use Golang .
@nathansodja
@nathansodja 4 жыл бұрын
Thanks but I think this would have been great with some animations, but still helpful though
@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.
@dhawalbhanushali4967
@dhawalbhanushali4967 3 жыл бұрын
Javascript is asynchronous? Sure?
@alfredorodriguez598
@alfredorodriguez598 4 жыл бұрын
I use NodeJS only For server data without any logic. If I need logic For enterprise solutions I go For asp core and C#.
@rodrigocaballerohurtado5367
@rodrigocaballerohurtado5367 4 жыл бұрын
Nice! Do you combine them together?
@user-to9gg1wm7v
@user-to9gg1wm7v 2 жыл бұрын
Thanks and I really like you work...keep it up .
@RogerValor
@RogerValor 4 жыл бұрын
Well, this is a lot to explain an event loop, but I have yet to see an application where the main loop / event loop is not single threaded, even in multithreaded applications...
Node.js is a serious thing now… (2023)
8:18
Code With Ryan
Рет қаралды 650 М.
Microservices are Technical Debt
31:59
NeetCodeIO
Рет қаралды 371 М.
Миллионер | 1 - серия
34:31
Million Show
Рет қаралды 2,1 МЛН
РОДИТЕЛИ НА ШКОЛЬНОМ ПРАЗДНИКЕ
01:00
SIDELNIKOVVV
Рет қаралды 1,8 МЛН
Node.js Ultimate Beginner’s Guide in 7 Easy Steps
16:20
Fireship
Рет қаралды 1,6 МЛН
This Is the Only Way to Truly Learn JavaScript
15:43
Chris Hawkes
Рет қаралды 616 М.
Spring Boot vs. Node | express.js vs Spring Boot
8:58
Jan Goebel
Рет қаралды 56 М.
No-Nonsense Backend Engineering Roadmap
10:16
Codebagel
Рет қаралды 205 М.
The Node.js Event Loop: Not So Single Threaded
31:54
node.js
Рет қаралды 166 М.
NGINX Tutorial - What is Nginx
14:32
TechWorld with Nana
Рет қаралды 183 М.
Mastering Memory Management in Node.js: Tips and Tricks for Better Performance
16:06
Software Developer Diaries
Рет қаралды 34 М.
I built 10 web apps... with 10 different languages
14:23
Fireship
Рет қаралды 1,6 МЛН
Node modules intro - Node.js Basics [08] - Java Brains
8:59
Java Brains
Рет қаралды 23 М.