The Hidden Cost Of GraphQL And NodeJS

preview_player
Показать описание
Recorded live on twitch, GET IN

MY MAIN YT CHANNEL: Has well edited engineering videos

Discord

Hey I am sponsored by Turso, an edge database. I think they are pretty neet. Give them a try for free and if you want you can get a decent amount off (the free tier is the best (better than planetscale or any other))
Рекомендации по теме
Комментарии
Автор

I mean, in an interview someone said that NodeJS use a single thread and the interviewer didn't believe it, a lot of devs think promises are multithreading

neociber
Автор

To be fair, if SQL was actually SLQ, then it could be pronounced 'Slick' which I'd be a bit more tempted to use in speech than 'Squeal'

tharsis
Автор

Senior JavaScript developer had resolved this already - he had callback hell, then rewrote everything to Promises. Await came out, and then rewrote back to Promises. Then rewrote everything back to callback. *Because it is just more comfortable* 😅

Автор

JavaScript will try and run async code as sync code until it hits a point that forces it to the back of the event loop. Meaning if you attach the async keyword to a function with no await keyword inside it, it will run in sync and never be placed at the back of the event loop.

BlackAsLight
Автор

Thanks man, this helps a lot . We always got level up after watching your videos and you provide very good quality content . Anyone can create a video reading a blogpost but you discuss about it very well, explains the topic by keeping beginners in mind and taking about pros and cons of it .
I rarely write comment but this is worth it 👍

ivsldnr
Автор

Bad programming is bad programming. Using callbacks can lead to callback hell with bugs and impossible refactoring strategies, while Promises lead to event loop starvation and slow performance. But honestly, I can deal with a misplaced async situation much more quickly than the callback hell.

iulianbojinca
Автор

Funny that most of the issues pointed were not about graphql...

LucasLocatelli
Автор

"When your tracking software slows down your entire universe, that's not good." Best description of the Heisenberg Uncertainty Principle?

JeremyKolassa
Автор

There's another cost: Not knowing computers or working together with other software ecosystems. I had to work together with another company, which based their GraphQL API onto a standard SQL server. They didn't know how to access the GraphQL-API without a framework (like the URL). They didn't know how documentation works at all. Their error handling was non-existing. Their database structuring was just one giant JSON and little thinking was done about how to access certain data points. I think the sole focus onto JS/TypeScript and resulting frameworks really hurts the knowledge of what computers actually do or how other software ecosystems should be able to interact with yours.

aotein
Автор

JavaScript on the backend is only cost

PwrXenon
Автор

Promises are not inheritly slower, just the implementation. C++ promises can be optimized away completly. Rust's futures are optimizable as well. If JavaScript is your problem, you shouldn't change styles to make your code unmaintainable; you should change your language.

jaysistar
Автор

Really good explanation we need to keep this in mind. I had one thought how are Observables and Subjects vs Promise

tanmaytiwari
Автор

"Are callbacks really async if your date never does them?"
He got me

AqgvPr-hqvu
Автор

looks like 90% of people who learned graphql use it completely wrong! You should never do that for each loop and fetch each element of the array from IO! What you should do instead is Retrieve the query object the user sent, check if the array field is not undefined, and then build an SQL string that is performant and fetches what the user exactly requested. JUST CALL THE DB ONCE NOT A DOZEN TIMES

ES-ebpb
Автор

13:00 Hmmm not sure if I remember it right but I’ve tried this before, async functions that doesn’t perform an await operation does not get pushed back the queue, they act as though they aren’t async, the only time when the function gets pushed back the queue is when they do await.

aprilmintacpineda
Автор

“My favorite type of tweet is the one where everybody loses.”

rodrigolj
Автор

That last rant about that code snippet was one of the most important things I think I've ever heard.

mosescosme
Автор

Ultimatly it all depends on what project you are working on! I have a preference for GraphQL over Rest

grimm_gen
Автор

What if you loop the fields in the querry but do smth like a querry builder so we only get 1 promsise for all of the required data?

asoftyn
Автор

Thank you. This explains so many of my current issues...

wbtittle