Become a member
Sign in
Adrien
Adrien

Adrien

5 Following
3 Followers
  • Profile
  • Claps
  • Highlights

Highlighted by Adrien

See more

From How I built an app with 500,000 users in 5 days on a $100 server by Erik Duindam

As said, GoSnaps uses NodeJS as the backend language/platform, which is generally fast and efficient. I use Mongoose as an ORM to make the MongoDB work straightforward as a programmer. I’m not a Mongoose expert by any means and I know the library by itself has a huge codebase. Therefore Mongoose was a red flag. But yeah, MVP. At one point last weekend, our server’s 4 NodeJS processes were running at 90% CPU each, which is unacceptable to me for 800–1000 concurrent users. I realized that it had to be Mongoose doing things with my fetched data. Apparently I simply had to enable Mongoose’s “lean()” function to get plain JSON objects instead of magical Mongoose objects. After that change, the NodeJS processes dropped to around 5–10% CPU usage. Just the simple logic of knowing what your code actually does is very important. It reduced the load by 90%. Imagine having a really heavy library, like Symfony with Doctrine. It would have required a couple of servers with many CPU cores to just execute the code alone, even though the database is supposed to be the bottleneck, not the code.

Claps from Adrien

See more

Would have been nice if your example for the bit component was without implying a framework.

Michael J. Ryan

Conditional JavaScript for Experts

Glad Chinda

Running Mocha Tests as Native ES6 Modules in a Browser

Vitaliy Potapov