Lazy Loading vs Eager Loading with Node JS & Express

Lazy Loading vs Eager Loading with Node JS & Express

Hussein Nasser

4 года назад

10,250 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Eghizio
Eghizio - 27.03.2021 21:54

MJS files, ahh yes the Michael Jackson Files

Ответить
Techture
Techture - 01.05.2020 16:25

Great overview, thank you!

Ответить
Alex Rusin
Alex Rusin - 04.04.2020 06:32

As you mentioned in the beginning, the person on github updates information 3 times a day. How would you blow your cache? Is simpy using setTimeout and either runnining the function to eager load again or null out cache variable a good approach?

Ответить
Kid Amador
Kid Amador - 03.04.2020 19:23

Always knew to lazy load when it comes to large data but before this, I didn't know Lazy load was called Lazy load hahaha.

Ответить
Chen Reuven
Chen Reuven - 02.04.2020 17:25

1. Thanks your are gr8
2. There is also a very nice combination with load balancer that can confuire on the fly the way you can use it depend on traffic :-)

Ответить
Noah Williams
Noah Williams - 01.04.2020 22:45

I like to lazyload some things and eagerload others, often within the same application. Funny as it is, that’s basically what I was doing without even thinking about it when using docker-compose’s “depends_on” feature. So for example if I’m using Nginx as a reverse proxy to a Node.js/express backend, I need to start up the Node process first and have it be ready to go before starting up Nginx, or Nginx will exit with an error (eagerload). But if I want the Node backend to talk to another nonessential microservice, I can omit the “depends_on” flag so they both start loading at the same time and whichever one loads first doesn’t matter (lazyload).

While writing this I just realized that you could argue from the opposite perspective; that the first scenario is lazyloading and the second is eagerloading. Hmm...🤔

Ответить
Viraj Singh
Viraj Singh - 01.04.2020 14:29

I always believed lazy loading was used on frontent for lazy loading UI components on basis of routes. Never knew it could be used on backend as well on microservices. Thanks!

Ответить